switch ( g_sendActivateEvent )
{
case -1:
- // we've got focus from outside, synthtize wxActivateEvent
+ // we've got focus from outside, synthetize wxActivateEvent
g_sendActivateEvent = 1;
break;
g_focusWindowLast =
g_focusWindow = win;
-/*
- printf( "OnSetFocus from " );
+#if 0
+ wxPrintf( "OnSetFocus from " );
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
- printf( win->GetClassInfo()->GetClassName() );
- printf( " " );
- printf( WXSTRINGCAST win->GetLabel() );
- printf( ".\n" );
-*/
+ wxPrintf( win->GetClassInfo()->GetClassName() );
+ wxPrintf( ".\n" );
+#endif
// notify the parent keeping track of focus for the kbd navigation
// purposes that we got it
- wxChildFocusEvent eventFocus(this);
- (void)GetEventHandler()->ProcessEvent(eventFocus);
+ wxChildFocusEvent eventFocus(win);
+ (void)win->GetEventHandler()->ProcessEvent(eventFocus);
#ifdef HAVE_XIM
if (win->m_ic)
}
#endif // wxUSE_CARET
-#if wxUSE_TEXTCTRL
- // If it's a wxTextCtrl don't send the event as it will be done
- // after the control gets to process it.
- wxTextCtrl *ctrl = wxDynamicCast(win, wxTextCtrl);
- if ( ctrl )
- {
- return FALSE;
- }
-#endif
-
if (win->IsTopLevel())
{
wxActivateEvent event( wxEVT_ACTIVATE, TRUE, win->GetId() );
g_focusWindow = (wxWindowGTK *)NULL;
-/*
- printf( "OnKillFocus from " );
+#if 0
+ wxPrintf( "OnKillFocus from " );
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
- printf( win->GetClassInfo()->GetClassName() );
- printf( ".\n" );
-*/
+ wxPrintf( win->GetClassInfo()->GetClassName() );
+ wxPrintf( ".\n" );
+#endif
#ifdef HAVE_XIM
if (win->m_ic)
}
#endif // wxUSE_CARET
-#if wxUSE_TEXTCTRL
- // If it's a wxTextCtrl don't send the event as it will be done
- // after the control gets to process it.
- wxTextCtrl *ctrl = wxDynamicCast(win, wxTextCtrl);
- if ( ctrl )
- {
- return FALSE;
- }
-#endif
-
if (win->IsTopLevel())
{
wxActivateEvent event( wxEVT_ACTIVATE, FALSE, win->GetId() );
if (!win->IsOwnGtkWindow( gdk_event->window )) return FALSE;
wxMouseEvent event( wxEVT_ENTER_WINDOW );
-#if (GTK_MINOR_VERSION > 0)
event.SetTimestamp( gdk_event->time );
-#endif
event.SetEventObject( win );
int x = 0;
if (!win->IsOwnGtkWindow( gdk_event->window )) return FALSE;
wxMouseEvent event( wxEVT_LEAVE_WINDOW );
-#if (GTK_MINOR_VERSION > 0)
event.SetTimestamp( gdk_event->time );
-#endif
event.SetEventObject( win );
int x = 0;
// GTK specific
m_widget = (GtkWidget *) NULL;
m_wxwindow = (GtkWidget *) NULL;
+ m_focusWidget = (GtkWidget *) NULL;
// position/size
m_x = 0;
m_noExpose = FALSE;
m_nativeSizeEvent = FALSE;
-
+
m_hasScrolling = FALSE;
m_isScrolling = FALSE;
if (m_parent)
m_parent->DoAddChild( this );
+
+ m_focusWidget = m_wxwindow;
PostCreation();
void wxWindowGTK::PostCreation()
{
wxASSERT_MSG( (m_widget != NULL), wxT("invalid window") );
-
+
if (m_wxwindow)
{
if (!m_noExpose)
{
- /* these get reported to wxWindows -> wxPaintEvent */
+ // these get reported to wxWindows -> wxPaintEvent
gtk_pizza_set_external( GTK_PIZZA(m_wxwindow), TRUE );
}
}
-#if (GTK_MINOR_VERSION > 0)
- /* these are called when the "sunken" or "raised" borders are drawn */
+ // these are called when the "sunken" or "raised" borders are drawn */
gtk_signal_connect( GTK_OBJECT(m_widget), "expose_event",
GTK_SIGNAL_FUNC(gtk_window_own_expose_callback), (gpointer)this );
gtk_signal_connect( GTK_OBJECT(m_widget), "draw",
GTK_SIGNAL_FUNC(gtk_window_own_draw_callback), (gpointer)this );
-#endif
}
- if (m_wxwindow && m_needParent)
- {
- gtk_signal_connect( GTK_OBJECT(m_wxwindow), "focus_in_event",
- GTK_SIGNAL_FUNC(gtk_window_focus_in_callback), (gpointer)this );
+ // focus handling
- gtk_signal_connect( GTK_OBJECT(m_wxwindow), "focus_out_event",
- GTK_SIGNAL_FUNC(gtk_window_focus_out_callback), (gpointer)this );
- }
- else
- {
- // For dialogs and frames, we are interested mainly in
- // m_widget's focus.
+ if (m_focusWidget == NULL)
+ m_focusWidget = m_widget;
- gtk_signal_connect( GTK_OBJECT(m_widget), "focus_in_event",
- GTK_SIGNAL_FUNC(gtk_window_focus_in_callback), (gpointer)this );
+#if 0
+ if (GetClassInfo() && GetClassInfo()->GetClassName())
+ wxPrintf( GetClassInfo()->GetClassName() );
+ wxPrintf( ".\n" );
+#endif
- gtk_signal_connect( GTK_OBJECT(m_widget), "focus_out_event",
- GTK_SIGNAL_FUNC(gtk_window_focus_out_callback), (gpointer)this );
- }
+ gtk_signal_connect( GTK_OBJECT(m_focusWidget), "focus_in_event",
+ GTK_SIGNAL_FUNC(gtk_window_focus_in_callback), (gpointer)this );
+
+ gtk_signal_connect( GTK_OBJECT(m_focusWidget), "focus_out_event",
+ GTK_SIGNAL_FUNC(gtk_window_focus_out_callback), (gpointer)this );
+
+ // connect to the various key and mouse handlers
GtkWidget *connect_widget = GetConnectWidget();
if (m_resizing) return; /* I don't like recursions */
m_resizing = TRUE;
+ int currentX, currentY;
+ GetPosition(¤tX, ¤tY);
+ if (x == -1)
+ x = currentX;
+ if (y == -1)
+ y = currentY;
+ AdjustForParentClientOrigin(x, y, sizeFlags);
+
if (m_parent->m_wxwindow == NULL) /* i.e. wxNotebook */
{
/* don't set the size for children of wxNotebook, just take the values. */
g_sendActivateEvent = -1;
wxTheApp->SetActive(activate, (wxWindow *)g_focusWindowLast);
-
- wxActivateEvent event(wxEVT_ACTIVATE_APP, activate, GetId());
- event.SetEventObject(this);
-
- (void)GetEventHandler()->ProcessEvent(event);
}
wxCursor cursor = m_cursor;
dx = pizza->xoffset;
dy = pizza->yoffset;
}
+
+ int nx = m_x - dx;
+ int ny = m_y - dy;
+
+ if ( !IsTopLevel() && m_parent )
+ {
+ // We may be faking the client origin. So a window that's really at (0,
+ // 30) may appear (to wxWin apps) to be at (0, 0).
+ wxPoint pt(m_parent->GetClientAreaOrigin());
+ nx -= pt.x;
+ ny -= pt.y;
+ }
- if (x) (*x) = m_x - dx;
- if (y) (*y) = m_y - dy;
+ if (x) (*x) = nx;
+ if (y) (*y) = ny;
}
void wxWindowGTK::DoClientToScreen( int *x, int *y ) const