Had to change the time point, when widgets are
created (no longer forced). This seems to break wxNotebook... git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2276 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -474,6 +474,7 @@ m_text(NULL), m_notebook(NULL)
|
|||||||
|
|
||||||
panel = new wxPanel(m_notebook);
|
panel = new wxPanel(m_notebook);
|
||||||
m_choice = new wxChoice( panel, ID_CHOICE, wxPoint(10,10), wxSize(120,-1), 5, choices );
|
m_choice = new wxChoice( panel, ID_CHOICE, wxPoint(10,10), wxSize(120,-1), 5, choices );
|
||||||
|
m_choice->SetBackgroundColour( "red" );
|
||||||
(void)new wxButton( panel, ID_CHOICE_SEL_NUM, "Select #2", wxPoint(180,30), wxSize(140,30) );
|
(void)new wxButton( panel, ID_CHOICE_SEL_NUM, "Select #2", wxPoint(180,30), wxSize(140,30) );
|
||||||
(void)new wxButton( panel, ID_CHOICE_SEL_STR, "Select 'This'", wxPoint(340,30), wxSize(140,30) );
|
(void)new wxButton( panel, ID_CHOICE_SEL_STR, "Select 'This'", wxPoint(340,30), wxSize(140,30) );
|
||||||
(void)new wxButton( panel, ID_CHOICE_CLEAR, "Clear", wxPoint(180,80), wxSize(140,30) );
|
(void)new wxButton( panel, ID_CHOICE_CLEAR, "Clear", wxPoint(180,80), wxSize(140,30) );
|
||||||
|
@@ -121,9 +121,6 @@ bool wxCheckBox::Create(wxWindow *parent,
|
|||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
gtk_widget_realize( m_widgetLabel );
|
|
||||||
gtk_widget_realize( m_widgetCheckbox );
|
|
||||||
|
|
||||||
SetBackgroundColour( parent->GetBackgroundColour() );
|
SetBackgroundColour( parent->GetBackgroundColour() );
|
||||||
SetForegroundColour( parent->GetForegroundColour() );
|
SetForegroundColour( parent->GetForegroundColour() );
|
||||||
SetFont( parent->GetFont() );
|
SetFont( parent->GetFont() );
|
||||||
|
@@ -85,9 +85,6 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id,
|
|||||||
GtkWidget *item = gtk_menu_item_new_with_label( choices[i].mbc_str() );
|
GtkWidget *item = gtk_menu_item_new_with_label( choices[i].mbc_str() );
|
||||||
gtk_menu_append( GTK_MENU(menu), item );
|
gtk_menu_append( GTK_MENU(menu), item );
|
||||||
|
|
||||||
gtk_widget_realize( item );
|
|
||||||
gtk_widget_realize( GTK_BIN(item)->child );
|
|
||||||
|
|
||||||
gtk_widget_show( item );
|
gtk_widget_show( item );
|
||||||
|
|
||||||
gtk_signal_connect( GTK_OBJECT( item ), "activate",
|
gtk_signal_connect( GTK_OBJECT( item ), "activate",
|
||||||
@@ -124,10 +121,13 @@ void wxChoice::AppendCommon( const wxString &item )
|
|||||||
|
|
||||||
gtk_menu_append( GTK_MENU(menu), menu_item );
|
gtk_menu_append( GTK_MENU(menu), menu_item );
|
||||||
|
|
||||||
gtk_widget_realize( menu_item );
|
if (GTK_WIDGET_REALIZED(m_widget))
|
||||||
gtk_widget_realize( GTK_BIN(menu_item)->child );
|
{
|
||||||
|
gtk_widget_realize( menu_item );
|
||||||
|
gtk_widget_realize( GTK_BIN(menu_item)->child );
|
||||||
|
|
||||||
if (m_widgetStyle) ApplyWidgetStyle();
|
if (m_widgetStyle) ApplyWidgetStyle();
|
||||||
|
}
|
||||||
|
|
||||||
gtk_signal_connect( GTK_OBJECT( menu_item ), "activate",
|
gtk_signal_connect( GTK_OBJECT( menu_item ), "activate",
|
||||||
GTK_SIGNAL_FUNC(gtk_choice_clicked_callback), (gpointer*)this );
|
GTK_SIGNAL_FUNC(gtk_choice_clicked_callback), (gpointer*)this );
|
||||||
|
@@ -113,9 +113,6 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
|
|||||||
|
|
||||||
gtk_container_add( GTK_CONTAINER(list), list_item );
|
gtk_container_add( GTK_CONTAINER(list), list_item );
|
||||||
|
|
||||||
gtk_widget_realize( list_item );
|
|
||||||
gtk_widget_realize( GTK_BIN(list_item)->child );
|
|
||||||
|
|
||||||
gtk_widget_show( list_item );
|
gtk_widget_show( list_item );
|
||||||
|
|
||||||
gtk_signal_connect( GTK_OBJECT(list_item), "select",
|
gtk_signal_connect( GTK_OBJECT(list_item), "select",
|
||||||
@@ -132,10 +129,6 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
|
|||||||
|
|
||||||
if (!value.IsNull()) SetValue( value );
|
if (!value.IsNull()) SetValue( value );
|
||||||
|
|
||||||
gtk_widget_realize( GTK_COMBO(m_widget)->list );
|
|
||||||
gtk_widget_realize( GTK_COMBO(m_widget)->entry );
|
|
||||||
gtk_widget_realize( GTK_COMBO(m_widget)->button );
|
|
||||||
|
|
||||||
if (style & wxCB_READONLY)
|
if (style & wxCB_READONLY)
|
||||||
gtk_entry_set_editable( GTK_ENTRY( GTK_COMBO(m_widget)->entry ), FALSE );
|
gtk_entry_set_editable( GTK_ENTRY( GTK_COMBO(m_widget)->entry ), FALSE );
|
||||||
|
|
||||||
@@ -176,7 +169,13 @@ void wxComboBox::AppendCommon( const wxString &item )
|
|||||||
|
|
||||||
gtk_container_add( GTK_CONTAINER(list), list_item );
|
gtk_container_add( GTK_CONTAINER(list), list_item );
|
||||||
|
|
||||||
if (m_widgetStyle) ApplyWidgetStyle();
|
if (GTK_WIDGET_REALIZED(m_widget))
|
||||||
|
{
|
||||||
|
gtk_widget_realize( list_item );
|
||||||
|
gtk_widget_realize( GTK_BIN(list_item)->child );
|
||||||
|
|
||||||
|
if (m_widgetStyle) ApplyWidgetStyle();
|
||||||
|
}
|
||||||
|
|
||||||
gtk_widget_show( list_item );
|
gtk_widget_show( list_item );
|
||||||
}
|
}
|
||||||
|
@@ -825,8 +825,6 @@ void wxWindowDC::GetTextExtent( const wxString &string, long *width, long *heigh
|
|||||||
long *descent, long *externalLeading,
|
long *descent, long *externalLeading,
|
||||||
wxFont *theFont, bool WXUNUSED(use16) )
|
wxFont *theFont, bool WXUNUSED(use16) )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
|
||||||
|
|
||||||
wxFont fontToUse = m_font;
|
wxFont fontToUse = m_font;
|
||||||
if (theFont) fontToUse = *theFont;
|
if (theFont) fontToUse = *theFont;
|
||||||
|
|
||||||
@@ -839,16 +837,12 @@ void wxWindowDC::GetTextExtent( const wxString &string, long *width, long *heigh
|
|||||||
|
|
||||||
long wxWindowDC::GetCharWidth()
|
long wxWindowDC::GetCharWidth()
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( Ok(), 0, _T("invalid window dc") );
|
|
||||||
|
|
||||||
GdkFont *font = m_font.GetInternalFont( m_scaleY );
|
GdkFont *font = m_font.GetInternalFont( m_scaleY );
|
||||||
return long(gdk_string_width( font, "H" ) / m_scaleX);
|
return long(gdk_string_width( font, "H" ) / m_scaleX);
|
||||||
}
|
}
|
||||||
|
|
||||||
long wxWindowDC::GetCharHeight()
|
long wxWindowDC::GetCharHeight()
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( Ok(), 0, _T("invalid window dc") );
|
|
||||||
|
|
||||||
GdkFont *font = m_font.GetInternalFont( m_scaleY );
|
GdkFont *font = m_font.GetInternalFont( m_scaleY );
|
||||||
return long((font->ascent + font->descent) / m_scaleY);
|
return long((font->ascent + font->descent) / m_scaleY);
|
||||||
}
|
}
|
||||||
@@ -883,8 +877,6 @@ void wxWindowDC::Clear()
|
|||||||
|
|
||||||
void wxWindowDC::SetFont( const wxFont &font )
|
void wxWindowDC::SetFont( const wxFont &font )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
|
||||||
|
|
||||||
m_font = font;
|
m_font = font;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -82,6 +82,48 @@ static gint gtk_dialog_configure_callback( GtkWidget *WXUNUSED(widget), GdkEvent
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// "realize" from m_widget
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/* we cannot MWM hints before the widget has been realized,
|
||||||
|
so we do this directly after realization */
|
||||||
|
|
||||||
|
static gint
|
||||||
|
gtk_dialog_realized_callback( GtkWidget *widget, wxWindow *win )
|
||||||
|
{
|
||||||
|
/* all this is for Motif Window Manager "hints" and is supposed to be
|
||||||
|
recognized by other WM as well. not tested. */
|
||||||
|
long decor = (long) GDK_DECOR_ALL;
|
||||||
|
long func = (long) GDK_FUNC_ALL;
|
||||||
|
|
||||||
|
if ((win->m_windowStyle & wxCAPTION) == 0)
|
||||||
|
decor |= GDK_DECOR_TITLE;
|
||||||
|
/* if ((win->m_windowStyle & wxMINIMIZE) == 0)
|
||||||
|
func |= GDK_FUNC_MINIMIZE;
|
||||||
|
if ((win->m_windowStyle & wxMAXIMIZE) == 0)
|
||||||
|
func |= GDK_FUNC_MAXIMIZE; */
|
||||||
|
if ((win->m_windowStyle & wxSYSTEM_MENU) == 0)
|
||||||
|
decor |= GDK_DECOR_MENU;
|
||||||
|
if ((win->m_windowStyle & wxMINIMIZE_BOX) == 0)
|
||||||
|
decor |= GDK_DECOR_MINIMIZE;
|
||||||
|
if ((win->m_windowStyle & wxMAXIMIZE_BOX) == 0)
|
||||||
|
decor |= GDK_DECOR_MAXIMIZE;
|
||||||
|
if ((win->m_windowStyle & wxRESIZE_BORDER) == 0)
|
||||||
|
func |= GDK_FUNC_RESIZE;
|
||||||
|
|
||||||
|
gdk_window_set_decorations( win->m_widget->window, (GdkWMDecoration)decor);
|
||||||
|
gdk_window_set_functions( win->m_widget->window, (GdkWMFunction)func);
|
||||||
|
|
||||||
|
/* GTK's shrinking/growing policy */
|
||||||
|
if ((win->m_windowStyle & wxRESIZE_BORDER) == 0)
|
||||||
|
gtk_window_set_policy(GTK_WINDOW(win->m_widget), 0, 0, 1);
|
||||||
|
else
|
||||||
|
gtk_window_set_policy(GTK_WINDOW(win->m_widget), 1, 1, 1);
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// wxDialog
|
// wxDialog
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -143,37 +185,12 @@ bool wxDialog::Create( wxWindow *parent,
|
|||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
gtk_widget_realize( m_widget );
|
/* we cannot set MWM hints before the widget has
|
||||||
|
been realized, so we do this directly after realization */
|
||||||
/* all this is for Motif Window Manager "hints" and is supposed to be
|
gtk_signal_connect( GTK_OBJECT(m_widget), "realize",
|
||||||
recognized by other WM as well. not tested. */
|
GTK_SIGNAL_FUNC(gtk_dialog_realized_callback), (gpointer) this );
|
||||||
long decor = (long) GDK_DECOR_ALL;
|
|
||||||
long func = (long) GDK_FUNC_ALL;
|
|
||||||
|
|
||||||
if ((m_windowStyle & wxCAPTION) == 0)
|
/* the user resized the frame by dragging etc. */
|
||||||
decor |= GDK_DECOR_TITLE;
|
|
||||||
/* if ((m_windowStyle & wxMINIMIZE) == 0)
|
|
||||||
func |= GDK_FUNC_MINIMIZE;
|
|
||||||
if ((m_windowStyle & wxMAXIMIZE) == 0)
|
|
||||||
func |= GDK_FUNC_MAXIMIZE; */
|
|
||||||
if ((m_windowStyle & wxSYSTEM_MENU) == 0)
|
|
||||||
decor |= GDK_DECOR_MENU;
|
|
||||||
if ((m_windowStyle & wxMINIMIZE_BOX) == 0)
|
|
||||||
decor |= GDK_DECOR_MINIMIZE;
|
|
||||||
if ((m_windowStyle & wxMAXIMIZE_BOX) == 0)
|
|
||||||
decor |= GDK_DECOR_MAXIMIZE;
|
|
||||||
if ((m_windowStyle & wxRESIZE_BORDER) == 0)
|
|
||||||
func |= GDK_FUNC_RESIZE;
|
|
||||||
|
|
||||||
gdk_window_set_decorations(m_widget->window, (GdkWMDecoration)decor);
|
|
||||||
gdk_window_set_functions(m_widget->window, (GdkWMFunction)func);
|
|
||||||
|
|
||||||
/* GTK's shrinking/growing policy */
|
|
||||||
if ((m_windowStyle & wxRESIZE_BORDER) == 0)
|
|
||||||
gtk_window_set_policy(GTK_WINDOW(m_widget), 0, 0, 1);
|
|
||||||
else
|
|
||||||
gtk_window_set_policy(GTK_WINDOW(m_widget), 1, 1, 1);
|
|
||||||
|
|
||||||
gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
|
gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
|
||||||
GTK_SIGNAL_FUNC(gtk_dialog_size_callback), (gpointer)this );
|
GTK_SIGNAL_FUNC(gtk_dialog_size_callback), (gpointer)this );
|
||||||
|
|
||||||
|
@@ -146,6 +146,48 @@ static gint gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventC
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// "realize" from m_widget
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/* we cannot MWM hints before the widget has been realized,
|
||||||
|
so we do this directly after realization */
|
||||||
|
|
||||||
|
static gint
|
||||||
|
gtk_frame_realized_callback( GtkWidget *widget, wxWindow *win )
|
||||||
|
{
|
||||||
|
/* all this is for Motif Window Manager "hints" and is supposed to be
|
||||||
|
recognized by other WM as well. not tested. */
|
||||||
|
long decor = (long) GDK_DECOR_ALL;
|
||||||
|
long func = (long) GDK_FUNC_ALL;
|
||||||
|
|
||||||
|
if ((win->m_windowStyle & wxCAPTION) == 0)
|
||||||
|
decor |= GDK_DECOR_TITLE;
|
||||||
|
/* if ((win->m_windowStyle & wxMINIMIZE) == 0)
|
||||||
|
func |= GDK_FUNC_MINIMIZE;
|
||||||
|
if ((win->m_windowStyle & wxMAXIMIZE) == 0)
|
||||||
|
func |= GDK_FUNC_MAXIMIZE; */
|
||||||
|
if ((win->m_windowStyle & wxSYSTEM_MENU) == 0)
|
||||||
|
decor |= GDK_DECOR_MENU;
|
||||||
|
if ((win->m_windowStyle & wxMINIMIZE_BOX) == 0)
|
||||||
|
decor |= GDK_DECOR_MINIMIZE;
|
||||||
|
if ((win->m_windowStyle & wxMAXIMIZE_BOX) == 0)
|
||||||
|
decor |= GDK_DECOR_MAXIMIZE;
|
||||||
|
if ((win->m_windowStyle & wxRESIZE_BORDER) == 0)
|
||||||
|
func |= GDK_FUNC_RESIZE;
|
||||||
|
|
||||||
|
gdk_window_set_decorations( win->m_widget->window, (GdkWMDecoration)decor);
|
||||||
|
gdk_window_set_functions( win->m_widget->window, (GdkWMFunction)func);
|
||||||
|
|
||||||
|
/* GTK's shrinking/growing policy */
|
||||||
|
if ((win->m_windowStyle & wxRESIZE_BORDER) == 0)
|
||||||
|
gtk_window_set_policy(GTK_WINDOW(win->m_widget), 0, 0, 1);
|
||||||
|
else
|
||||||
|
gtk_window_set_policy(GTK_WINDOW(win->m_widget), 1, 1, 1);
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// InsertChild for wxFrame
|
// InsertChild for wxFrame
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -281,7 +323,6 @@ bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title,
|
|||||||
gtk_widget_show( m_mainWidget );
|
gtk_widget_show( m_mainWidget );
|
||||||
GTK_WIDGET_UNSET_FLAGS( m_mainWidget, GTK_CAN_FOCUS );
|
GTK_WIDGET_UNSET_FLAGS( m_mainWidget, GTK_CAN_FOCUS );
|
||||||
gtk_container_add( GTK_CONTAINER(m_widget), m_mainWidget );
|
gtk_container_add( GTK_CONTAINER(m_widget), m_mainWidget );
|
||||||
gtk_widget_realize( m_mainWidget );
|
|
||||||
|
|
||||||
/* m_wxwindow only represents the client area without toolbar and menubar */
|
/* m_wxwindow only represents the client area without toolbar and menubar */
|
||||||
m_wxwindow = gtk_myfixed_new();
|
m_wxwindow = gtk_myfixed_new();
|
||||||
@@ -293,37 +334,11 @@ bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title,
|
|||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
gtk_widget_realize( m_widget );
|
/* we cannot set MWM hints before the widget has
|
||||||
|
been realized, so we do this directly after realization */
|
||||||
|
gtk_signal_connect( GTK_OBJECT(m_widget), "realize",
|
||||||
|
GTK_SIGNAL_FUNC(gtk_frame_realized_callback), (gpointer) this );
|
||||||
|
|
||||||
/* all this is for Motif Window Manager "hints" and is supposed to be
|
|
||||||
recognized by other WM as well. not tested. */
|
|
||||||
long decor = (long) GDK_DECOR_ALL;
|
|
||||||
long func = (long) GDK_FUNC_ALL;
|
|
||||||
|
|
||||||
if ((m_windowStyle & wxCAPTION) == 0)
|
|
||||||
decor |= GDK_DECOR_TITLE;
|
|
||||||
/* if ((m_windowStyle & wxMINIMIZE) == 0)
|
|
||||||
func |= GDK_FUNC_MINIMIZE;
|
|
||||||
if ((m_windowStyle & wxMAXIMIZE) == 0)
|
|
||||||
func |= GDK_FUNC_MAXIMIZE; */
|
|
||||||
if ((m_windowStyle & wxSYSTEM_MENU) == 0)
|
|
||||||
decor |= GDK_DECOR_MENU;
|
|
||||||
if ((m_windowStyle & wxMINIMIZE_BOX) == 0)
|
|
||||||
decor |= GDK_DECOR_MINIMIZE;
|
|
||||||
if ((m_windowStyle & wxMAXIMIZE_BOX) == 0)
|
|
||||||
decor |= GDK_DECOR_MAXIMIZE;
|
|
||||||
if ((m_windowStyle & wxRESIZE_BORDER) == 0)
|
|
||||||
func |= GDK_FUNC_RESIZE;
|
|
||||||
|
|
||||||
gdk_window_set_decorations(m_widget->window, (GdkWMDecoration)decor);
|
|
||||||
gdk_window_set_functions(m_widget->window, (GdkWMFunction)func);
|
|
||||||
|
|
||||||
/* GTK's shrinking/growing policy */
|
|
||||||
if ((m_windowStyle & wxRESIZE_BORDER) == 0)
|
|
||||||
gtk_window_set_policy(GTK_WINDOW(m_widget), 0, 0, 1);
|
|
||||||
else
|
|
||||||
gtk_window_set_policy(GTK_WINDOW(m_widget), 1, 1, 1);
|
|
||||||
|
|
||||||
/* the user resized the frame by dragging etc. */
|
/* the user resized the frame by dragging etc. */
|
||||||
gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
|
gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
|
||||||
GTK_SIGNAL_FUNC(gtk_frame_size_callback), (gpointer)this );
|
GTK_SIGNAL_FUNC(gtk_frame_size_callback), (gpointer)this );
|
||||||
|
@@ -274,8 +274,6 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
|
|||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
gtk_widget_realize( GTK_WIDGET(m_list) );
|
|
||||||
|
|
||||||
SetBackgroundColour( parent->GetBackgroundColour() );
|
SetBackgroundColour( parent->GetBackgroundColour() );
|
||||||
SetForegroundColour( parent->GetForegroundColour() );
|
SetForegroundColour( parent->GetForegroundColour() );
|
||||||
SetFont( parent->GetFont() );
|
SetFont( parent->GetFont() );
|
||||||
@@ -411,8 +409,6 @@ void wxListBox::AppendCommon( const wxString &item )
|
|||||||
gtk_signal_connect( GTK_OBJECT(list_item), "deselect",
|
gtk_signal_connect( GTK_OBJECT(list_item), "deselect",
|
||||||
GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this );
|
GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this );
|
||||||
|
|
||||||
if (m_widgetStyle) ApplyWidgetStyle();
|
|
||||||
|
|
||||||
gtk_signal_connect( GTK_OBJECT(list_item),
|
gtk_signal_connect( GTK_OBJECT(list_item),
|
||||||
"button_press_event",
|
"button_press_event",
|
||||||
(GtkSignalFunc)gtk_listbox_button_press_callback,
|
(GtkSignalFunc)gtk_listbox_button_press_callback,
|
||||||
@@ -430,15 +426,23 @@ void wxListBox::AppendCommon( const wxString &item )
|
|||||||
|
|
||||||
ConnectWidget( list_item );
|
ConnectWidget( list_item );
|
||||||
|
|
||||||
|
if (GTK_WIDGET_REALIZED(m_widget))
|
||||||
|
{
|
||||||
|
gtk_widget_realize( list_item );
|
||||||
|
gtk_widget_realize( GTK_BIN(list_item)->child );
|
||||||
|
|
||||||
|
if (m_widgetStyle) ApplyWidgetStyle();
|
||||||
|
|
||||||
#if wxUSE_DRAG_AND_DROP
|
#if wxUSE_DRAG_AND_DROP
|
||||||
#ifndef NEW_GTK_DND_CODE
|
#ifndef NEW_GTK_DND_CODE
|
||||||
if (m_dropTarget) m_dropTarget->RegisterWidget( list_item );
|
if (m_dropTarget) m_dropTarget->RegisterWidget( list_item );
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if wxUSE_TOOLTIPS
|
#if wxUSE_TOOLTIPS
|
||||||
if (m_toolTip) m_toolTip->Apply( this );
|
if (m_toolTip) m_toolTip->Apply( this );
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxListBox::Append( const wxString &item )
|
void wxListBox::Append( const wxString &item )
|
||||||
|
@@ -109,9 +109,9 @@ static void gtk_page_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation*
|
|||||||
(win->m_width == alloc->width) &&
|
(win->m_width == alloc->width) &&
|
||||||
(win->m_height == alloc->height))
|
(win->m_height == alloc->height))
|
||||||
{
|
{
|
||||||
return;
|
// return;
|
||||||
}
|
}
|
||||||
|
|
||||||
win->SetSize( alloc->x, alloc->y, alloc->width, alloc->height );
|
win->SetSize( alloc->x, alloc->y, alloc->width, alloc->height );
|
||||||
|
|
||||||
if (win->GetAutoLayout()) win->Layout();
|
if (win->GetAutoLayout()) win->Layout();
|
||||||
|
@@ -1294,6 +1294,40 @@ static gint gtk_scrollbar_button_release_callback( GtkRange *widget,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// "realize" from m_widget
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/* we cannot set colours, fonts and cursors before the widget has
|
||||||
|
been realized, so we do this directly after realization */
|
||||||
|
|
||||||
|
static gint
|
||||||
|
gtk_window_realized_callback( GtkWidget *widget, wxWindow *win )
|
||||||
|
{
|
||||||
|
if (win->m_font != *wxSWISS_FONT)
|
||||||
|
{
|
||||||
|
wxFont font( win->m_font );
|
||||||
|
win->m_font = wxNullFont;
|
||||||
|
win->SetFont( font );
|
||||||
|
}
|
||||||
|
|
||||||
|
if (win->m_backgroundColour != wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE ))
|
||||||
|
{
|
||||||
|
wxColour bg( win->m_backgroundColour );
|
||||||
|
win->m_backgroundColour = wxNullColour;
|
||||||
|
win->SetBackgroundColour( bg );
|
||||||
|
}
|
||||||
|
|
||||||
|
if (win->m_foregroundColour != *wxBLACK)
|
||||||
|
{
|
||||||
|
wxColour fg( win->m_foregroundColour );
|
||||||
|
win->m_foregroundColour = wxNullColour;
|
||||||
|
win->SetForegroundColour( fg );
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// InsertChild for wxWindow.
|
// InsertChild for wxWindow.
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -1750,13 +1784,12 @@ void wxWindow::PostCreation()
|
|||||||
|
|
||||||
ConnectWidget( GetConnectWidget() );
|
ConnectWidget( GetConnectWidget() );
|
||||||
|
|
||||||
/* we force the creation of wxFrame and wxDialog in the respective code */
|
/* we cannot set colours, fonts and cursors before the widget has
|
||||||
if (m_parent) gtk_widget_realize( m_widget );
|
been realized, so we do this directly after realization */
|
||||||
|
|
||||||
if (m_wxwindow) gtk_widget_realize( m_wxwindow );
|
gtk_signal_connect( GTK_OBJECT(m_widget), "realize",
|
||||||
|
GTK_SIGNAL_FUNC(gtk_window_realized_callback), (gpointer) this );
|
||||||
SetCursor( *wxSTANDARD_CURSOR );
|
|
||||||
|
|
||||||
m_hasVMT = TRUE;
|
m_hasVMT = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2071,6 +2104,8 @@ void wxWindow::ClientToScreen( int *x, int *y )
|
|||||||
{
|
{
|
||||||
wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
|
wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
|
||||||
|
|
||||||
|
if (!m_widget->window) return;
|
||||||
|
|
||||||
GdkWindow *source = (GdkWindow *) NULL;
|
GdkWindow *source = (GdkWindow *) NULL;
|
||||||
if (m_wxwindow)
|
if (m_wxwindow)
|
||||||
source = m_wxwindow->window;
|
source = m_wxwindow->window;
|
||||||
@@ -2098,6 +2133,8 @@ void wxWindow::ScreenToClient( int *x, int *y )
|
|||||||
{
|
{
|
||||||
wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
|
wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
|
||||||
|
|
||||||
|
if (!m_widget->window) return;
|
||||||
|
|
||||||
GdkWindow *source = (GdkWindow *) NULL;
|
GdkWindow *source = (GdkWindow *) NULL;
|
||||||
if (m_wxwindow)
|
if (m_wxwindow)
|
||||||
source = m_wxwindow->window;
|
source = m_wxwindow->window;
|
||||||
@@ -2351,6 +2388,8 @@ void wxWindow::Raise()
|
|||||||
{
|
{
|
||||||
wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
|
wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
|
||||||
|
|
||||||
|
if (!m_widget->window) return;
|
||||||
|
|
||||||
if (m_widget) gdk_window_raise( m_widget->window );
|
if (m_widget) gdk_window_raise( m_widget->window );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2358,6 +2397,8 @@ void wxWindow::Lower()
|
|||||||
{
|
{
|
||||||
wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
|
wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
|
||||||
|
|
||||||
|
if (!m_widget->window) return;
|
||||||
|
|
||||||
if (m_widget) gdk_window_lower( m_widget->window );
|
if (m_widget) gdk_window_lower( m_widget->window );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2459,8 +2500,9 @@ void wxWindow::SetCursor( const wxCursor &cursor )
|
|||||||
*m_cursor = *wxSTANDARD_CURSOR;
|
*m_cursor = *wxSTANDARD_CURSOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((m_widget) && (m_widget->window))
|
if (!m_widget->window) return;
|
||||||
gdk_window_set_cursor( m_widget->window, m_cursor->GetCursor() );
|
|
||||||
|
gdk_window_set_cursor( m_widget->window, m_cursor->GetCursor() );
|
||||||
|
|
||||||
if ((m_wxwindow) && (m_wxwindow->window))
|
if ((m_wxwindow) && (m_wxwindow->window))
|
||||||
gdk_window_set_cursor( m_wxwindow->window, m_cursor->GetCursor() );
|
gdk_window_set_cursor( m_wxwindow->window, m_cursor->GetCursor() );
|
||||||
@@ -2475,6 +2517,8 @@ void wxWindow::Refresh( bool eraseBackground, const wxRect *rect )
|
|||||||
{
|
{
|
||||||
wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
|
wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
|
||||||
|
|
||||||
|
if (!m_widget->window) return;
|
||||||
|
|
||||||
if (eraseBackground && m_wxwindow && m_wxwindow->window)
|
if (eraseBackground && m_wxwindow && m_wxwindow->window)
|
||||||
{
|
{
|
||||||
if (rect)
|
if (rect)
|
||||||
@@ -2540,6 +2584,8 @@ void wxWindow::Clear()
|
|||||||
{
|
{
|
||||||
wxCHECK_RET( m_widget != NULL, _T("invalid window") );
|
wxCHECK_RET( m_widget != NULL, _T("invalid window") );
|
||||||
|
|
||||||
|
if (!m_widget->window) return;
|
||||||
|
|
||||||
if (m_wxwindow && m_wxwindow->window)
|
if (m_wxwindow && m_wxwindow->window)
|
||||||
{
|
{
|
||||||
gdk_window_clear( m_wxwindow->window );
|
gdk_window_clear( m_wxwindow->window );
|
||||||
@@ -2596,6 +2642,8 @@ void wxWindow::SetBackgroundColour( const wxColour &colour )
|
|||||||
m_backgroundColour = colour;
|
m_backgroundColour = colour;
|
||||||
if (!m_backgroundColour.Ok()) return;
|
if (!m_backgroundColour.Ok()) return;
|
||||||
|
|
||||||
|
if (!m_widget->window) return;
|
||||||
|
|
||||||
if (m_wxwindow && m_wxwindow->window)
|
if (m_wxwindow && m_wxwindow->window)
|
||||||
{
|
{
|
||||||
/* wxMSW doesn't clear the window here. I don't do that
|
/* wxMSW doesn't clear the window here. I don't do that
|
||||||
@@ -2636,6 +2684,8 @@ void wxWindow::SetForegroundColour( const wxColour &colour )
|
|||||||
m_foregroundColour = colour;
|
m_foregroundColour = colour;
|
||||||
if (!m_foregroundColour.Ok()) return;
|
if (!m_foregroundColour.Ok()) return;
|
||||||
|
|
||||||
|
if (!m_widget->window) return;
|
||||||
|
|
||||||
wxColour sysbg = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE );
|
wxColour sysbg = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE );
|
||||||
if (sysbg.Red() == colour.Red() &&
|
if (sysbg.Red() == colour.Red() &&
|
||||||
sysbg.Green() == colour.Green() &&
|
sysbg.Green() == colour.Green() &&
|
||||||
@@ -2896,6 +2946,8 @@ void wxWindow::CaptureMouse()
|
|||||||
|
|
||||||
wxCHECK_RET( g_capturing == FALSE, _T("CaptureMouse called twice") );
|
wxCHECK_RET( g_capturing == FALSE, _T("CaptureMouse called twice") );
|
||||||
|
|
||||||
|
if (!m_widget->window) return;
|
||||||
|
|
||||||
GtkWidget *connect_widget = GetConnectWidget();
|
GtkWidget *connect_widget = GetConnectWidget();
|
||||||
gtk_grab_add( connect_widget );
|
gtk_grab_add( connect_widget );
|
||||||
gdk_pointer_grab( connect_widget->window, FALSE,
|
gdk_pointer_grab( connect_widget->window, FALSE,
|
||||||
@@ -2915,6 +2967,8 @@ void wxWindow::ReleaseMouse()
|
|||||||
|
|
||||||
wxCHECK_RET( g_capturing == TRUE, _T("ReleaseMouse called twice") );
|
wxCHECK_RET( g_capturing == TRUE, _T("ReleaseMouse called twice") );
|
||||||
|
|
||||||
|
if (!m_widget->window) return;
|
||||||
|
|
||||||
GtkWidget *connect_widget = GetConnectWidget();
|
GtkWidget *connect_widget = GetConnectWidget();
|
||||||
gtk_grab_remove( connect_widget );
|
gtk_grab_remove( connect_widget );
|
||||||
gdk_pointer_ungrab ( GDK_CURRENT_TIME );
|
gdk_pointer_ungrab ( GDK_CURRENT_TIME );
|
||||||
|
@@ -121,9 +121,6 @@ bool wxCheckBox::Create(wxWindow *parent,
|
|||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
gtk_widget_realize( m_widgetLabel );
|
|
||||||
gtk_widget_realize( m_widgetCheckbox );
|
|
||||||
|
|
||||||
SetBackgroundColour( parent->GetBackgroundColour() );
|
SetBackgroundColour( parent->GetBackgroundColour() );
|
||||||
SetForegroundColour( parent->GetForegroundColour() );
|
SetForegroundColour( parent->GetForegroundColour() );
|
||||||
SetFont( parent->GetFont() );
|
SetFont( parent->GetFont() );
|
||||||
|
@@ -85,9 +85,6 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id,
|
|||||||
GtkWidget *item = gtk_menu_item_new_with_label( choices[i].mbc_str() );
|
GtkWidget *item = gtk_menu_item_new_with_label( choices[i].mbc_str() );
|
||||||
gtk_menu_append( GTK_MENU(menu), item );
|
gtk_menu_append( GTK_MENU(menu), item );
|
||||||
|
|
||||||
gtk_widget_realize( item );
|
|
||||||
gtk_widget_realize( GTK_BIN(item)->child );
|
|
||||||
|
|
||||||
gtk_widget_show( item );
|
gtk_widget_show( item );
|
||||||
|
|
||||||
gtk_signal_connect( GTK_OBJECT( item ), "activate",
|
gtk_signal_connect( GTK_OBJECT( item ), "activate",
|
||||||
@@ -124,10 +121,13 @@ void wxChoice::AppendCommon( const wxString &item )
|
|||||||
|
|
||||||
gtk_menu_append( GTK_MENU(menu), menu_item );
|
gtk_menu_append( GTK_MENU(menu), menu_item );
|
||||||
|
|
||||||
gtk_widget_realize( menu_item );
|
if (GTK_WIDGET_REALIZED(m_widget))
|
||||||
gtk_widget_realize( GTK_BIN(menu_item)->child );
|
{
|
||||||
|
gtk_widget_realize( menu_item );
|
||||||
|
gtk_widget_realize( GTK_BIN(menu_item)->child );
|
||||||
|
|
||||||
if (m_widgetStyle) ApplyWidgetStyle();
|
if (m_widgetStyle) ApplyWidgetStyle();
|
||||||
|
}
|
||||||
|
|
||||||
gtk_signal_connect( GTK_OBJECT( menu_item ), "activate",
|
gtk_signal_connect( GTK_OBJECT( menu_item ), "activate",
|
||||||
GTK_SIGNAL_FUNC(gtk_choice_clicked_callback), (gpointer*)this );
|
GTK_SIGNAL_FUNC(gtk_choice_clicked_callback), (gpointer*)this );
|
||||||
|
@@ -113,9 +113,6 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
|
|||||||
|
|
||||||
gtk_container_add( GTK_CONTAINER(list), list_item );
|
gtk_container_add( GTK_CONTAINER(list), list_item );
|
||||||
|
|
||||||
gtk_widget_realize( list_item );
|
|
||||||
gtk_widget_realize( GTK_BIN(list_item)->child );
|
|
||||||
|
|
||||||
gtk_widget_show( list_item );
|
gtk_widget_show( list_item );
|
||||||
|
|
||||||
gtk_signal_connect( GTK_OBJECT(list_item), "select",
|
gtk_signal_connect( GTK_OBJECT(list_item), "select",
|
||||||
@@ -132,10 +129,6 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
|
|||||||
|
|
||||||
if (!value.IsNull()) SetValue( value );
|
if (!value.IsNull()) SetValue( value );
|
||||||
|
|
||||||
gtk_widget_realize( GTK_COMBO(m_widget)->list );
|
|
||||||
gtk_widget_realize( GTK_COMBO(m_widget)->entry );
|
|
||||||
gtk_widget_realize( GTK_COMBO(m_widget)->button );
|
|
||||||
|
|
||||||
if (style & wxCB_READONLY)
|
if (style & wxCB_READONLY)
|
||||||
gtk_entry_set_editable( GTK_ENTRY( GTK_COMBO(m_widget)->entry ), FALSE );
|
gtk_entry_set_editable( GTK_ENTRY( GTK_COMBO(m_widget)->entry ), FALSE );
|
||||||
|
|
||||||
@@ -176,7 +169,13 @@ void wxComboBox::AppendCommon( const wxString &item )
|
|||||||
|
|
||||||
gtk_container_add( GTK_CONTAINER(list), list_item );
|
gtk_container_add( GTK_CONTAINER(list), list_item );
|
||||||
|
|
||||||
if (m_widgetStyle) ApplyWidgetStyle();
|
if (GTK_WIDGET_REALIZED(m_widget))
|
||||||
|
{
|
||||||
|
gtk_widget_realize( list_item );
|
||||||
|
gtk_widget_realize( GTK_BIN(list_item)->child );
|
||||||
|
|
||||||
|
if (m_widgetStyle) ApplyWidgetStyle();
|
||||||
|
}
|
||||||
|
|
||||||
gtk_widget_show( list_item );
|
gtk_widget_show( list_item );
|
||||||
}
|
}
|
||||||
|
@@ -825,8 +825,6 @@ void wxWindowDC::GetTextExtent( const wxString &string, long *width, long *heigh
|
|||||||
long *descent, long *externalLeading,
|
long *descent, long *externalLeading,
|
||||||
wxFont *theFont, bool WXUNUSED(use16) )
|
wxFont *theFont, bool WXUNUSED(use16) )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
|
||||||
|
|
||||||
wxFont fontToUse = m_font;
|
wxFont fontToUse = m_font;
|
||||||
if (theFont) fontToUse = *theFont;
|
if (theFont) fontToUse = *theFont;
|
||||||
|
|
||||||
@@ -839,16 +837,12 @@ void wxWindowDC::GetTextExtent( const wxString &string, long *width, long *heigh
|
|||||||
|
|
||||||
long wxWindowDC::GetCharWidth()
|
long wxWindowDC::GetCharWidth()
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( Ok(), 0, _T("invalid window dc") );
|
|
||||||
|
|
||||||
GdkFont *font = m_font.GetInternalFont( m_scaleY );
|
GdkFont *font = m_font.GetInternalFont( m_scaleY );
|
||||||
return long(gdk_string_width( font, "H" ) / m_scaleX);
|
return long(gdk_string_width( font, "H" ) / m_scaleX);
|
||||||
}
|
}
|
||||||
|
|
||||||
long wxWindowDC::GetCharHeight()
|
long wxWindowDC::GetCharHeight()
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( Ok(), 0, _T("invalid window dc") );
|
|
||||||
|
|
||||||
GdkFont *font = m_font.GetInternalFont( m_scaleY );
|
GdkFont *font = m_font.GetInternalFont( m_scaleY );
|
||||||
return long((font->ascent + font->descent) / m_scaleY);
|
return long((font->ascent + font->descent) / m_scaleY);
|
||||||
}
|
}
|
||||||
@@ -883,8 +877,6 @@ void wxWindowDC::Clear()
|
|||||||
|
|
||||||
void wxWindowDC::SetFont( const wxFont &font )
|
void wxWindowDC::SetFont( const wxFont &font )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
|
||||||
|
|
||||||
m_font = font;
|
m_font = font;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -82,6 +82,48 @@ static gint gtk_dialog_configure_callback( GtkWidget *WXUNUSED(widget), GdkEvent
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// "realize" from m_widget
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/* we cannot MWM hints before the widget has been realized,
|
||||||
|
so we do this directly after realization */
|
||||||
|
|
||||||
|
static gint
|
||||||
|
gtk_dialog_realized_callback( GtkWidget *widget, wxWindow *win )
|
||||||
|
{
|
||||||
|
/* all this is for Motif Window Manager "hints" and is supposed to be
|
||||||
|
recognized by other WM as well. not tested. */
|
||||||
|
long decor = (long) GDK_DECOR_ALL;
|
||||||
|
long func = (long) GDK_FUNC_ALL;
|
||||||
|
|
||||||
|
if ((win->m_windowStyle & wxCAPTION) == 0)
|
||||||
|
decor |= GDK_DECOR_TITLE;
|
||||||
|
/* if ((win->m_windowStyle & wxMINIMIZE) == 0)
|
||||||
|
func |= GDK_FUNC_MINIMIZE;
|
||||||
|
if ((win->m_windowStyle & wxMAXIMIZE) == 0)
|
||||||
|
func |= GDK_FUNC_MAXIMIZE; */
|
||||||
|
if ((win->m_windowStyle & wxSYSTEM_MENU) == 0)
|
||||||
|
decor |= GDK_DECOR_MENU;
|
||||||
|
if ((win->m_windowStyle & wxMINIMIZE_BOX) == 0)
|
||||||
|
decor |= GDK_DECOR_MINIMIZE;
|
||||||
|
if ((win->m_windowStyle & wxMAXIMIZE_BOX) == 0)
|
||||||
|
decor |= GDK_DECOR_MAXIMIZE;
|
||||||
|
if ((win->m_windowStyle & wxRESIZE_BORDER) == 0)
|
||||||
|
func |= GDK_FUNC_RESIZE;
|
||||||
|
|
||||||
|
gdk_window_set_decorations( win->m_widget->window, (GdkWMDecoration)decor);
|
||||||
|
gdk_window_set_functions( win->m_widget->window, (GdkWMFunction)func);
|
||||||
|
|
||||||
|
/* GTK's shrinking/growing policy */
|
||||||
|
if ((win->m_windowStyle & wxRESIZE_BORDER) == 0)
|
||||||
|
gtk_window_set_policy(GTK_WINDOW(win->m_widget), 0, 0, 1);
|
||||||
|
else
|
||||||
|
gtk_window_set_policy(GTK_WINDOW(win->m_widget), 1, 1, 1);
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// wxDialog
|
// wxDialog
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -143,37 +185,12 @@ bool wxDialog::Create( wxWindow *parent,
|
|||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
gtk_widget_realize( m_widget );
|
/* we cannot set MWM hints before the widget has
|
||||||
|
been realized, so we do this directly after realization */
|
||||||
/* all this is for Motif Window Manager "hints" and is supposed to be
|
gtk_signal_connect( GTK_OBJECT(m_widget), "realize",
|
||||||
recognized by other WM as well. not tested. */
|
GTK_SIGNAL_FUNC(gtk_dialog_realized_callback), (gpointer) this );
|
||||||
long decor = (long) GDK_DECOR_ALL;
|
|
||||||
long func = (long) GDK_FUNC_ALL;
|
|
||||||
|
|
||||||
if ((m_windowStyle & wxCAPTION) == 0)
|
/* the user resized the frame by dragging etc. */
|
||||||
decor |= GDK_DECOR_TITLE;
|
|
||||||
/* if ((m_windowStyle & wxMINIMIZE) == 0)
|
|
||||||
func |= GDK_FUNC_MINIMIZE;
|
|
||||||
if ((m_windowStyle & wxMAXIMIZE) == 0)
|
|
||||||
func |= GDK_FUNC_MAXIMIZE; */
|
|
||||||
if ((m_windowStyle & wxSYSTEM_MENU) == 0)
|
|
||||||
decor |= GDK_DECOR_MENU;
|
|
||||||
if ((m_windowStyle & wxMINIMIZE_BOX) == 0)
|
|
||||||
decor |= GDK_DECOR_MINIMIZE;
|
|
||||||
if ((m_windowStyle & wxMAXIMIZE_BOX) == 0)
|
|
||||||
decor |= GDK_DECOR_MAXIMIZE;
|
|
||||||
if ((m_windowStyle & wxRESIZE_BORDER) == 0)
|
|
||||||
func |= GDK_FUNC_RESIZE;
|
|
||||||
|
|
||||||
gdk_window_set_decorations(m_widget->window, (GdkWMDecoration)decor);
|
|
||||||
gdk_window_set_functions(m_widget->window, (GdkWMFunction)func);
|
|
||||||
|
|
||||||
/* GTK's shrinking/growing policy */
|
|
||||||
if ((m_windowStyle & wxRESIZE_BORDER) == 0)
|
|
||||||
gtk_window_set_policy(GTK_WINDOW(m_widget), 0, 0, 1);
|
|
||||||
else
|
|
||||||
gtk_window_set_policy(GTK_WINDOW(m_widget), 1, 1, 1);
|
|
||||||
|
|
||||||
gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
|
gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
|
||||||
GTK_SIGNAL_FUNC(gtk_dialog_size_callback), (gpointer)this );
|
GTK_SIGNAL_FUNC(gtk_dialog_size_callback), (gpointer)this );
|
||||||
|
|
||||||
|
@@ -146,6 +146,48 @@ static gint gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventC
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// "realize" from m_widget
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/* we cannot MWM hints before the widget has been realized,
|
||||||
|
so we do this directly after realization */
|
||||||
|
|
||||||
|
static gint
|
||||||
|
gtk_frame_realized_callback( GtkWidget *widget, wxWindow *win )
|
||||||
|
{
|
||||||
|
/* all this is for Motif Window Manager "hints" and is supposed to be
|
||||||
|
recognized by other WM as well. not tested. */
|
||||||
|
long decor = (long) GDK_DECOR_ALL;
|
||||||
|
long func = (long) GDK_FUNC_ALL;
|
||||||
|
|
||||||
|
if ((win->m_windowStyle & wxCAPTION) == 0)
|
||||||
|
decor |= GDK_DECOR_TITLE;
|
||||||
|
/* if ((win->m_windowStyle & wxMINIMIZE) == 0)
|
||||||
|
func |= GDK_FUNC_MINIMIZE;
|
||||||
|
if ((win->m_windowStyle & wxMAXIMIZE) == 0)
|
||||||
|
func |= GDK_FUNC_MAXIMIZE; */
|
||||||
|
if ((win->m_windowStyle & wxSYSTEM_MENU) == 0)
|
||||||
|
decor |= GDK_DECOR_MENU;
|
||||||
|
if ((win->m_windowStyle & wxMINIMIZE_BOX) == 0)
|
||||||
|
decor |= GDK_DECOR_MINIMIZE;
|
||||||
|
if ((win->m_windowStyle & wxMAXIMIZE_BOX) == 0)
|
||||||
|
decor |= GDK_DECOR_MAXIMIZE;
|
||||||
|
if ((win->m_windowStyle & wxRESIZE_BORDER) == 0)
|
||||||
|
func |= GDK_FUNC_RESIZE;
|
||||||
|
|
||||||
|
gdk_window_set_decorations( win->m_widget->window, (GdkWMDecoration)decor);
|
||||||
|
gdk_window_set_functions( win->m_widget->window, (GdkWMFunction)func);
|
||||||
|
|
||||||
|
/* GTK's shrinking/growing policy */
|
||||||
|
if ((win->m_windowStyle & wxRESIZE_BORDER) == 0)
|
||||||
|
gtk_window_set_policy(GTK_WINDOW(win->m_widget), 0, 0, 1);
|
||||||
|
else
|
||||||
|
gtk_window_set_policy(GTK_WINDOW(win->m_widget), 1, 1, 1);
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// InsertChild for wxFrame
|
// InsertChild for wxFrame
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -281,7 +323,6 @@ bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title,
|
|||||||
gtk_widget_show( m_mainWidget );
|
gtk_widget_show( m_mainWidget );
|
||||||
GTK_WIDGET_UNSET_FLAGS( m_mainWidget, GTK_CAN_FOCUS );
|
GTK_WIDGET_UNSET_FLAGS( m_mainWidget, GTK_CAN_FOCUS );
|
||||||
gtk_container_add( GTK_CONTAINER(m_widget), m_mainWidget );
|
gtk_container_add( GTK_CONTAINER(m_widget), m_mainWidget );
|
||||||
gtk_widget_realize( m_mainWidget );
|
|
||||||
|
|
||||||
/* m_wxwindow only represents the client area without toolbar and menubar */
|
/* m_wxwindow only represents the client area without toolbar and menubar */
|
||||||
m_wxwindow = gtk_myfixed_new();
|
m_wxwindow = gtk_myfixed_new();
|
||||||
@@ -293,37 +334,11 @@ bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title,
|
|||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
gtk_widget_realize( m_widget );
|
/* we cannot set MWM hints before the widget has
|
||||||
|
been realized, so we do this directly after realization */
|
||||||
|
gtk_signal_connect( GTK_OBJECT(m_widget), "realize",
|
||||||
|
GTK_SIGNAL_FUNC(gtk_frame_realized_callback), (gpointer) this );
|
||||||
|
|
||||||
/* all this is for Motif Window Manager "hints" and is supposed to be
|
|
||||||
recognized by other WM as well. not tested. */
|
|
||||||
long decor = (long) GDK_DECOR_ALL;
|
|
||||||
long func = (long) GDK_FUNC_ALL;
|
|
||||||
|
|
||||||
if ((m_windowStyle & wxCAPTION) == 0)
|
|
||||||
decor |= GDK_DECOR_TITLE;
|
|
||||||
/* if ((m_windowStyle & wxMINIMIZE) == 0)
|
|
||||||
func |= GDK_FUNC_MINIMIZE;
|
|
||||||
if ((m_windowStyle & wxMAXIMIZE) == 0)
|
|
||||||
func |= GDK_FUNC_MAXIMIZE; */
|
|
||||||
if ((m_windowStyle & wxSYSTEM_MENU) == 0)
|
|
||||||
decor |= GDK_DECOR_MENU;
|
|
||||||
if ((m_windowStyle & wxMINIMIZE_BOX) == 0)
|
|
||||||
decor |= GDK_DECOR_MINIMIZE;
|
|
||||||
if ((m_windowStyle & wxMAXIMIZE_BOX) == 0)
|
|
||||||
decor |= GDK_DECOR_MAXIMIZE;
|
|
||||||
if ((m_windowStyle & wxRESIZE_BORDER) == 0)
|
|
||||||
func |= GDK_FUNC_RESIZE;
|
|
||||||
|
|
||||||
gdk_window_set_decorations(m_widget->window, (GdkWMDecoration)decor);
|
|
||||||
gdk_window_set_functions(m_widget->window, (GdkWMFunction)func);
|
|
||||||
|
|
||||||
/* GTK's shrinking/growing policy */
|
|
||||||
if ((m_windowStyle & wxRESIZE_BORDER) == 0)
|
|
||||||
gtk_window_set_policy(GTK_WINDOW(m_widget), 0, 0, 1);
|
|
||||||
else
|
|
||||||
gtk_window_set_policy(GTK_WINDOW(m_widget), 1, 1, 1);
|
|
||||||
|
|
||||||
/* the user resized the frame by dragging etc. */
|
/* the user resized the frame by dragging etc. */
|
||||||
gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
|
gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
|
||||||
GTK_SIGNAL_FUNC(gtk_frame_size_callback), (gpointer)this );
|
GTK_SIGNAL_FUNC(gtk_frame_size_callback), (gpointer)this );
|
||||||
|
@@ -274,8 +274,6 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
|
|||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
gtk_widget_realize( GTK_WIDGET(m_list) );
|
|
||||||
|
|
||||||
SetBackgroundColour( parent->GetBackgroundColour() );
|
SetBackgroundColour( parent->GetBackgroundColour() );
|
||||||
SetForegroundColour( parent->GetForegroundColour() );
|
SetForegroundColour( parent->GetForegroundColour() );
|
||||||
SetFont( parent->GetFont() );
|
SetFont( parent->GetFont() );
|
||||||
@@ -411,8 +409,6 @@ void wxListBox::AppendCommon( const wxString &item )
|
|||||||
gtk_signal_connect( GTK_OBJECT(list_item), "deselect",
|
gtk_signal_connect( GTK_OBJECT(list_item), "deselect",
|
||||||
GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this );
|
GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this );
|
||||||
|
|
||||||
if (m_widgetStyle) ApplyWidgetStyle();
|
|
||||||
|
|
||||||
gtk_signal_connect( GTK_OBJECT(list_item),
|
gtk_signal_connect( GTK_OBJECT(list_item),
|
||||||
"button_press_event",
|
"button_press_event",
|
||||||
(GtkSignalFunc)gtk_listbox_button_press_callback,
|
(GtkSignalFunc)gtk_listbox_button_press_callback,
|
||||||
@@ -430,15 +426,23 @@ void wxListBox::AppendCommon( const wxString &item )
|
|||||||
|
|
||||||
ConnectWidget( list_item );
|
ConnectWidget( list_item );
|
||||||
|
|
||||||
|
if (GTK_WIDGET_REALIZED(m_widget))
|
||||||
|
{
|
||||||
|
gtk_widget_realize( list_item );
|
||||||
|
gtk_widget_realize( GTK_BIN(list_item)->child );
|
||||||
|
|
||||||
|
if (m_widgetStyle) ApplyWidgetStyle();
|
||||||
|
|
||||||
#if wxUSE_DRAG_AND_DROP
|
#if wxUSE_DRAG_AND_DROP
|
||||||
#ifndef NEW_GTK_DND_CODE
|
#ifndef NEW_GTK_DND_CODE
|
||||||
if (m_dropTarget) m_dropTarget->RegisterWidget( list_item );
|
if (m_dropTarget) m_dropTarget->RegisterWidget( list_item );
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if wxUSE_TOOLTIPS
|
#if wxUSE_TOOLTIPS
|
||||||
if (m_toolTip) m_toolTip->Apply( this );
|
if (m_toolTip) m_toolTip->Apply( this );
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxListBox::Append( const wxString &item )
|
void wxListBox::Append( const wxString &item )
|
||||||
|
@@ -109,9 +109,9 @@ static void gtk_page_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation*
|
|||||||
(win->m_width == alloc->width) &&
|
(win->m_width == alloc->width) &&
|
||||||
(win->m_height == alloc->height))
|
(win->m_height == alloc->height))
|
||||||
{
|
{
|
||||||
return;
|
// return;
|
||||||
}
|
}
|
||||||
|
|
||||||
win->SetSize( alloc->x, alloc->y, alloc->width, alloc->height );
|
win->SetSize( alloc->x, alloc->y, alloc->width, alloc->height );
|
||||||
|
|
||||||
if (win->GetAutoLayout()) win->Layout();
|
if (win->GetAutoLayout()) win->Layout();
|
||||||
|
@@ -1294,6 +1294,40 @@ static gint gtk_scrollbar_button_release_callback( GtkRange *widget,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// "realize" from m_widget
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/* we cannot set colours, fonts and cursors before the widget has
|
||||||
|
been realized, so we do this directly after realization */
|
||||||
|
|
||||||
|
static gint
|
||||||
|
gtk_window_realized_callback( GtkWidget *widget, wxWindow *win )
|
||||||
|
{
|
||||||
|
if (win->m_font != *wxSWISS_FONT)
|
||||||
|
{
|
||||||
|
wxFont font( win->m_font );
|
||||||
|
win->m_font = wxNullFont;
|
||||||
|
win->SetFont( font );
|
||||||
|
}
|
||||||
|
|
||||||
|
if (win->m_backgroundColour != wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE ))
|
||||||
|
{
|
||||||
|
wxColour bg( win->m_backgroundColour );
|
||||||
|
win->m_backgroundColour = wxNullColour;
|
||||||
|
win->SetBackgroundColour( bg );
|
||||||
|
}
|
||||||
|
|
||||||
|
if (win->m_foregroundColour != *wxBLACK)
|
||||||
|
{
|
||||||
|
wxColour fg( win->m_foregroundColour );
|
||||||
|
win->m_foregroundColour = wxNullColour;
|
||||||
|
win->SetForegroundColour( fg );
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// InsertChild for wxWindow.
|
// InsertChild for wxWindow.
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -1750,13 +1784,12 @@ void wxWindow::PostCreation()
|
|||||||
|
|
||||||
ConnectWidget( GetConnectWidget() );
|
ConnectWidget( GetConnectWidget() );
|
||||||
|
|
||||||
/* we force the creation of wxFrame and wxDialog in the respective code */
|
/* we cannot set colours, fonts and cursors before the widget has
|
||||||
if (m_parent) gtk_widget_realize( m_widget );
|
been realized, so we do this directly after realization */
|
||||||
|
|
||||||
if (m_wxwindow) gtk_widget_realize( m_wxwindow );
|
gtk_signal_connect( GTK_OBJECT(m_widget), "realize",
|
||||||
|
GTK_SIGNAL_FUNC(gtk_window_realized_callback), (gpointer) this );
|
||||||
SetCursor( *wxSTANDARD_CURSOR );
|
|
||||||
|
|
||||||
m_hasVMT = TRUE;
|
m_hasVMT = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2071,6 +2104,8 @@ void wxWindow::ClientToScreen( int *x, int *y )
|
|||||||
{
|
{
|
||||||
wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
|
wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
|
||||||
|
|
||||||
|
if (!m_widget->window) return;
|
||||||
|
|
||||||
GdkWindow *source = (GdkWindow *) NULL;
|
GdkWindow *source = (GdkWindow *) NULL;
|
||||||
if (m_wxwindow)
|
if (m_wxwindow)
|
||||||
source = m_wxwindow->window;
|
source = m_wxwindow->window;
|
||||||
@@ -2098,6 +2133,8 @@ void wxWindow::ScreenToClient( int *x, int *y )
|
|||||||
{
|
{
|
||||||
wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
|
wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
|
||||||
|
|
||||||
|
if (!m_widget->window) return;
|
||||||
|
|
||||||
GdkWindow *source = (GdkWindow *) NULL;
|
GdkWindow *source = (GdkWindow *) NULL;
|
||||||
if (m_wxwindow)
|
if (m_wxwindow)
|
||||||
source = m_wxwindow->window;
|
source = m_wxwindow->window;
|
||||||
@@ -2351,6 +2388,8 @@ void wxWindow::Raise()
|
|||||||
{
|
{
|
||||||
wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
|
wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
|
||||||
|
|
||||||
|
if (!m_widget->window) return;
|
||||||
|
|
||||||
if (m_widget) gdk_window_raise( m_widget->window );
|
if (m_widget) gdk_window_raise( m_widget->window );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2358,6 +2397,8 @@ void wxWindow::Lower()
|
|||||||
{
|
{
|
||||||
wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
|
wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
|
||||||
|
|
||||||
|
if (!m_widget->window) return;
|
||||||
|
|
||||||
if (m_widget) gdk_window_lower( m_widget->window );
|
if (m_widget) gdk_window_lower( m_widget->window );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2459,8 +2500,9 @@ void wxWindow::SetCursor( const wxCursor &cursor )
|
|||||||
*m_cursor = *wxSTANDARD_CURSOR;
|
*m_cursor = *wxSTANDARD_CURSOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((m_widget) && (m_widget->window))
|
if (!m_widget->window) return;
|
||||||
gdk_window_set_cursor( m_widget->window, m_cursor->GetCursor() );
|
|
||||||
|
gdk_window_set_cursor( m_widget->window, m_cursor->GetCursor() );
|
||||||
|
|
||||||
if ((m_wxwindow) && (m_wxwindow->window))
|
if ((m_wxwindow) && (m_wxwindow->window))
|
||||||
gdk_window_set_cursor( m_wxwindow->window, m_cursor->GetCursor() );
|
gdk_window_set_cursor( m_wxwindow->window, m_cursor->GetCursor() );
|
||||||
@@ -2475,6 +2517,8 @@ void wxWindow::Refresh( bool eraseBackground, const wxRect *rect )
|
|||||||
{
|
{
|
||||||
wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
|
wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
|
||||||
|
|
||||||
|
if (!m_widget->window) return;
|
||||||
|
|
||||||
if (eraseBackground && m_wxwindow && m_wxwindow->window)
|
if (eraseBackground && m_wxwindow && m_wxwindow->window)
|
||||||
{
|
{
|
||||||
if (rect)
|
if (rect)
|
||||||
@@ -2540,6 +2584,8 @@ void wxWindow::Clear()
|
|||||||
{
|
{
|
||||||
wxCHECK_RET( m_widget != NULL, _T("invalid window") );
|
wxCHECK_RET( m_widget != NULL, _T("invalid window") );
|
||||||
|
|
||||||
|
if (!m_widget->window) return;
|
||||||
|
|
||||||
if (m_wxwindow && m_wxwindow->window)
|
if (m_wxwindow && m_wxwindow->window)
|
||||||
{
|
{
|
||||||
gdk_window_clear( m_wxwindow->window );
|
gdk_window_clear( m_wxwindow->window );
|
||||||
@@ -2596,6 +2642,8 @@ void wxWindow::SetBackgroundColour( const wxColour &colour )
|
|||||||
m_backgroundColour = colour;
|
m_backgroundColour = colour;
|
||||||
if (!m_backgroundColour.Ok()) return;
|
if (!m_backgroundColour.Ok()) return;
|
||||||
|
|
||||||
|
if (!m_widget->window) return;
|
||||||
|
|
||||||
if (m_wxwindow && m_wxwindow->window)
|
if (m_wxwindow && m_wxwindow->window)
|
||||||
{
|
{
|
||||||
/* wxMSW doesn't clear the window here. I don't do that
|
/* wxMSW doesn't clear the window here. I don't do that
|
||||||
@@ -2636,6 +2684,8 @@ void wxWindow::SetForegroundColour( const wxColour &colour )
|
|||||||
m_foregroundColour = colour;
|
m_foregroundColour = colour;
|
||||||
if (!m_foregroundColour.Ok()) return;
|
if (!m_foregroundColour.Ok()) return;
|
||||||
|
|
||||||
|
if (!m_widget->window) return;
|
||||||
|
|
||||||
wxColour sysbg = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE );
|
wxColour sysbg = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE );
|
||||||
if (sysbg.Red() == colour.Red() &&
|
if (sysbg.Red() == colour.Red() &&
|
||||||
sysbg.Green() == colour.Green() &&
|
sysbg.Green() == colour.Green() &&
|
||||||
@@ -2896,6 +2946,8 @@ void wxWindow::CaptureMouse()
|
|||||||
|
|
||||||
wxCHECK_RET( g_capturing == FALSE, _T("CaptureMouse called twice") );
|
wxCHECK_RET( g_capturing == FALSE, _T("CaptureMouse called twice") );
|
||||||
|
|
||||||
|
if (!m_widget->window) return;
|
||||||
|
|
||||||
GtkWidget *connect_widget = GetConnectWidget();
|
GtkWidget *connect_widget = GetConnectWidget();
|
||||||
gtk_grab_add( connect_widget );
|
gtk_grab_add( connect_widget );
|
||||||
gdk_pointer_grab( connect_widget->window, FALSE,
|
gdk_pointer_grab( connect_widget->window, FALSE,
|
||||||
@@ -2915,6 +2967,8 @@ void wxWindow::ReleaseMouse()
|
|||||||
|
|
||||||
wxCHECK_RET( g_capturing == TRUE, _T("ReleaseMouse called twice") );
|
wxCHECK_RET( g_capturing == TRUE, _T("ReleaseMouse called twice") );
|
||||||
|
|
||||||
|
if (!m_widget->window) return;
|
||||||
|
|
||||||
GtkWidget *connect_widget = GetConnectWidget();
|
GtkWidget *connect_widget = GetConnectWidget();
|
||||||
gtk_grab_remove( connect_widget );
|
gtk_grab_remove( connect_widget );
|
||||||
gdk_pointer_ungrab ( GDK_CURRENT_TIME );
|
gdk_pointer_ungrab ( GDK_CURRENT_TIME );
|
||||||
|
Reference in New Issue
Block a user