本文整理汇总了C++中PreCreation函数的典型用法代码示例。如果您正苦于以下问题:C++ PreCreation函数的具体用法?C++ PreCreation怎么用?C++ PreCreation使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PreCreation函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Create
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;
}
示例2: Create
bool wxToggleButton::Create(wxWindow *parent, wxWindowID id,
const wxString &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("wxToggleButton creation failed"));
return false;
}
// Create the gtk widget.
m_widget = gtk_toggle_button_new_with_mnemonic("");
g_object_ref(m_widget);
SetLabel(label);
g_signal_connect (m_widget, "clicked",
G_CALLBACK (gtk_togglebutton_clicked_callback),
this);
m_parent->DoAddChild(this);
PostCreation(size);
return true;
}
示例3: Create
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;
}
示例4: Create
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;
}
示例5: Create
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);
SetBestSize(size);
return TRUE;
}
示例6: Create
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);
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;
}
示例7: Create
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;
}
示例8: Create
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;
}
示例9: CreateClient
bool wxMDIClientWindow::CreateClient( wxMDIParentFrame *parent, long style )
{
m_needParent = true;
m_insertCallback = (wxInsertChildFunction)wxInsertChildInMDI;
if (!PreCreation( parent, wxDefaultPosition, wxDefaultSize ) ||
!CreateBase( parent, wxID_ANY, 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;
}
示例10: 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;
}
示例11: CreateClient
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 (gtk_mdi_page_change_callback), parent);
gtk_notebook_set_scrollable( GTK_NOTEBOOK(m_widget), 1 );
m_parent->DoAddChild( this );
PostCreation();
Show( true );
return true;
}
示例12: WXUNUSED
bool wxDirDialog::Create(wxWindow* parent,
const wxString& title,
const wxString& defaultPath,
long style,
const wxPoint& pos,
const wxSize& WXUNUSED(sz),
const wxString& WXUNUSED(name))
{
m_message = title;
parent = GetParentForModalDialog(parent, style);
if (!PreCreation(parent, pos, wxDefaultSize) ||
!CreateBase(parent, wxID_ANY, pos, wxDefaultSize, style,
wxDefaultValidator, wxT("dirdialog")))
{
wxFAIL_MSG( wxT("wxDirDialog creation failed") );
return false;
}
GtkWindow* gtk_parent = NULL;
if (parent)
gtk_parent = GTK_WINDOW( gtk_widget_get_toplevel(parent->m_widget) );
m_widget = gtk_file_chooser_dialog_new(
wxGTK_CONV(m_message),
gtk_parent,
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
NULL);
g_object_ref(m_widget);
gtk_dialog_set_default_response(GTK_DIALOG(m_widget), GTK_RESPONSE_ACCEPT);
#if GTK_CHECK_VERSION(2,18,0)
#ifndef __WXGTK3__
if (gtk_check_version(2,18,0) == NULL)
#endif
{
gtk_file_chooser_set_create_folders(
GTK_FILE_CHOOSER(m_widget), (style & wxDD_DIR_MUST_EXIST) == 0);
}
#endif
// local-only property could be set to false to allow non-local files to be loaded.
// In that case get/set_uri(s) should be used instead of get/set_filename(s) everywhere
// and the GtkFileChooserDialog should probably also be created with a backend,
// e.g. "gnome-vfs", "default", ... (gtk_file_chooser_dialog_new_with_backend).
// Currently local-only is kept as the default - true:
// gtk_file_chooser_set_local_only(GTK_FILE_CHOOSER(m_widget), true);
g_signal_connect (m_widget, "response",
G_CALLBACK (gtk_dirdialog_response_callback), this);
if ( !defaultPath.empty() )
SetPath(defaultPath);
return true;
}
示例13: DoCreate
bool wxFontDialog::DoCreate(wxWindow *parent)
{
m_needParent = false;
if (!PreCreation( parent, wxDefaultPosition, wxDefaultSize ) ||
!CreateBase( parent, -1, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE,
wxDefaultValidator, wxT("fontdialog") ))
{
wxFAIL_MSG( wxT("wxFontDialog creation failed") );
return false;
}
wxString m_message( _("Choose font") );
m_widget = gtk_font_selection_dialog_new( wxGTK_CONV( m_message ) );
if (parent)
gtk_window_set_transient_for(GTK_WINDOW(m_widget),
GTK_WINDOW(parent->m_widget));
GtkFontSelectionDialog *sel = GTK_FONT_SELECTION_DIALOG(m_widget);
gtk_signal_connect( GTK_OBJECT(sel->ok_button), "clicked",
GTK_SIGNAL_FUNC(gtk_fontdialog_ok_callback), (gpointer*)this );
// strange way to internationalize
gtk_label_set( GTK_LABEL( BUTTON_CHILD(sel->ok_button) ), _("OK") );
gtk_signal_connect( GTK_OBJECT(sel->cancel_button), "clicked",
GTK_SIGNAL_FUNC(gtk_fontdialog_cancel_callback), (gpointer*)this );
// strange way to internationalize
gtk_label_set( GTK_LABEL( BUTTON_CHILD(sel->cancel_button) ), _("Cancel") );
gtk_signal_connect( GTK_OBJECT(m_widget), "delete_event",
GTK_SIGNAL_FUNC(gtk_fontdialog_delete_callback), (gpointer)this );
wxFont font = m_fontData.GetInitialFont();
if( font.IsOk() )
{
const wxNativeFontInfo *info = font.GetNativeFontInfo();
if ( info )
{
const wxString& fontname = info->GetXFontName();
if ( !fontname )
font.GetInternalFont();
gtk_font_selection_dialog_set_font_name(sel, wxGTK_CONV(fontname));
}
else
{
// this is not supposed to happen!
wxFAIL_MSG(wxT("font is ok but no native font info?"));
}
}
return true;
}
示例14: Create
bool wxCheckBox::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("wxCheckBox creation failed") );
return false;
}
wxASSERT_MSG( (style & wxCHK_ALLOW_3RD_STATE_FOR_USER) == 0 ||
(style & wxCHK_3STATE) != 0,
wxT("Using wxCHK_ALLOW_3RD_STATE_FOR_USER")
wxT(" style flag for a 2-state checkbox is useless") );
if ( style & wxALIGN_RIGHT )
{
// VZ: as I don't know a way to create a right aligned checkbox with
// GTK we will create a checkbox without label and a label at the
// left of it
m_widgetCheckbox = gtk_check_button_new();
m_widgetLabel = gtk_label_new("");
gtk_misc_set_alignment(GTK_MISC(m_widgetLabel), 0.0, 0.5);
m_widget = gtk_hbox_new(FALSE, 0);
gtk_box_pack_start(GTK_BOX(m_widget), m_widgetLabel, FALSE, FALSE, 3);
gtk_box_pack_start(GTK_BOX(m_widget), m_widgetCheckbox, FALSE, FALSE, 3);
gtk_widget_show( m_widgetLabel );
gtk_widget_show( m_widgetCheckbox );
}
else
{
m_widgetCheckbox = gtk_check_button_new_with_label("");
m_widgetLabel = GTK_BIN(m_widgetCheckbox)->child;
m_widget = m_widgetCheckbox;
}
SetLabel( label );
g_signal_connect (m_widgetCheckbox, "toggled",
G_CALLBACK (gtk_checkbox_toggled_callback), this);
m_parent->DoAddChild( this );
PostCreation(size);
return true;
}
示例15: PreCreation
bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id,
const wxBitmap& bitmap,
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();
m_bitmaps[State_Normal] =
m_bitmapsOriginal[State_Normal] = bitmap;
m_bitmaps[State_Pressed] =
m_bitmapsOriginal[State_Pressed] = bitmap;
Widget parentWidget = (Widget) parent->GetClientWidget();
/*
* Patch Note (important)
* There is no major reason to put a defaultButtonThickness here.
* Not requesting it give the ability to put wxButton with a spacing
* as small as requested. However, if some button become a DefaultButton,
* other buttons are no more aligned -- This is why we set
* defaultButtonThickness of ALL buttons belonging to the same wxPanel,
* in the ::SetDefaultButton method.
*/
Widget buttonWidget = XtVaCreateManagedWidget ("button",
// Gadget causes problems for default button operation.
#if wxUSE_GADGETS
xmPushButtonGadgetClass, parentWidget,
#else
xmPushButtonWidgetClass, parentWidget,
#endif
// See comment for wxButton::SetDefault
// XmNdefaultButtonShadowThickness, 1,
XmNrecomputeSize, False,
NULL);
m_mainWidget = (WXWidget) buttonWidget;
XtAddCallback (buttonWidget,
XmNactivateCallback, (XtCallbackProc) wxButtonCallback,
(XtPointer) this);
wxSize best = GetBitmapLabel().IsOk() ? GetBestSize() : wxSize(30, 30);
if( size.x != -1 ) best.x = size.x;
if( size.y != -1 ) best.y = size.y;
PostCreation();
OnSetBitmap();
AttachWidget (parent, m_mainWidget, (WXWidget) NULL,
pos.x, pos.y, best.x, best.y);
return true;
}