void SetLayoutDirection(wxLayoutDirection dir);
wxLayoutDirection GetLayoutDirection() const;
+ // wxMenuBar is not a top level window but it still doesn't need a parent
+ // window
+ virtual bool GTKNeedsParent() const { return false; }
+
void Attach(wxFrame *frame);
// implementation only from now on
static wxLayoutDirection GTKGetLayout(GtkWidget *widget);
static void GTKSetLayout(GtkWidget *widget, wxLayoutDirection dir);
+ // return true if this window must have a non-NULL parent, false if it can
+ // be created without parent (normally only top level windows but in wxGTK
+ // there is also the exception of wxMenuBar)
+ virtual bool GTKNeedsParent() const { return !IsTopLevel(); }
+
protected:
// Override GTKWidgetNeedsMnemonic and return true if your
// needs to set its mnemonic widget, such as for a
// extra (wxGTK-specific) flags
- bool m_needParent:1; // ! wxFrame, wxDialog, wxNotebookPage ?
bool m_noExpose:1; // wxGLCanvas has its own redrawing
bool m_nativeSizeEvent:1; // wxGLCanvas sends wxSizeEvent upon "alloc_size"
bool m_hasScrolling:1;
long style,
const wxString& name)
{
- m_needParent = true;
-
if (!PreCreation( parent, pos, size ) ||
!base_type::CreateBase(parent, id, pos, size, style & wxWINDOW_STYLE_MASK,
wxDefaultValidator, name))
const wxValidator& validator,
const wxString &name )
{
- m_needParent = true;
-
if (!PreCreation( parent, pos, size ) ||
!CreateBase( parent, id, pos, size, style, validator, name ))
{
{
}
-bool wxButton::Create( wxWindow *parent, wxWindowID id, const wxString &label,
- const wxPoint &pos, const wxSize &size,
- long style, const wxValidator& validator, const wxString &name )
+bool wxButton::Create(wxWindow *parent,
+ wxWindowID id,
+ const wxString &label,
+ const wxPoint& pos,
+ const wxSize& size,
+ long style,
+ const wxValidator& validator,
+ const wxString& name)
{
- m_needParent = true;
-
if (!PreCreation( parent, pos, size ) ||
!CreateBase( parent, id, pos, size, style, validator, name ))
{
const wxValidator& validator,
const wxString &name )
{
- m_needParent = true;
m_blockEvent = false;
if (!PreCreation( parent, pos, size ) ||
int n, const wxString choices[],
long style, const wxValidator& validator, const wxString &name )
{
- m_needParent = true;
-
if (!PreCreation( parent, pos, size ) ||
!CreateBase( parent, id, pos, size, style, validator, name ))
{
{
if (!gtk_check_version(2,4,0))
{
- m_needParent = true;
-
if (!PreCreation( parent, pos, size ) ||
!wxControl::CreateBase(parent, id, pos, size, style, validator, name))
{
return wxGenericCollapsiblePane::Create(parent, id, label,
pos, size, style, val, name);
- m_needParent = true;
m_bIgnoreNextChange = false;
if ( !PreCreation( parent, pos, size ) ||
const wxString& name )
{
m_ignoreNextUpdate = false;
- m_needParent = true;
m_prevSelection = 0;
if (!PreCreation( parent, pos, size ) ||
wxControl::wxControl()
{
- m_needParent = true;
}
bool wxControl::Create( wxWindow *parent,
GdkRectangle *background_area,
GdkRectangle *cell_area,
GtkCellRendererState flags );
-
+
static GObjectClass *cell_parent_class = NULL;
wxDataViewCustomRenderer *cell = wxrenderer->cell;
if (!cell->HasEditorCtrl())
return NULL;
-
+
GdkRectangle rect;
gtk_wx_cell_renderer_get_size (renderer, widget, cell_area,
&rect.x,
if (!event)
{
bool ret = false;
-
+
// activated by <ENTER>
if (cell->Activate( renderrect, model, model_col, model_row ))
ret = true;
-
+
return ret;
}
else if (event->type == GDK_BUTTON_PRESS)
// Insert widget in GtkTreeView
if (GTK_WIDGET_REALIZED(treeview))
- gtk_widget_set_parent_window( child->m_widget,
+ gtk_widget_set_parent_window( child->m_widget,
gtk_tree_view_get_bin_window( GTK_TREE_VIEW(treeview) ) );
gtk_widget_set_parent( child->m_widget, treeview );
}
GtkAllocation *alloc,
wxDataViewCtrl *win )
{
-
+
wxWindowList::Node *node = win->GetChildren().GetFirst();
while (node)
{
wxWindow *child = node->GetData();
-
+
GtkRequisition req;
gtk_widget_size_request( child->m_widget, &req );
-
+
GtkAllocation alloc;
alloc.x = child->m_x;
alloc.y = child->m_y;
alloc.width = child->m_width;
alloc.height = child->m_height;
gtk_widget_size_allocate( child->m_widget, &alloc );
-
+
node = node->GetNext();
}
}
{
Init();
- m_needParent = true;
-
if (!PreCreation( parent, pos, size ) ||
!CreateBase( parent, id, pos, size, style, validator ))
{
m_treeview = gtk_tree_view_new();
gtk_container_add (GTK_CONTAINER (m_widget), m_treeview);
-
+
g_signal_connect (m_treeview, "size_allocate",
G_CALLBACK (gtk_dataviewctrl_size_callback), this);
if (!gtk_check_version(2,4,0))
{
m_message = title;
- m_needParent = false;
parent = GetParentForModalDialog(parent);
return;
}
- m_needParent = false;
-
parent = GetParentForModalDialog(parent);
if (!PreCreation(parent, pos, wxDefaultSize) ||
// VERY IMPORTANT: this code is identic to relative code in wxDirButton;
// if you find a problem here, fix it also in wxDirButton !
- m_needParent = true;
-
if (!PreCreation( parent, pos, size ) ||
!wxControl::CreateBase(parent, id, pos, size, style & wxWINDOW_STYLE_MASK,
validator, name))
// VERY IMPORTANT: this code is identic to relative code in wxFileButton;
// if you find a problem here, fix it also in wxFileButton !
- m_needParent = true;
-
if (!PreCreation( parent, pos, size ) ||
!wxControl::CreateBase(parent, id, pos, size, style & wxWINDOW_STYLE_MASK,
validator, name))
bool wxFontDialog::DoCreate(wxWindow *parent)
{
- m_needParent = false;
-
parent = GetParentForModalDialog(parent);
if (!PreCreation( parent, wxDefaultPosition, wxDefaultSize ) ||
{
if (!gtk_check_version(2,4,0))
{
- m_needParent = true;
-
if (!PreCreation( parent, pos, size ) ||
!wxControl::CreateBase(parent, id, pos, size, style, validator, name))
{
const wxValidator& validator,
const wxString& name )
{
- m_needParent = true;
-
if (!PreCreation( parent, pos, size ) ||
!CreateBase( parent, id, pos, size, style, validator, name ))
{
// do validation checks:
CheckParams(label, url, style);
- m_needParent = true;
-
if (!PreCreation( parent, pos, size ) ||
!CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
{
long style, const wxValidator& validator,
const wxString &name )
{
- m_needParent = true;
m_blockEvent = false;
if (!PreCreation( parent, pos, size ) ||
bool wxMDIClientWindow::CreateClient( wxMDIParentFrame *parent, long style )
{
- m_needParent = true;
-
m_insertCallback = (wxInsertChildFunction)wxInsertChildInMDI;
if (!PreCreation( parent, wxDefaultPosition, wxDefaultSize ) ||
return true;
}
-#endif
+#endif // wxUSE_MDI
void wxMenuBar::Init(size_t n, wxMenu *menus[], const wxString titles[], long style)
{
- // the parent window is known after wxFrame::SetMenu()
- m_needParent = false;
m_style = style;
- m_invokingWindow = (wxWindow*) NULL;
+ m_invokingWindow = NULL;
- if (!PreCreation( (wxWindow*) NULL, wxDefaultPosition, wxDefaultSize ) ||
- !CreateBase( (wxWindow*) NULL, -1, wxDefaultPosition, wxDefaultSize, style, wxDefaultValidator, wxT("menubar") ))
+ if (!PreCreation( NULL, wxDefaultPosition, wxDefaultSize ) ||
+ !CreateBase( NULL, -1, wxDefaultPosition, wxDefaultSize, style, wxDefaultValidator, wxT("menubar") ))
{
wxFAIL_MSG( wxT("wxMenuBar creation failed") );
return;
const wxPoint& pos, const wxSize& size,
long style, const wxString& name )
{
- m_needParent = true;
m_insertCallback = (wxInsertChildFunction)wxInsertChildInNotebook;
if ( (style & wxBK_ALIGN_MASK) == wxBK_DEFAULT )
bool wxPopupWindow::Create( wxWindow *parent, int style )
{
- m_needParent = false;
-
if (!PreCreation( parent, wxDefaultPosition, wxDefaultSize ) ||
!CreateBase( parent, -1, wxDefaultPosition, wxDefaultSize, style, wxDefaultValidator, wxT("popup") ))
{
void wxRadioBox::Init()
{
- m_needParent = true;
-
m_hasFocus =
m_lostFocus = false;
}
const wxValidator& validator,
const wxString& name )
{
- m_needParent = TRUE;
-
- m_blockEvent = FALSE;
+ m_blockEvent = false;
if (!PreCreation( parent, pos, size ) ||
!CreateBase( parent, id, pos, size, style, validator, name ))
{
wxFAIL_MSG( wxT("wxRadioButton creation failed") );
- return FALSE;
+ return false;
}
GSList* radioButtonGroup = NULL;
const wxPoint& pos, const wxSize& size,
long style, const wxValidator& validator, const wxString& name )
{
- m_needParent = true;
-
if (!PreCreation( parent, pos, size ) ||
!CreateBase( parent, id, pos, size, style, validator, name ))
{
m_needThumbRelease = false;
}
-bool wxSlider::Create(wxWindow *parent, wxWindowID id,
- int value, int minValue, int maxValue,
- const wxPoint& pos, const wxSize& size,
- long style, const wxValidator& validator, const wxString& name )
+bool wxSlider::Create(wxWindow *parent,
+ wxWindowID id,
+ int value,
+ int minValue,
+ int maxValue,
+ const wxPoint& pos,
+ const wxSize& size,
+ long style,
+ const wxValidator& validator,
+ const wxString& name)
{
- m_needParent = true;
-
if (!PreCreation( parent, pos, size ) ||
!CreateBase( parent, id, pos, size, style, validator, name ))
{
long style,
const wxString& name)
{
- m_needParent = true;
-
wxSize new_size = size,
sizeBest = DoGetBestSize();
new_size.x = sizeBest.x; // override width always
int min, int max, int initial,
const wxString& name)
{
- m_needParent = true;
-
if (!PreCreation( parent, pos, size ) ||
!CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
{
const wxPoint &pos, const wxSize &size,
long style, const wxString &name )
{
- m_needParent = TRUE;
-
if (!PreCreation( parent, pos, size ) ||
!CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
{
long style,
const wxString& name )
{
- m_needParent = TRUE;
-
if (!PreCreation( parent, pos, size ) ||
!CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
{
wxFAIL_MSG( wxT("wxStaticBox creation failed") );
- return FALSE;
+ return false;
}
m_widget = GTKCreateFrame(label);
const wxPoint &pos, const wxSize &size,
long style, const wxString &name )
{
- m_needParent = TRUE;
-
if (!PreCreation( parent, pos, size ) ||
!CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
{
long style,
const wxString &name )
{
- m_needParent = TRUE;
-
if (!PreCreation( parent, pos, size ) ||
!CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
{
wxFAIL_MSG( wxT("wxStaticText creation failed") );
- return FALSE;
+ return false;
}
m_widget = gtk_label_new(NULL);
long style,
const wxString& name )
{
- m_needParent = true;
m_insertCallback = (wxInsertChildFunction)wxInsertChildInToolBar;
if ( !PreCreation( parent, pos, size ) ||
const wxValidator& validator,
const wxString &name )
{
- m_needParent = true;
-
if (!PreCreation( parent, pos, size ) ||
!CreateBase( parent, id, pos, size, style, validator, name ))
{
const wxValidator& validator,
const wxString &name)
{
- m_needParent = true;
-
m_blockEvent = false;
if (!PreCreation(parent, pos, size) ||
const wxValidator& validator,
const wxString &name)
{
- m_needParent = true;
-
m_blockEvent = false;
if (!PreCreation(parent, pos, size) ||
wxTopLevelWindows.Append( this );
- m_needParent = false;
-
if (!PreCreation( parent, pos, size ) ||
!CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
{
m_sizeSet = false;
m_hasVMT = false;
- m_needParent = true;
m_isBeingDeleted = false;
m_showOnIdle= false;
bool wxWindowGTK::PreCreation( wxWindowGTK *parent, const wxPoint &pos, const wxSize &size )
{
- wxCHECK_MSG( !m_needParent || parent, false, wxT("Need complete parent.") );
+ if ( GTKNeedsParent() )
+ {
+ wxCHECK_MSG( parent, false, wxT("Must have non-NULL parent") );
+ }
// Use either the given size, or the default if -1 is given.
// See wxWindowBase for these functions.