EVT_INIT_DIALOG(wxWindowMac::OnInitDialog)
EVT_IDLE(wxWindowMac::OnIdle)
EVT_SET_FOCUS(wxWindowMac::OnSetFocus)
+ EVT_MOUSE_EVENTS(wxWindowMac::OnMouseEvent)
END_EVENT_TABLE()
#endif
// generic
InitBase();
- // MSW specific
- m_doubleClickAllowed = 0;
- m_winCaptured = FALSE;
-
m_isBeingDeleted = FALSE;
-
- m_useCtl3D = FALSE;
- m_mouseInWindow = FALSE;
-
- m_xThumbSize = 0;
- m_yThumbSize = 0;
m_backgroundTransparent = FALSE;
// as all windows are created with WS_VISIBLE style...
}
m_isBeingDeleted = TRUE;
-
+
#ifndef __WXUNIVERSAL__
// VS: make sure there's no wxFrame with last focus set to us:
for ( wxWindow *win = GetParent(); win; win = win->GetParent() )
if ( m_parent )
m_parent->RemoveChild(this);
- wxWindowDestroyEvent event((wxWindow *)this);
- (void)GetEventHandler()->ProcessEvent(event);
-
// delete our drop target if we've got one
#if wxUSE_DRAG_AND_DROP
if ( m_dropTarget != NULL )
menu->UpdateUI();
ClientToScreen( &x , &y ) ;
- ::InsertMenu( (MenuHandle) menu->GetHMenu() , -1 ) ;
+ menu->MacBeforeDisplay( true ) ;
long menuResult = ::PopUpMenuSelect((MenuHandle) menu->GetHMenu() ,y,x, 0) ;
if ( HiWord(menuResult) != 0 )
{
MenuCommand id ;
GetMenuItemCommandID( GetMenuHandle(HiWord(menuResult)) , LoWord(menuResult) , &id ) ;
-
- wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED, id );
- event.m_timeStamp = TickCount() ;
- event.SetEventObject(this->GetEventHandler());
- event.SetInt( id );
- GetEventHandler()->ProcessEvent(event);
+ wxMenuItem* item = NULL ;
+ wxMenu* realmenu ;
+ item = menu->FindItem(id, &realmenu) ;
+ if (item->IsCheckable())
+ {
+ item->Check( !item->IsChecked() ) ;
+ }
+ menu->SendEvent( id , item->IsCheckable() ? item->IsChecked() : -1 ) ;
}
- ::DeleteMenu( menu->MacGetMenuId() ) ;
+ menu->MacAfterDisplay( true ) ;
+
menu->SetInvokingWindow(NULL);
return TRUE;
if ( !wxWindowBase::Show(show) )
return FALSE;
-/*
- WindowRef window = (WindowRef) MacGetRootWindow() ;
- wxWindowMac* win = wxFindWinFromMacWindow( window ) ;
- if ( win == NULL && win->m_isBeingDeleted )
- return FALSE ;
-*/
MacSuperShown( show ) ;
Refresh() ;
-/*
- if ( !show )
- {
- if ( win && !win->m_isBeingDeleted )
- Refresh() ;
- }
- else
- {
- Refresh() ;
- }
-*/
+
return TRUE;
}
wxWindowListNode *node = GetChildren().GetFirst();
while ( node )
{
- wxWindowMac *child = (wxWindowMac *)node->GetData();
+ wxWindowMac *child = node->GetData();
if ( child->m_isShown )
child->MacSuperShown( show ) ;
node = node->GetNext();
for (wxWindowListNode *node = GetChildren().GetFirst(); node; node = node->GetNext())
{
- wxWindowMac *child = (wxWindowMac*)node->GetData();
+ wxWindowMac *child = node->GetData();
if (child == m_vScrollBar) continue;
if (child == m_hScrollBar) continue;
if (child->IsTopLevel()) continue;
void wxWindowMac::OnIdle(wxIdleEvent& event)
{
-/*
- // Check if we need to send a LEAVE event
- if (m_mouseInWindow)
- {
- POINT pt;
- ::GetCursorPos(&pt);
- if (::WindowFromPoint(pt) != (HWND) GetHWND())
- {
- // Generate a LEAVE event
- m_mouseInWindow = FALSE;
- MSWOnMouseLeave(pt.x, pt.y, 0);
- }
- }
-*/
-
// This calls the UI-update mechanism (querying windows for
// menu/toolbar/control state information)
UpdateWindowUI();
for (wxWindowListNode *node = GetChildren().GetFirst(); node; node = node->GetNext())
{
- wxWindowMac *child = (wxWindowMac*)node->GetData();
+ wxWindowMac *child = node->GetData();
// added the m_isShown test --dmazzoni
if ( child->MacGetRootWindow() == window && child->m_isShown )
{
for (wxWindowListNode *node = GetChildren().GetFirst(); node; node = node->GetNext())
{
- wxWindowMac *child = (wxWindowMac*)node->GetData();
+ wxWindowMac *child = node->GetData();
if ( child->MacGetRootWindow() == window && child->IsShown() && child->IsEnabled() )
{
if (child->MacDispatchMouseEvent(event))
{
return m_tooltip->GetTip() ;
}
- return "" ;
+ return wxEmptyString ;
}
void wxWindowMac::Update()
{
for (wxWindowListNode *node = GetChildren().GetFirst(); node; node = node->GetNext())
{
- wxWindowMac *child = (wxWindowMac*)node->GetData();
+ wxWindowMac *child = node->GetData();
if ( !child->IsTopLevel() && child->IsShown() )
{
bool thisWindowThrough = false ;
for (wxWindowListNode *node = GetParent()->GetChildren().GetFirst(); node; node = node->GetNext())
{
- wxWindowMac *sibling = (wxWindowMac*)node->GetData();
+ wxWindowMac *sibling = node->GetData();
if ( sibling == this )
{
thisWindowThrough = true ;
{
// calculate the update region for the child windows by intersecting the window rectangle with our own
// passed in update region and then offset it to be client-wise window coordinates again
- wxWindowMac *child = (wxWindowMac*)node->GetData();
+ wxWindowMac *child = node->GetData();
SetRectRgn( childupdate , child->m_x , child->m_y , child->m_x + child->m_width , child->m_y + child->m_height ) ;
SectRgn( childupdate , updatergn , childupdate ) ;
OffsetRgn( childupdate , -child->m_x , -child->m_y ) ;
iter = iter->GetParent() ;
}
- wxASSERT_MSG( 1 , "No valid mac root window" ) ;
+ wxASSERT_MSG( 1 , wxT("No valid mac root window") ) ;
return NULL ;
}
void wxWindowMac::MacCreateScrollBars( long style )
{
- wxASSERT_MSG( m_vScrollBar == NULL && m_hScrollBar == NULL , "attempt to create window twice" ) ;
+ wxASSERT_MSG( m_vScrollBar == NULL && m_hScrollBar == NULL , wxT("attempt to create window twice") ) ;
bool hasBoth = ( style & wxVSCROLL ) && ( style & wxHSCROLL ) ;
int adjust = hasBoth ? MAC_SCROLLBAR_SIZE - 1: 0 ;
wxWindowListNode *node = GetChildren().GetFirst();
while ( node )
{
- wxWindowMac *child = (wxWindowMac *)node->GetData();
+ wxWindowMac *child = node->GetData();
child->MacSuperChangedPosition() ;
node = node->GetNext();
}
wxWindowListNode *node = GetChildren().GetFirst();
while ( node )
{
- wxWindowMac *child = (wxWindowMac *)node->GetData();
+ wxWindowMac *child = node->GetData();
child->MacTopLevelWindowChangedPosition() ;
node = node->GetNext();
}
return wxPoint(x, y);
}
+void wxWindowMac::OnMouseEvent( wxMouseEvent &event )
+{
+ if ( event.GetEventType() == wxEVT_RIGHT_DOWN )
+ {
+ // copied from wxGTK : CS
+ // generate a "context menu" event: this is similar to wxEVT_RIGHT_DOWN
+ // except that:
+ //
+ // (a) it's a command event and so is propagated to the parent
+ // (b) under MSW it can be generated from kbd too
+ // (c) it uses screen coords (because of (a))
+ wxContextMenuEvent evtCtx(wxEVT_CONTEXT_MENU,
+ this->GetId(),
+ this->ClientToScreen(event.GetPosition()));
+ if ( ! GetEventHandler()->ProcessEvent(evtCtx) )
+ event.Skip() ;
+ }
+ else
+ {
+ event.Skip() ;
+ }
+}
+