本文整理汇总了C++中PostCreation函数的典型用法代码示例。如果您正苦于以下问题:C++ PostCreation函数的具体用法?C++ PostCreation怎么用?C++ PostCreation使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PostCreation函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: wxFAIL_MSG
bool wxStaticBitmap::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bitmap,
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 ))
{
wxFAIL_MSG( wxT("wxStaticBitmap creation failed") );
return false;
}
m_bitmap = bitmap;
wxBitmap bmp(bitmap.Ok() ? bitmap : wxBitmap(bogus_xpm));
m_widget = gtk_pixmap_new(bmp.GetPixmap(), NULL);
if (bitmap.Ok())
SetBitmap(bitmap);
PostCreation(size);
m_parent->DoAddChild( this );
return true;
}
示例2: wxFAIL_MSG
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;
m_acceptsFocus = true;
if (!PreCreation( parent, pos, size ) ||
!CreateBase( parent, id, pos, size, style, validator, name ))
{
wxFAIL_MSG( wxT("wxButton creation failed") );
return false;
}
m_widget = gtk_button_new_with_mnemonic("");
float x_alignment = 0.5;
if (HasFlag(wxBU_LEFT))
x_alignment = 0.0;
else if (HasFlag(wxBU_RIGHT))
x_alignment = 1.0;
float y_alignment = 0.5;
if (HasFlag(wxBU_TOP))
y_alignment = 0.0;
else if (HasFlag(wxBU_BOTTOM))
y_alignment = 1.0;
#ifdef __WXGTK24__
if (!gtk_check_version(2,4,0))
{
gtk_button_set_alignment(GTK_BUTTON(m_widget), x_alignment, y_alignment);
}
else
#endif
{
if (GTK_IS_MISC(GTK_BIN(m_widget)->child))
gtk_misc_set_alignment(GTK_MISC(GTK_BIN(m_widget)->child),
x_alignment, y_alignment);
}
SetLabel(label);
if (style & wxNO_BORDER)
gtk_button_set_relief( GTK_BUTTON(m_widget), GTK_RELIEF_NONE );
g_signal_connect_after (m_widget, "clicked",
G_CALLBACK (gtk_button_clicked_callback),
this);
g_signal_connect_after (m_widget, "style_set",
G_CALLBACK (gtk_button_style_set_callback),
this);
m_parent->DoAddChild( this );
PostCreation(size);
return true;
}
示例3: wxFAIL_MSG
bool wxColourButton::Create( wxWindow *parent, wxWindowID id,
const wxColour &col,
const wxPoint &pos, const wxSize &size,
long style, const wxValidator& validator,
const wxString &name )
{
if (!PreCreation( parent, pos, size ) ||
!wxControl::CreateBase(parent, id, pos, size, style, validator, name))
{
wxFAIL_MSG( wxT("wxColourButton creation failed") );
return false;
}
m_colour = col;
#ifdef __WXGTK3__
m_widget = gtk_color_button_new_with_rgba(m_colour);
#else
m_widget = gtk_color_button_new_with_color( m_colour.GetColor() );
#endif
g_object_ref(m_widget);
// GtkColourButton signals
g_signal_connect(m_widget, "color-set",
G_CALLBACK(gtk_clrbutton_setcolor_callback), this);
m_parent->DoAddChild( this );
PostCreation(size);
SetInitialSize(size);
return true;
}
示例4: wxT
bool wxMDIClientWindow::CreateClient( wxMDIParentFrame *parent, long style )
{
m_needParent = true;
m_insertCallback = (wxInsertChildFunction)wxInsertChildInMDI;
if (!PreCreation( parent, wxDefaultPosition, wxDefaultSize ) ||
!CreateBase( parent, -1, wxDefaultPosition, wxDefaultSize, style, wxDefaultValidator, wxT("wxMDIClientWindow") ))
{
wxFAIL_MSG( wxT("wxMDIClientWindow creation failed") );
return false;
}
m_widget = gtk_notebook_new();
gtk_signal_connect( GTK_OBJECT(m_widget), "switch_page",
GTK_SIGNAL_FUNC(gtk_mdi_page_change_callback), (gpointer)parent );
gtk_notebook_set_scrollable( GTK_NOTEBOOK(m_widget), 1 );
m_parent->DoAddChild( this );
PostCreation();
Show( true );
return true;
}
示例5: wxFAIL_MSG
bool wxToggleButton::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;
m_acceptsFocus = true;
m_blockEvent = false;
if (!PreCreation(parent, pos, size) ||
!CreateBase(parent, id, pos, size, style, validator, name )) {
wxFAIL_MSG(wxT("wxToggleButton creation failed"));
return false;
}
wxControl::SetLabel(label);
// Create the gtk widget.
m_widget = gtk_toggle_button_new_with_label( wxGTK_CONV( m_label ) );
gtk_signal_connect(GTK_OBJECT(m_widget), "clicked",
GTK_SIGNAL_FUNC(gtk_togglebutton_clicked_callback),
(gpointer *)this);
m_parent->DoAddChild(this);
PostCreation(size);
return true;
}
示例6: wxFAIL_MSG
bool wxChoice::Create( wxWindow *parent, wxWindowID id,
const wxPoint &pos, const wxSize &size,
int n, const wxString choices[],
long style, const wxValidator& validator,
const wxString &name )
{
if (!PreCreation( parent, pos, size ) ||
!CreateBase( parent, id, pos, size, style, validator, name ))
{
wxFAIL_MSG( wxT("wxChoice creation failed") );
return false;
}
if ( IsSorted() )
{
// if our m_strings != NULL, Append() will check for it and insert
// items in the correct order
m_strings = new wxSortedArrayString;
}
m_widget = gtk_combo_box_new_text();
g_object_ref(m_widget);
Append(n, choices);
m_parent->DoAddChild( this );
PostCreation(size);
g_signal_connect_after (m_widget, "changed",
G_CALLBACK (gtk_choice_changed_callback), this);
return true;
}
示例7: PreCreation
// Scrollbar
bool wxScrollBar::Create(wxWindow *parent, wxWindowID id,
const wxPoint& pos,
const wxSize& size, long style,
const wxValidator& validator,
const wxString& name)
{
if( !CreateControl( parent, id, pos, size, style, validator, name ) )
return false;
PreCreation();
wxSize newSize =
( style & wxHORIZONTAL ) ? wxSize( 140, 16 ) : wxSize( 16, 140 );
if( size.x != -1 ) newSize.x = size.x;
if( size.y != -1 ) newSize.y = size.y;
Widget parentWidget = (Widget) parent->GetClientWidget();
m_mainWidget =
DoCreateScrollBar( (WXWidget)parentWidget,
(wxOrientation)(style & (wxHORIZONTAL|wxVERTICAL)),
(void (*)())wxScrollBarCallback );
PostCreation();
AttachWidget (parent, m_mainWidget, (WXWidget) NULL,
pos.x, pos.y, newSize.x, newSize.y);
return true;
}
示例8: wxFAIL_MSG
bool wxDirButton::Create( wxWindow *parent, wxWindowID id,
const wxString &label, const wxString &path,
const wxString &message, const wxString &wildcard,
const wxPoint &pos, const wxSize &size,
long style, const wxValidator& validator,
const wxString &name )
{
if (!(style & wxDIRP_USE_TEXTCTRL))
{
// VERY IMPORTANT: this code is identic to relative code in wxFileButton;
// if you find a problem here, fix it also in wxFileButton !
if (!PreCreation( parent, pos, size ) ||
!wxControl::CreateBase(parent, id, pos, size, style & wxWINDOW_STYLE_MASK,
validator, name))
{
wxFAIL_MSG( wxT("wxDirButtonGTK creation failed") );
return false;
}
// create the dialog associated with this button
SetWindowStyle(style);
m_message = message;
m_wildcard = wildcard;
if ((m_dialog = CreateDialog()) == NULL)
return false;
SetPath(path);
// little trick used to avoid problems when there are other GTK windows 'grabbed':
// GtkFileChooserDialog won't be responsive to user events if there is another
// window which called gtk_grab_add (and this happens if e.g. a wxDialog is running
// in modal mode in the application - see wxDialogGTK::ShowModal).
// An idea could be to put the grab on the m_dialog->m_widget when the GtkFileChooserButton
// is clicked and then remove it as soon as the user closes the dialog itself.
// Unfortunately there's no way to hook in the 'clicked' event of the GtkFileChooserButton,
// thus we add grab on m_dialog->m_widget when it's shown and remove it when it's
// hidden simply using its "show" and "hide" events - clean & simple :)
g_signal_connect(m_dialog->m_widget, "show", G_CALLBACK(gtk_grab_add), NULL);
g_signal_connect(m_dialog->m_widget, "hide", G_CALLBACK(gtk_grab_remove), NULL);
// NOTE: we deliberately ignore the given label as GtkFileChooserButton
// use as label the currently selected file
m_widget = gtk_file_chooser_button_new_with_dialog( m_dialog->m_widget );
g_object_ref(m_widget);
// GtkFileChooserButton signals
g_signal_connect(m_widget, "current-folder-changed",
G_CALLBACK(gtk_dirbutton_currentfolderchanged_callback), this);
m_parent->DoAddChild( this );
PostCreation(size);
SetInitialSize(size);
}
else
return wxGenericDirButton::Create(parent, id, label, path, message, wildcard,
pos, size, style, validator, name);
return true;
}
示例9: wxCHECK_MSG
bool
wxNativeWindow::Create(wxWindow* parent,
wxWindowID winid,
wxNativeWindowHandle widget)
{
wxCHECK_MSG( widget, false, wxS("Invalid null GtkWidget") );
// Standard wxGTK controls use PreCreation() but we never have any size
// specified at this stage, so don't bother with it.
if ( !CreateBase(parent, winid) )
return false;
// Add a reference to the widget to match g_object_unref() in wxWindow dtor.
m_widget = widget;
g_object_ref(m_widget);
parent->DoAddChild(this);
PostCreation();
// Ensure that the best (and minimal) size is set to fully display the
// widget.
GtkRequisition req;
gtk_widget_get_preferred_size(widget, NULL, &req);
SetInitialSize(wxSize(req.width, req.height));
return true;
}
示例10: wxFAIL_MSG
bool wxBitmapToggleButton::Create(wxWindow *parent, wxWindowID id,
const wxBitmap &label, const wxPoint &pos,
const wxSize &size, long style,
const wxValidator& validator,
const wxString &name)
{
if (!PreCreation(parent, pos, size) ||
!CreateBase(parent, id, pos, size, style, validator, name ))
{
wxFAIL_MSG(wxT("wxBitmapToggleButton creation failed"));
return false;
}
// Create the gtk widget.
m_widget = gtk_toggle_button_new();
g_object_ref(m_widget);
if (style & wxNO_BORDER)
gtk_button_set_relief( GTK_BUTTON(m_widget), GTK_RELIEF_NONE );
m_bitmap = label;
OnSetBitmap();
g_signal_connect (m_widget, "clicked",
G_CALLBACK (gtk_togglebutton_clicked_callback),
this);
m_parent->DoAddChild(this);
PostCreation(size);
return true;
}
示例11: wxFAIL_MSG
bool wxMDIClientWindow::CreateClient(wxMDIParentFrame *parent, long style)
{
if ( !PreCreation( parent, wxDefaultPosition, wxDefaultSize ) ||
!CreateBase( parent, wxID_ANY, wxDefaultPosition, wxDefaultSize,
style, wxDefaultValidator, "wxMDIClientWindow" ))
{
wxFAIL_MSG( "wxMDIClientWindow creation failed" );
return false;
}
m_widget = gtk_notebook_new();
g_object_ref(m_widget);
g_signal_connect(m_widget, "switch_page", G_CALLBACK(switch_page), parent);
gtk_notebook_set_scrollable( GTK_NOTEBOOK(m_widget), 1 );
m_parent->DoAddChild( this );
PostCreation();
Show( true );
return true;
}
示例12: PostCreation
void pgDialog::LoadResource(wxWindow *parent, const wxChar *name)
{
if (name)
dlgName = name;
wxXmlResource::Get()->LoadDialog(this, parent, dlgName);
PostCreation();
}
示例13: wxFAIL_MSG
bool wxGauge::Create( wxWindow *parent,
wxWindowID id,
int range,
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 ))
{
wxFAIL_MSG( wxT("wxGauge creation failed") );
return false;
}
m_rangeMax = range;
m_widget = gtk_progress_bar_new();
if ( style & wxGA_VERTICAL )
{
gtk_progress_bar_set_orientation( GTK_PROGRESS_BAR(m_widget),
GTK_PROGRESS_BOTTOM_TO_TOP );
}
m_parent->DoAddChild( this );
PostCreation(size);
SetInitialSize(size);
return true;
}
示例14: wxFAIL_MSG
bool wxSpinButton::Create(wxWindow *parent,
wxWindowID id,
const wxPoint& pos,
const wxSize& size,
long style,
const wxString& name)
{
if (!PreCreation(parent, pos, size) ||
!CreateBase(parent, id, pos, size, style, wxDefaultValidator, name))
{
wxFAIL_MSG( wxT("wxSpinButton creation failed") );
return false;
}
m_pos = 0;
m_widget = gtk_spin_button_new_with_range(0, 100, 1);
g_object_ref(m_widget);
gtk_entry_set_width_chars(GTK_ENTRY(m_widget), 0);
gtk_spin_button_set_wrap( GTK_SPIN_BUTTON(m_widget),
(int)(m_windowStyle & wxSP_WRAP) );
g_signal_connect_after(
m_widget, "value_changed", G_CALLBACK(gtk_value_changed), this);
m_parent->DoAddChild( this );
PostCreation(size);
return true;
}
示例15: wxFAIL_MSG
bool wxAnimationCtrl::Create( wxWindow *parent, wxWindowID id,
const wxAnimation& anim,
const wxPoint& pos,
const wxSize& size,
long style,
const wxString& name)
{
if (!PreCreation( parent, pos, size ) ||
!base_type::CreateBase(parent, id, pos, size, style & wxWINDOW_STYLE_MASK,
wxDefaultValidator, name))
{
wxFAIL_MSG( wxT("wxAnimationCtrl creation failed") );
return false;
}
SetWindowStyle(style);
m_widget = gtk_image_new();
g_object_ref(m_widget);
gtk_widget_show(m_widget);
m_parent->DoAddChild( this );
PostCreation(size);
SetInitialSize(size);
if (anim.IsOk())
SetAnimation(anim);
// init the timer used for animation
m_timer.SetOwner(this);
return true;
}