Minor Reparent() and SetToolBar() fix for wxFrame.
Corrected size reported by wxToolBar. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4078 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -358,6 +358,8 @@ void MyTextCtrl::OnChar(wxKeyEvent& event)
|
|||||||
{
|
{
|
||||||
LogEvent( _T("Char"), event);
|
LogEvent( _T("Char"), event);
|
||||||
|
|
||||||
|
/* How are we supposed to test wxTE_PROCESS_TAB with this code?
|
||||||
|
|
||||||
if ( event.KeyCode() == WXK_TAB )
|
if ( event.KeyCode() == WXK_TAB )
|
||||||
{
|
{
|
||||||
WriteText("\t");
|
WriteText("\t");
|
||||||
@@ -366,6 +368,8 @@ void MyTextCtrl::OnChar(wxKeyEvent& event)
|
|||||||
{
|
{
|
||||||
event.Skip();
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyTextCtrl::OnKeyUp(wxKeyEvent& event)
|
void MyTextCtrl::OnKeyUp(wxKeyEvent& event)
|
||||||
|
@@ -85,6 +85,7 @@ static void gtk_frame_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation*
|
|||||||
(int)alloc->width,
|
(int)alloc->width,
|
||||||
(int)alloc->height );
|
(int)alloc->height );
|
||||||
*/
|
*/
|
||||||
|
|
||||||
win->m_width = alloc->width;
|
win->m_width = alloc->width;
|
||||||
win->m_height = alloc->height;
|
win->m_height = alloc->height;
|
||||||
win->UpdateSize();
|
win->UpdateSize();
|
||||||
@@ -667,7 +668,7 @@ void wxFrame::DoSetClientSize( int width, int height )
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
wxWindow::DoSetClientSize( width + m_miniEdge*2, height + m_miniEdge*2 + m_miniTitle );
|
DoSetSize( -1, -1, width + m_miniEdge*2, height + m_miniEdge*2 + m_miniTitle, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height )
|
void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height )
|
||||||
@@ -685,7 +686,7 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height
|
|||||||
|
|
||||||
m_width = width;
|
m_width = width;
|
||||||
m_height = height;
|
m_height = height;
|
||||||
|
|
||||||
/* space occupied by m_frameToolBar and m_frameMenuBar */
|
/* space occupied by m_frameToolBar and m_frameMenuBar */
|
||||||
int client_area_y_offset = 0;
|
int client_area_y_offset = 0;
|
||||||
|
|
||||||
@@ -979,16 +980,13 @@ void wxFrame::SetToolBar(wxToolBar *toolbar)
|
|||||||
if (m_frameToolBar)
|
if (m_frameToolBar)
|
||||||
{
|
{
|
||||||
/* insert into toolbar area if not already there */
|
/* insert into toolbar area if not already there */
|
||||||
if (m_frameToolBar->m_widget->parent != m_mainWidget)
|
if ((m_frameToolBar->m_widget->parent) &&
|
||||||
|
(m_frameToolBar->m_widget->parent != m_mainWidget))
|
||||||
{
|
{
|
||||||
gtk_widget_ref( m_frameToolBar->m_widget );
|
GetChildren().DeleteObject( m_frameToolBar );
|
||||||
gtk_widget_unparent( m_frameToolBar->m_widget );
|
|
||||||
|
gtk_widget_reparent( m_frameToolBar->m_widget, m_mainWidget );
|
||||||
m_insertInClientArea = TRUE;
|
UpdateSize();
|
||||||
wxInsertChildInFrame( this, m_frameToolBar );
|
|
||||||
m_insertInClientArea = FALSE;
|
|
||||||
|
|
||||||
gtk_widget_unref( m_frameToolBar->m_widget );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -280,6 +280,8 @@ bool wxMiniFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title
|
|||||||
long style, const wxString &name )
|
long style, const wxString &name )
|
||||||
{
|
{
|
||||||
style = style | wxSIMPLE_BORDER;
|
style = style | wxSIMPLE_BORDER;
|
||||||
|
style = style | wxCAPTION;
|
||||||
|
style = style | wxSYSTEM_MENU;
|
||||||
|
|
||||||
if ((style & wxCAPTION) || (style & wxTINY_CAPTION_HORIZ) || (style & wxTINY_CAPTION_VERT))
|
if ((style & wxCAPTION) || (style & wxTINY_CAPTION_HORIZ) || (style & wxTINY_CAPTION_VERT))
|
||||||
m_miniTitle = 13;
|
m_miniTitle = 13;
|
||||||
|
@@ -71,11 +71,9 @@ bool wxStaticText::Create(wxWindow *parent,
|
|||||||
justify = GTK_JUSTIFY_LEFT;
|
justify = GTK_JUSTIFY_LEFT;
|
||||||
gtk_label_set_justify(GTK_LABEL(m_widget), justify);
|
gtk_label_set_justify(GTK_LABEL(m_widget), justify);
|
||||||
|
|
||||||
//#if GTK_MINOR_VERSION == 2
|
|
||||||
// GTK_JUSTIFY_LEFT is 0, RIGHT 1 and CENTER 2
|
// GTK_JUSTIFY_LEFT is 0, RIGHT 1 and CENTER 2
|
||||||
static const float labelAlignments[] = { 0.0, 1.0, 0.5 };
|
static const float labelAlignments[] = { 0.0, 1.0, 0.5 };
|
||||||
gtk_misc_set_alignment(GTK_MISC(m_widget), labelAlignments[justify], 0.0);
|
gtk_misc_set_alignment(GTK_MISC(m_widget), labelAlignments[justify], 0.0);
|
||||||
//#endif // GTK 1.2.x
|
|
||||||
|
|
||||||
GtkRequisition req;
|
GtkRequisition req;
|
||||||
(* GTK_WIDGET_CLASS( GTK_OBJECT(m_widget)->klass )->size_request ) (m_widget, &req );
|
(* GTK_WIDGET_CLASS( GTK_OBJECT(m_widget)->klass )->size_request ) (m_widget, &req );
|
||||||
|
@@ -309,6 +309,11 @@ wxToolBarTool *wxToolBar::AddTool( int toolIndex, const wxBitmap& bitmap,
|
|||||||
|
|
||||||
tool->m_item = item;
|
tool->m_item = item;
|
||||||
|
|
||||||
|
GtkRequisition req;
|
||||||
|
(* GTK_WIDGET_CLASS( GTK_OBJECT(m_widget)->klass )->size_request ) (m_widget, &req );
|
||||||
|
m_width = req.width;
|
||||||
|
m_height = req.height;
|
||||||
|
|
||||||
gtk_signal_connect( GTK_OBJECT(tool->m_item),
|
gtk_signal_connect( GTK_OBJECT(tool->m_item),
|
||||||
"enter_notify_event",
|
"enter_notify_event",
|
||||||
GTK_SIGNAL_FUNC(gtk_toolbar_enter_callback),
|
GTK_SIGNAL_FUNC(gtk_toolbar_enter_callback),
|
||||||
|
@@ -132,7 +132,7 @@
|
|||||||
clicking on a scrollbar belonging to scrolled window will inevitably move
|
clicking on a scrollbar belonging to scrolled window will inevitably move
|
||||||
the window. In wxWindows, the scrollbar will only emit an event, send this
|
the window. In wxWindows, the scrollbar will only emit an event, send this
|
||||||
to (normally) a wxScrolledWindow and that class will call ScrollWindow()
|
to (normally) a wxScrolledWindow and that class will call ScrollWindow()
|
||||||
which actually move the window and its subchildren. Note that GtkMyFixed
|
which actually moves the window and its subchildren. Note that GtkMyFixed
|
||||||
memorizes how much it has been scrolled but that wxWindows forgets this
|
memorizes how much it has been scrolled but that wxWindows forgets this
|
||||||
so that the two coordinates systems have to be kept in synch. This is done
|
so that the two coordinates systems have to be kept in synch. This is done
|
||||||
in various places using the myfixed->xoffset and myfixed->yoffset values.
|
in various places using the myfixed->xoffset and myfixed->yoffset values.
|
||||||
@@ -148,7 +148,7 @@
|
|||||||
and then iterates down the respective size events to all window. This has
|
and then iterates down the respective size events to all window. This has
|
||||||
the disadvantage, that windows might get size events before the GTK widget
|
the disadvantage, that windows might get size events before the GTK widget
|
||||||
actually has the reported size. This doesn't normally pose any problem, but
|
actually has the reported size. This doesn't normally pose any problem, but
|
||||||
the OpenGl drawing routines rely in correct behaviour. Therefore, I have
|
the OpenGl drawing routines rely on correct behaviour. Therefore, I have
|
||||||
added the m_nativeSizeEvents flag, which is true only for the OpenGL canvas,
|
added the m_nativeSizeEvents flag, which is true only for the OpenGL canvas,
|
||||||
i.e. the wxGLCanvas will emit a size event, when (and not before) the X11
|
i.e. the wxGLCanvas will emit a size event, when (and not before) the X11
|
||||||
window that is used for OpenGl output really has that size (as reported by
|
window that is used for OpenGl output really has that size (as reported by
|
||||||
@@ -823,13 +823,12 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e
|
|||||||
GdkModifierType state;
|
GdkModifierType state;
|
||||||
if (gdk_event->window) gdk_window_get_pointer(gdk_event->window, &x, &y, &state);
|
if (gdk_event->window) gdk_window_get_pointer(gdk_event->window, &x, &y, &state);
|
||||||
|
|
||||||
|
bool ret = FALSE;
|
||||||
|
|
||||||
long key_code = map_to_unmodified_wx_keysym( gdk_event->keyval );
|
long key_code = map_to_unmodified_wx_keysym( gdk_event->keyval );
|
||||||
|
|
||||||
/* sending unknown key events doesn't really make sense */
|
/* sending unknown key events doesn't really make sense */
|
||||||
if (key_code == 0) return FALSE;
|
if (key_code == 0) return FALSE;
|
||||||
|
|
||||||
bool ret = FALSE;
|
|
||||||
|
|
||||||
wxKeyEvent event( wxEVT_KEY_DOWN );
|
wxKeyEvent event( wxEVT_KEY_DOWN );
|
||||||
event.SetTimestamp( gdk_event->time );
|
event.SetTimestamp( gdk_event->time );
|
||||||
event.m_shiftDown = (gdk_event->state & GDK_SHIFT_MASK);
|
event.m_shiftDown = (gdk_event->state & GDK_SHIFT_MASK);
|
||||||
@@ -843,8 +842,6 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e
|
|||||||
event.SetEventObject( win );
|
event.SetEventObject( win );
|
||||||
ret = win->GetEventHandler()->ProcessEvent( event );
|
ret = win->GetEventHandler()->ProcessEvent( event );
|
||||||
|
|
||||||
key_code = map_to_wx_keysym( gdk_event->keyval );
|
|
||||||
|
|
||||||
#if wxUSE_ACCEL
|
#if wxUSE_ACCEL
|
||||||
if (!ret)
|
if (!ret)
|
||||||
{
|
{
|
||||||
@@ -862,10 +859,14 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // wxUSE_ACCEL
|
#endif // wxUSE_ACCEL
|
||||||
|
|
||||||
/* wxMSW doesn't send char events with Alt pressed */
|
/* wxMSW doesn't send char events with Alt pressed */
|
||||||
/* Only send wxEVT_CHAR event if not processed yet. Thus, ALT-x
|
/* Only send wxEVT_CHAR event if not processed yet. Thus, ALT-x
|
||||||
will only be sent if it is not a menu accelerator. */
|
will only be sent if it is not in an accelerator table. */
|
||||||
if ((key_code != 0) && ! ret )
|
key_code = map_to_wx_keysym( gdk_event->keyval );
|
||||||
|
|
||||||
|
if ( (!ret) &&
|
||||||
|
(key_code != 0))
|
||||||
{
|
{
|
||||||
wxKeyEvent event2( wxEVT_CHAR );
|
wxKeyEvent event2( wxEVT_CHAR );
|
||||||
event2.SetTimestamp( gdk_event->time );
|
event2.SetTimestamp( gdk_event->time );
|
||||||
@@ -878,7 +879,7 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e
|
|||||||
event2.m_x = x;
|
event2.m_x = x;
|
||||||
event2.m_y = y;
|
event2.m_y = y;
|
||||||
event2.SetEventObject( win );
|
event2.SetEventObject( win );
|
||||||
ret = (ret || win->GetEventHandler()->ProcessEvent( event2 ));
|
ret = win->GetEventHandler()->ProcessEvent( event2 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* win is a control: tab can be propagated up */
|
/* win is a control: tab can be propagated up */
|
||||||
@@ -906,6 +907,7 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e
|
|||||||
|
|
||||||
#if (GTK_MINOR_VERSION > 0)
|
#if (GTK_MINOR_VERSION > 0)
|
||||||
/* pressing F10 will activate the menu bar of the top frame */
|
/* pressing F10 will activate the menu bar of the top frame */
|
||||||
|
/*
|
||||||
if ( (!ret) &&
|
if ( (!ret) &&
|
||||||
(gdk_event->keyval == GDK_F10) )
|
(gdk_event->keyval == GDK_F10) )
|
||||||
{
|
{
|
||||||
@@ -921,10 +923,9 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e
|
|||||||
wxNode *node = menubar->GetMenus().First();
|
wxNode *node = menubar->GetMenus().First();
|
||||||
if (node)
|
if (node)
|
||||||
{
|
{
|
||||||
// doesn't work correctly
|
wxMenu *firstMenu = (wxMenu*) node->Data();
|
||||||
// wxMenu *firstMenu = (wxMenu*) node->Data();
|
gtk_menu_item_select( GTK_MENU_ITEM(firstMenu->m_owner) );
|
||||||
// gtk_menu_item_select( GTK_MENU_ITEM(firstMenu->m_owner) );
|
ret = TRUE;
|
||||||
// ret = TRUE;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -932,6 +933,7 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e
|
|||||||
ancestor = ancestor->GetParent();
|
ancestor = ancestor->GetParent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -2255,7 +2257,7 @@ void wxWindow::OnInternalIdle()
|
|||||||
|
|
||||||
if (cursor.Ok())
|
if (cursor.Ok())
|
||||||
{
|
{
|
||||||
/* I now set the cursor the anew in every OnInternalIdle call
|
/* I now set the cursor anew in every OnInternalIdle call
|
||||||
as setting the cursor in a parent window also effects the
|
as setting the cursor in a parent window also effects the
|
||||||
windows above so that checking for the current cursor is
|
windows above so that checking for the current cursor is
|
||||||
not possible. */
|
not possible. */
|
||||||
@@ -2640,7 +2642,7 @@ bool wxWindow::Reparent( wxWindowBase *newParentBase )
|
|||||||
|
|
||||||
if (oldParent)
|
if (oldParent)
|
||||||
{
|
{
|
||||||
gtk_container_remove( GTK_CONTAINER(oldParent->m_wxwindow), m_widget );
|
gtk_container_remove( GTK_CONTAINER(m_widget->parent), m_widget );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxASSERT( GTK_IS_WIDGET(m_widget) );
|
wxASSERT( GTK_IS_WIDGET(m_widget) );
|
||||||
|
@@ -85,6 +85,7 @@ static void gtk_frame_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation*
|
|||||||
(int)alloc->width,
|
(int)alloc->width,
|
||||||
(int)alloc->height );
|
(int)alloc->height );
|
||||||
*/
|
*/
|
||||||
|
|
||||||
win->m_width = alloc->width;
|
win->m_width = alloc->width;
|
||||||
win->m_height = alloc->height;
|
win->m_height = alloc->height;
|
||||||
win->UpdateSize();
|
win->UpdateSize();
|
||||||
@@ -667,7 +668,7 @@ void wxFrame::DoSetClientSize( int width, int height )
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
wxWindow::DoSetClientSize( width + m_miniEdge*2, height + m_miniEdge*2 + m_miniTitle );
|
DoSetSize( -1, -1, width + m_miniEdge*2, height + m_miniEdge*2 + m_miniTitle, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height )
|
void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height )
|
||||||
@@ -685,7 +686,7 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height
|
|||||||
|
|
||||||
m_width = width;
|
m_width = width;
|
||||||
m_height = height;
|
m_height = height;
|
||||||
|
|
||||||
/* space occupied by m_frameToolBar and m_frameMenuBar */
|
/* space occupied by m_frameToolBar and m_frameMenuBar */
|
||||||
int client_area_y_offset = 0;
|
int client_area_y_offset = 0;
|
||||||
|
|
||||||
@@ -979,16 +980,13 @@ void wxFrame::SetToolBar(wxToolBar *toolbar)
|
|||||||
if (m_frameToolBar)
|
if (m_frameToolBar)
|
||||||
{
|
{
|
||||||
/* insert into toolbar area if not already there */
|
/* insert into toolbar area if not already there */
|
||||||
if (m_frameToolBar->m_widget->parent != m_mainWidget)
|
if ((m_frameToolBar->m_widget->parent) &&
|
||||||
|
(m_frameToolBar->m_widget->parent != m_mainWidget))
|
||||||
{
|
{
|
||||||
gtk_widget_ref( m_frameToolBar->m_widget );
|
GetChildren().DeleteObject( m_frameToolBar );
|
||||||
gtk_widget_unparent( m_frameToolBar->m_widget );
|
|
||||||
|
gtk_widget_reparent( m_frameToolBar->m_widget, m_mainWidget );
|
||||||
m_insertInClientArea = TRUE;
|
UpdateSize();
|
||||||
wxInsertChildInFrame( this, m_frameToolBar );
|
|
||||||
m_insertInClientArea = FALSE;
|
|
||||||
|
|
||||||
gtk_widget_unref( m_frameToolBar->m_widget );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -280,6 +280,8 @@ bool wxMiniFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title
|
|||||||
long style, const wxString &name )
|
long style, const wxString &name )
|
||||||
{
|
{
|
||||||
style = style | wxSIMPLE_BORDER;
|
style = style | wxSIMPLE_BORDER;
|
||||||
|
style = style | wxCAPTION;
|
||||||
|
style = style | wxSYSTEM_MENU;
|
||||||
|
|
||||||
if ((style & wxCAPTION) || (style & wxTINY_CAPTION_HORIZ) || (style & wxTINY_CAPTION_VERT))
|
if ((style & wxCAPTION) || (style & wxTINY_CAPTION_HORIZ) || (style & wxTINY_CAPTION_VERT))
|
||||||
m_miniTitle = 13;
|
m_miniTitle = 13;
|
||||||
|
@@ -71,11 +71,9 @@ bool wxStaticText::Create(wxWindow *parent,
|
|||||||
justify = GTK_JUSTIFY_LEFT;
|
justify = GTK_JUSTIFY_LEFT;
|
||||||
gtk_label_set_justify(GTK_LABEL(m_widget), justify);
|
gtk_label_set_justify(GTK_LABEL(m_widget), justify);
|
||||||
|
|
||||||
//#if GTK_MINOR_VERSION == 2
|
|
||||||
// GTK_JUSTIFY_LEFT is 0, RIGHT 1 and CENTER 2
|
// GTK_JUSTIFY_LEFT is 0, RIGHT 1 and CENTER 2
|
||||||
static const float labelAlignments[] = { 0.0, 1.0, 0.5 };
|
static const float labelAlignments[] = { 0.0, 1.0, 0.5 };
|
||||||
gtk_misc_set_alignment(GTK_MISC(m_widget), labelAlignments[justify], 0.0);
|
gtk_misc_set_alignment(GTK_MISC(m_widget), labelAlignments[justify], 0.0);
|
||||||
//#endif // GTK 1.2.x
|
|
||||||
|
|
||||||
GtkRequisition req;
|
GtkRequisition req;
|
||||||
(* GTK_WIDGET_CLASS( GTK_OBJECT(m_widget)->klass )->size_request ) (m_widget, &req );
|
(* GTK_WIDGET_CLASS( GTK_OBJECT(m_widget)->klass )->size_request ) (m_widget, &req );
|
||||||
|
@@ -309,6 +309,11 @@ wxToolBarTool *wxToolBar::AddTool( int toolIndex, const wxBitmap& bitmap,
|
|||||||
|
|
||||||
tool->m_item = item;
|
tool->m_item = item;
|
||||||
|
|
||||||
|
GtkRequisition req;
|
||||||
|
(* GTK_WIDGET_CLASS( GTK_OBJECT(m_widget)->klass )->size_request ) (m_widget, &req );
|
||||||
|
m_width = req.width;
|
||||||
|
m_height = req.height;
|
||||||
|
|
||||||
gtk_signal_connect( GTK_OBJECT(tool->m_item),
|
gtk_signal_connect( GTK_OBJECT(tool->m_item),
|
||||||
"enter_notify_event",
|
"enter_notify_event",
|
||||||
GTK_SIGNAL_FUNC(gtk_toolbar_enter_callback),
|
GTK_SIGNAL_FUNC(gtk_toolbar_enter_callback),
|
||||||
|
@@ -132,7 +132,7 @@
|
|||||||
clicking on a scrollbar belonging to scrolled window will inevitably move
|
clicking on a scrollbar belonging to scrolled window will inevitably move
|
||||||
the window. In wxWindows, the scrollbar will only emit an event, send this
|
the window. In wxWindows, the scrollbar will only emit an event, send this
|
||||||
to (normally) a wxScrolledWindow and that class will call ScrollWindow()
|
to (normally) a wxScrolledWindow and that class will call ScrollWindow()
|
||||||
which actually move the window and its subchildren. Note that GtkMyFixed
|
which actually moves the window and its subchildren. Note that GtkMyFixed
|
||||||
memorizes how much it has been scrolled but that wxWindows forgets this
|
memorizes how much it has been scrolled but that wxWindows forgets this
|
||||||
so that the two coordinates systems have to be kept in synch. This is done
|
so that the two coordinates systems have to be kept in synch. This is done
|
||||||
in various places using the myfixed->xoffset and myfixed->yoffset values.
|
in various places using the myfixed->xoffset and myfixed->yoffset values.
|
||||||
@@ -148,7 +148,7 @@
|
|||||||
and then iterates down the respective size events to all window. This has
|
and then iterates down the respective size events to all window. This has
|
||||||
the disadvantage, that windows might get size events before the GTK widget
|
the disadvantage, that windows might get size events before the GTK widget
|
||||||
actually has the reported size. This doesn't normally pose any problem, but
|
actually has the reported size. This doesn't normally pose any problem, but
|
||||||
the OpenGl drawing routines rely in correct behaviour. Therefore, I have
|
the OpenGl drawing routines rely on correct behaviour. Therefore, I have
|
||||||
added the m_nativeSizeEvents flag, which is true only for the OpenGL canvas,
|
added the m_nativeSizeEvents flag, which is true only for the OpenGL canvas,
|
||||||
i.e. the wxGLCanvas will emit a size event, when (and not before) the X11
|
i.e. the wxGLCanvas will emit a size event, when (and not before) the X11
|
||||||
window that is used for OpenGl output really has that size (as reported by
|
window that is used for OpenGl output really has that size (as reported by
|
||||||
@@ -823,13 +823,12 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e
|
|||||||
GdkModifierType state;
|
GdkModifierType state;
|
||||||
if (gdk_event->window) gdk_window_get_pointer(gdk_event->window, &x, &y, &state);
|
if (gdk_event->window) gdk_window_get_pointer(gdk_event->window, &x, &y, &state);
|
||||||
|
|
||||||
|
bool ret = FALSE;
|
||||||
|
|
||||||
long key_code = map_to_unmodified_wx_keysym( gdk_event->keyval );
|
long key_code = map_to_unmodified_wx_keysym( gdk_event->keyval );
|
||||||
|
|
||||||
/* sending unknown key events doesn't really make sense */
|
/* sending unknown key events doesn't really make sense */
|
||||||
if (key_code == 0) return FALSE;
|
if (key_code == 0) return FALSE;
|
||||||
|
|
||||||
bool ret = FALSE;
|
|
||||||
|
|
||||||
wxKeyEvent event( wxEVT_KEY_DOWN );
|
wxKeyEvent event( wxEVT_KEY_DOWN );
|
||||||
event.SetTimestamp( gdk_event->time );
|
event.SetTimestamp( gdk_event->time );
|
||||||
event.m_shiftDown = (gdk_event->state & GDK_SHIFT_MASK);
|
event.m_shiftDown = (gdk_event->state & GDK_SHIFT_MASK);
|
||||||
@@ -843,8 +842,6 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e
|
|||||||
event.SetEventObject( win );
|
event.SetEventObject( win );
|
||||||
ret = win->GetEventHandler()->ProcessEvent( event );
|
ret = win->GetEventHandler()->ProcessEvent( event );
|
||||||
|
|
||||||
key_code = map_to_wx_keysym( gdk_event->keyval );
|
|
||||||
|
|
||||||
#if wxUSE_ACCEL
|
#if wxUSE_ACCEL
|
||||||
if (!ret)
|
if (!ret)
|
||||||
{
|
{
|
||||||
@@ -862,10 +859,14 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // wxUSE_ACCEL
|
#endif // wxUSE_ACCEL
|
||||||
|
|
||||||
/* wxMSW doesn't send char events with Alt pressed */
|
/* wxMSW doesn't send char events with Alt pressed */
|
||||||
/* Only send wxEVT_CHAR event if not processed yet. Thus, ALT-x
|
/* Only send wxEVT_CHAR event if not processed yet. Thus, ALT-x
|
||||||
will only be sent if it is not a menu accelerator. */
|
will only be sent if it is not in an accelerator table. */
|
||||||
if ((key_code != 0) && ! ret )
|
key_code = map_to_wx_keysym( gdk_event->keyval );
|
||||||
|
|
||||||
|
if ( (!ret) &&
|
||||||
|
(key_code != 0))
|
||||||
{
|
{
|
||||||
wxKeyEvent event2( wxEVT_CHAR );
|
wxKeyEvent event2( wxEVT_CHAR );
|
||||||
event2.SetTimestamp( gdk_event->time );
|
event2.SetTimestamp( gdk_event->time );
|
||||||
@@ -878,7 +879,7 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e
|
|||||||
event2.m_x = x;
|
event2.m_x = x;
|
||||||
event2.m_y = y;
|
event2.m_y = y;
|
||||||
event2.SetEventObject( win );
|
event2.SetEventObject( win );
|
||||||
ret = (ret || win->GetEventHandler()->ProcessEvent( event2 ));
|
ret = win->GetEventHandler()->ProcessEvent( event2 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* win is a control: tab can be propagated up */
|
/* win is a control: tab can be propagated up */
|
||||||
@@ -906,6 +907,7 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e
|
|||||||
|
|
||||||
#if (GTK_MINOR_VERSION > 0)
|
#if (GTK_MINOR_VERSION > 0)
|
||||||
/* pressing F10 will activate the menu bar of the top frame */
|
/* pressing F10 will activate the menu bar of the top frame */
|
||||||
|
/*
|
||||||
if ( (!ret) &&
|
if ( (!ret) &&
|
||||||
(gdk_event->keyval == GDK_F10) )
|
(gdk_event->keyval == GDK_F10) )
|
||||||
{
|
{
|
||||||
@@ -921,10 +923,9 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e
|
|||||||
wxNode *node = menubar->GetMenus().First();
|
wxNode *node = menubar->GetMenus().First();
|
||||||
if (node)
|
if (node)
|
||||||
{
|
{
|
||||||
// doesn't work correctly
|
wxMenu *firstMenu = (wxMenu*) node->Data();
|
||||||
// wxMenu *firstMenu = (wxMenu*) node->Data();
|
gtk_menu_item_select( GTK_MENU_ITEM(firstMenu->m_owner) );
|
||||||
// gtk_menu_item_select( GTK_MENU_ITEM(firstMenu->m_owner) );
|
ret = TRUE;
|
||||||
// ret = TRUE;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -932,6 +933,7 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e
|
|||||||
ancestor = ancestor->GetParent();
|
ancestor = ancestor->GetParent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -2255,7 +2257,7 @@ void wxWindow::OnInternalIdle()
|
|||||||
|
|
||||||
if (cursor.Ok())
|
if (cursor.Ok())
|
||||||
{
|
{
|
||||||
/* I now set the cursor the anew in every OnInternalIdle call
|
/* I now set the cursor anew in every OnInternalIdle call
|
||||||
as setting the cursor in a parent window also effects the
|
as setting the cursor in a parent window also effects the
|
||||||
windows above so that checking for the current cursor is
|
windows above so that checking for the current cursor is
|
||||||
not possible. */
|
not possible. */
|
||||||
@@ -2640,7 +2642,7 @@ bool wxWindow::Reparent( wxWindowBase *newParentBase )
|
|||||||
|
|
||||||
if (oldParent)
|
if (oldParent)
|
||||||
{
|
{
|
||||||
gtk_container_remove( GTK_CONTAINER(oldParent->m_wxwindow), m_widget );
|
gtk_container_remove( GTK_CONTAINER(m_widget->parent), m_widget );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxASSERT( GTK_IS_WIDGET(m_widget) );
|
wxASSERT( GTK_IS_WIDGET(m_widget) );
|
||||||
|
@@ -104,8 +104,9 @@ class wxFloatBar(wxToolBar):
|
|||||||
self.floatframe.SetToolBar(self)
|
self.floatframe.SetToolBar(self)
|
||||||
self.oldcolor = self.GetBackgroundColour()
|
self.oldcolor = self.GetBackgroundColour()
|
||||||
barsize = self.GetSizeTuple()
|
barsize = self.GetSizeTuple()
|
||||||
self.floatframe.SetSize(wxSize(barsize[0], barsize[1] + self.titleheight))
|
# self.floatframe.SetSize(wxSize(barsize[0], barsize[1] + self.titleheight))
|
||||||
self.floatframe.SetClientSize(wxSize(barsize[0], barsize[1]))
|
# self.floatframe.SetClientSize(wxSize(barsize[0], barsize[1]))
|
||||||
|
self.floatframe.SetClientSize(wxSize(50,200))
|
||||||
newpos = self.parentframe.GetPosition()
|
newpos = self.parentframe.GetPosition()
|
||||||
newpos.y = newpos.y + self.titleheight
|
newpos.y = newpos.y + self.titleheight
|
||||||
self.floatframe.SetPosition(newpos)
|
self.floatframe.SetPosition(newpos)
|
||||||
|
Reference in New Issue
Block a user