Send menu highlight events and fix statusbar to update immediatly when
status text is changed git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25204 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
3dfafdb9e6
commit
852b118501
@ -290,6 +290,7 @@ void wxApp::MacNewFile()
|
||||
|
||||
{ kEventClassMenu, kEventMenuOpening },
|
||||
{ kEventClassMenu, kEventMenuClosed },
|
||||
{ kEventClassMenu, kEventMenuTargetItem },
|
||||
|
||||
{ kEventClassApplication , kEventAppActivated } ,
|
||||
{ kEventClassApplication , kEventAppDeactivated } ,
|
||||
@ -308,8 +309,9 @@ void wxApp::MacNewFile()
|
||||
static pascal OSStatus
|
||||
MenuEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
|
||||
{
|
||||
// FIXME: this doesn't work for multiple windows
|
||||
wxWindow *win = wxTheApp->GetTopWindow();
|
||||
wxMenuBar* mbar = wxMenuBar::MacGetInstalledMenuBar();
|
||||
wxFrame* win = mbar->GetFrame();
|
||||
|
||||
if ( win )
|
||||
{
|
||||
// VZ: we could find the menu from its handle here by examining all
|
||||
@ -325,9 +327,29 @@ MenuEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
|
||||
&menuRef);
|
||||
#endif // 0
|
||||
|
||||
wxMenuEvent wxevent(GetEventKind(event) == kEventMenuOpening
|
||||
? wxEVT_MENU_OPEN
|
||||
: wxEVT_MENU_CLOSE);
|
||||
wxEventType type=0;
|
||||
MenuCommand cmd=0;
|
||||
switch (GetEventKind(event))
|
||||
{
|
||||
case kEventMenuOpening:
|
||||
type = wxEVT_MENU_OPEN;
|
||||
break;
|
||||
case kEventMenuClosed:
|
||||
type = wxEVT_MENU_CLOSE;
|
||||
break;
|
||||
case kEventMenuTargetItem:
|
||||
type = wxEVT_MENU_HIGHLIGHT;
|
||||
GetEventParameter(event, kEventParamMenuCommand,
|
||||
typeMenuCommand, NULL,
|
||||
sizeof(cmd), NULL, &cmd);
|
||||
if (cmd == 0) return eventNotHandledErr;
|
||||
break;
|
||||
default:
|
||||
wxFAIL_MSG(wxT("Unexpected menu event kind"));
|
||||
break;
|
||||
}
|
||||
|
||||
wxMenuEvent wxevent(type, cmd);
|
||||
wxevent.SetEventObject(win);
|
||||
|
||||
(void)win->GetEventHandler()->ProcessEvent(wxevent);
|
||||
|
@ -290,6 +290,7 @@ void wxApp::MacNewFile()
|
||||
|
||||
{ kEventClassMenu, kEventMenuOpening },
|
||||
{ kEventClassMenu, kEventMenuClosed },
|
||||
{ kEventClassMenu, kEventMenuTargetItem },
|
||||
|
||||
{ kEventClassApplication , kEventAppActivated } ,
|
||||
{ kEventClassApplication , kEventAppDeactivated } ,
|
||||
@ -308,8 +309,9 @@ void wxApp::MacNewFile()
|
||||
static pascal OSStatus
|
||||
MenuEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
|
||||
{
|
||||
// FIXME: this doesn't work for multiple windows
|
||||
wxWindow *win = wxTheApp->GetTopWindow();
|
||||
wxMenuBar* mbar = wxMenuBar::MacGetInstalledMenuBar();
|
||||
wxFrame* win = mbar->GetFrame();
|
||||
|
||||
if ( win )
|
||||
{
|
||||
// VZ: we could find the menu from its handle here by examining all
|
||||
@ -325,9 +327,29 @@ MenuEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
|
||||
&menuRef);
|
||||
#endif // 0
|
||||
|
||||
wxMenuEvent wxevent(GetEventKind(event) == kEventMenuOpening
|
||||
? wxEVT_MENU_OPEN
|
||||
: wxEVT_MENU_CLOSE);
|
||||
wxEventType type=0;
|
||||
MenuCommand cmd=0;
|
||||
switch (GetEventKind(event))
|
||||
{
|
||||
case kEventMenuOpening:
|
||||
type = wxEVT_MENU_OPEN;
|
||||
break;
|
||||
case kEventMenuClosed:
|
||||
type = wxEVT_MENU_CLOSE;
|
||||
break;
|
||||
case kEventMenuTargetItem:
|
||||
type = wxEVT_MENU_HIGHLIGHT;
|
||||
GetEventParameter(event, kEventParamMenuCommand,
|
||||
typeMenuCommand, NULL,
|
||||
sizeof(cmd), NULL, &cmd);
|
||||
if (cmd == 0) return eventNotHandledErr;
|
||||
break;
|
||||
default:
|
||||
wxFAIL_MSG(wxT("Unexpected menu event kind"));
|
||||
break;
|
||||
}
|
||||
|
||||
wxMenuEvent wxevent(type, cmd);
|
||||
wxevent.SetEventObject(win);
|
||||
|
||||
(void)win->GetEventHandler()->ProcessEvent(wxevent);
|
||||
|
@ -72,7 +72,7 @@ void wxStatusBarMac::DrawFieldText(wxDC& dc, int i)
|
||||
dc.GetTextExtent(text, &x, &y);
|
||||
|
||||
int xpos = rect.x + leftMargin + 1 ;
|
||||
int ypos = 2 ;
|
||||
int ypos = 1 ;
|
||||
|
||||
dc.SetClippingRegion(rect.x, 0, rect.width, m_height);
|
||||
|
||||
@ -97,6 +97,7 @@ void wxStatusBarMac::SetStatusText(const wxString& text, int number)
|
||||
rect.y=0;
|
||||
rect.height = m_height ;
|
||||
Refresh( TRUE , &rect ) ;
|
||||
Update();
|
||||
}
|
||||
|
||||
void wxStatusBarMac::OnPaint(wxPaintEvent& WXUNUSED(event) )
|
||||
|
@ -72,7 +72,7 @@ void wxStatusBarMac::DrawFieldText(wxDC& dc, int i)
|
||||
dc.GetTextExtent(text, &x, &y);
|
||||
|
||||
int xpos = rect.x + leftMargin + 1 ;
|
||||
int ypos = 2 ;
|
||||
int ypos = 1 ;
|
||||
|
||||
dc.SetClippingRegion(rect.x, 0, rect.width, m_height);
|
||||
|
||||
@ -97,6 +97,7 @@ void wxStatusBarMac::SetStatusText(const wxString& text, int number)
|
||||
rect.y=0;
|
||||
rect.height = m_height ;
|
||||
Refresh( TRUE , &rect ) ;
|
||||
Update();
|
||||
}
|
||||
|
||||
void wxStatusBarMac::OnPaint(wxPaintEvent& WXUNUSED(event) )
|
||||
|
Loading…
Reference in New Issue
Block a user