Closed
Bug 775041
Opened 14 years ago
Closed 14 years ago
Make nsIWidget::IsEnabled return bool
Categories
(Core :: Widget, enhancement)
Core
Widget
Tracking
()
RESOLVED
FIXED
mozilla17
People
(Reporter: Ms2ger, Assigned: capella)
Details
(Whiteboard: [good first bug][mentor=Ms2ger][lang=c++])
Attachments
(2 files, 1 obsolete file)
|
19.57 KB,
patch
|
Ms2ger
:
feedback+
|
Details | Diff | Splinter Review |
|
20.27 KB,
patch
|
roc
:
review+
|
Details | Diff | Splinter Review |
Currently, it returns an nsresult, but all implementations return NS_OK. Instead, the boolean should be returned directly; the signature should be
virtual bool IsEnabled() const;
http://mxr.mozilla.org/mozilla-central/ident?i=IsEnabled&tree=mozilla-central&filter=&strict=1
| Assignee | ||
Updated•14 years ago
|
Assignee: nobody → markcapella
Status: NEW → ASSIGNED
| Assignee | ||
Comment 1•14 years ago
|
||
Initial patch ... passes try server builds / tests ... posting so I can look @ the side-by-side DIFF, then I'll ping for feedback ...
| Assignee | ||
Updated•14 years ago
|
Attachment #644495 -
Flags: feedback?(Ms2ger)
| Reporter | ||
Comment 2•14 years ago
|
||
Comment on attachment 644495 [details] [diff] [review]
Patch (v1)
Review of attachment 644495 [details] [diff] [review]:
-----------------------------------------------------------------
Looks good, thanks!
::: widget/nsIWidget.h
@@ +765,5 @@
> NS_IMETHOD Enable(bool aState) = 0;
>
> /**
> * Ask whether the widget is enabled
> * @param aState returns true if the widget is enabled
This isn't a param anymore
::: widget/os2/nsWindow.cpp
@@ -569,5 @@
> {
> - NS_ENSURE_ARG_POINTER(aState);
> - HWND hMain = GetMainWindow();
> - *aState = !hMain || WinIsWindowEnabled(hMain);
> - return NS_OK;
You should probably keep the null check on hMain here.
::: widget/windows/nsWindow.cpp
@@ +1687,5 @@
> // Return the current enable state
> +bool nsWindow::IsEnabled() const
> +{
> + return !mWnd ||
> + (::IsWindowEnabled(mWnd) &&
Can you line up the ( with the ! on the line above?
Attachment #644495 -
Flags: feedback?(Ms2ger) → feedback+
| Assignee | ||
Comment 3•14 years ago
|
||
Cool....
FYI for the code in widget/os2/nsWindow.cpp, I had figured it would be ok to slightly modify, based on the OS2/API's here:
http://www.warpspeed.com.au/cgi-bin/inf2html.cmd?..\html\book\Toolkt40\PM2.INF+1350
http://www.warpspeed.com.au/cgi-bin/inf2html.cmd?..\html\book\Toolkt40\PM2.INF+1330
and the code we just put in place in the same module for IsVisible() here:
http://mxr.mozilla.org/mozilla-central/source/widget/os2/nsWindow.cpp#601
But leaving it alone is safest ... and will change it as suggested.
| Assignee | ||
Comment 4•14 years ago
|
||
Nits fixed and TRY run ...
https://tbpl.mozilla.org/?tree=Try&rev=7213f82ba428
Attachment #644695 -
Flags: review?(roc)
Comment on attachment 644695 [details] [diff] [review]
Patch (v2) Nits Fixed
Review of attachment 644695 [details] [diff] [review]:
-----------------------------------------------------------------
::: widget/nsIWidget.h
@@ +769,2 @@
> */
> + virtual bool IsEnabled() const = 0;
Need to update the IID on nsIWidget.
| Assignee | ||
Comment 6•14 years ago
|
||
Attachment #644695 -
Attachment is obsolete: true
Attachment #644695 -
Flags: review?(roc)
| Assignee | ||
Comment 7•14 years ago
|
||
Comment on attachment 644802 [details] [diff] [review]
Patch (v3) - Nits and IID Fixed
Doh!
Attachment #644802 -
Flags: review?(roc)
Attachment #644802 -
Flags: review?(roc) → review+
| Assignee | ||
Comment 8•14 years ago
|
||
Comment 9•14 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla17
You need to log in
before you can comment on or make changes to this bug.
Description
•