Closed Bug 775041 Opened 14 years ago Closed 14 years ago

Make nsIWidget::IsEnabled return bool

Categories

(Core :: Widget, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla17

People

(Reporter: Ms2ger, Assigned: capella)

Details

(Whiteboard: [good first bug][mentor=Ms2ger][lang=c++])

Attachments

(2 files, 1 obsolete file)

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: nobody → markcapella
Status: NEW → ASSIGNED
Attached patch Patch (v1) — — Splinter Review
Initial patch ... passes try server builds / tests ... posting so I can look @ the side-by-side DIFF, then I'll ping for feedback ...
Attachment #644495 - Flags: feedback?(Ms2ger)
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+
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.
Attached patch Patch (v2) Nits Fixed (obsolete) — — Splinter Review
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.
Attachment #644695 - Attachment is obsolete: true
Attachment #644695 - Flags: review?(roc)
Comment on attachment 644802 [details] [diff] [review] Patch (v3) - Nits and IID Fixed Doh!
Attachment #644802 - Flags: review?(roc)
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.

Attachment

General

Created:
Updated:
Size: