Implement wxTopLevelWindow::EnableCloseButton() for wxOSX
Just forward this wx method to Cocoa standardWindowButton:NSWindowCloseButton. See #17133
This commit is contained in:
committed by
Vadim Zeitlin
parent
8d6a2b3921
commit
6055d8d0a5
@@ -173,6 +173,7 @@ wxOSX/Cocoa:
|
||||
|
||||
- Use more efficient FSEvents (10.7+) in wxFileSystemWatcher (Roberto Perpuly).
|
||||
- Implement wxWindow::Disable() for non-native controls too (Steve Browne).
|
||||
- Implement wxTopLevelWindow::EnableCloseButton() (John Roberts).
|
||||
- Fix wxEVT_CHAR for non-BMP Unicode characters (ARATA Mizuki).
|
||||
- Add support for wxEVT_COMBOBOX_DROPDOWN and wxEVT_COMBOBOX_CLOSEUP
|
||||
events (Igor Korot).
|
||||
|
@@ -231,6 +231,8 @@ public :
|
||||
|
||||
virtual void SetTitle( const wxString& title, wxFontEncoding encoding ) ;
|
||||
|
||||
virtual bool EnableCloseButton(bool enable) wxOVERRIDE;
|
||||
|
||||
virtual bool IsMaximized() const;
|
||||
|
||||
virtual bool IsIconized() const;
|
||||
|
@@ -847,6 +847,8 @@ public :
|
||||
|
||||
virtual void SetTitle( const wxString& title, wxFontEncoding encoding ) = 0;
|
||||
|
||||
virtual bool EnableCloseButton(bool enable) = 0;
|
||||
|
||||
virtual bool IsMaximized() const = 0;
|
||||
|
||||
virtual bool IsIconized() const= 0;
|
||||
|
@@ -74,6 +74,10 @@ public:
|
||||
virtual void SetTitle( const wxString& title);
|
||||
virtual wxString GetTitle() const;
|
||||
|
||||
// EnableCloseButton(false) used to disable the "Close"
|
||||
// button on the title bar
|
||||
virtual bool EnableCloseButton(bool enable = true) wxOVERRIDE;
|
||||
|
||||
virtual void SetLabel(const wxString& label) { SetTitle( label ); }
|
||||
virtual wxString GetLabel() const { return GetTitle(); }
|
||||
|
||||
|
@@ -142,8 +142,6 @@ public:
|
||||
corner of a dialog) and the Close entry of the system menu (most often
|
||||
in the left upper corner of the dialog).
|
||||
|
||||
Currently only implemented for wxMSW and wxGTK.
|
||||
|
||||
Returns @true if operation was successful. This may be wrong on X11
|
||||
(including GTK+) where the window manager may not support this operation
|
||||
and there is no way to find out.
|
||||
|
@@ -939,6 +939,13 @@ void wxNonOwnedWindowCocoaImpl::SetTitle( const wxString& title, wxFontEncoding
|
||||
[m_macWindow setTitle:wxCFStringRef( title , encoding ).AsNSString()];
|
||||
}
|
||||
|
||||
bool wxNonOwnedWindowCocoaImpl::EnableCloseButton(bool enable)
|
||||
{
|
||||
[[m_macWindow standardWindowButton:NSWindowCloseButton] setEnabled:enable];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool wxNonOwnedWindowCocoaImpl::IsMaximized() const
|
||||
{
|
||||
if (([m_macWindow styleMask] & NSResizableWindowMask) != 0)
|
||||
|
@@ -205,6 +205,16 @@ bool wxTopLevelWindowMac::IsFullScreen() const
|
||||
return m_nowpeer->IsFullScreen();
|
||||
}
|
||||
|
||||
bool wxTopLevelWindowMac::EnableCloseButton(bool enable)
|
||||
{
|
||||
// Unlike in wxMSW, wxSYSTEM_MENU is not sufficient to show
|
||||
// a close button unless combined with one of the resize buttons.
|
||||
if ( HasFlag(wxCLOSE_BOX) )
|
||||
return m_nowpeer->EnableCloseButton( enable);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void wxTopLevelWindowMac::RequestUserAttention(int flags)
|
||||
{
|
||||
return m_nowpeer->RequestUserAttention(flags);
|
||||
|
Reference in New Issue
Block a user