本文整理汇总了C++中CreateBase函数的典型用法代码示例。如果您正苦于以下问题:C++ CreateBase函数的具体用法?C++ CreateBase怎么用?C++ CreateBase使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CreateBase函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Create
// real construction (Init() must have been called before!)
bool wxWindowDFB::Create(wxWindow *parent,
wxWindowID id,
const wxPoint& pos,
const wxSize& size,
long style,
const wxString& name)
{
if ( !m_tlw && parent )
m_tlw = parent->GetTLW();
if ( !CreateBase(parent, id, pos, size, style, wxDefaultValidator, name) )
return false;
if ( parent )
parent->AddChild(this);
// set the size to something bogus initially, in case some code tries to
// create wxWindowDC before SetSize() is called below:
m_rect.width = m_rect.height = 1;
int x, y, w, h;
x = pos.x, y = pos.y;
if ( x == -1 ) x = 0;
if ( y == -1 ) y = 0;
w = WidthDefault(size.x);
h = HeightDefault(size.y);
SetSize(x, y, w, h);
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)
{
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;
}
示例3: 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;
}
示例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)
{
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;
}
示例5: wxT
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;
}
示例6: 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;
}
示例7: 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.IsOk() ? bitmap : wxBitmap(bogus_xpm));
m_widget = gtk_pixmap_new(bmp.GetPixmap(), NULL);
if (bitmap.IsOk())
SetBitmap(bitmap);
PostCreation(size);
m_parent->DoAddChild( this );
return true;
}
示例8: size
bool wxTopLevelWindowQt::Create( wxWindow *parent, wxWindowID winId,
const wxString &title, const wxPoint &pos, const wxSize &sizeOrig,
long style, const wxString &name )
{
wxSize size(sizeOrig);
if ( !size.IsFullySpecified() )
size.SetDefaults( GetDefaultSize() );
wxTopLevelWindows.Append( this );
if (!CreateBase( parent, winId, pos, size, style, wxDefaultValidator, name ))
{
wxFAIL_MSG( wxT("wxTopLevelWindowNative creation failed") );
return false;
}
SetTitle( title );
SetWindowStyleFlag( style );
if (pos != wxDefaultPosition)
m_qtWindow->move( pos.x, pos.y );
m_qtWindow->resize( wxQtConvertSize( size ) );
// Prevent automatic deletion of Qt main window on close
// (this should be the default, but left just fo enforce it)
GetHandle()->setAttribute(Qt::WA_DeleteOnClose, false);
// not calling to wxWindow::Create, so do the rest of initialization:
if (parent) parent->AddChild( this );
return true;
}
示例9: wxCHECK_MSG
// Replaces wxWindow::Create functionality, since we need to use a different
// window class
bool wxGLCanvas::CreateWindow(wxWindow *parent,
wxWindowID id,
const wxPoint& pos,
const wxSize& size,
long style,
const wxString& name)
{
wxCHECK_MSG( parent, false, wxT("can't create wxWindow without parent") );
if ( !CreateBase(parent, id, pos, size, style, wxDefaultValidator, name) )
return false;
parent->AddChild(this);
/*
A general rule with OpenGL and Win32 is that any window that will have a
HGLRC built for it must have two flags: WS_CLIPCHILDREN & WS_CLIPSIBLINGS.
You can find references about this within the knowledge base and most OpenGL
books that contain the wgl function descriptions.
*/
WXDWORD exStyle = 0;
DWORD msflags = WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN;
msflags |= MSWGetStyle(style, &exStyle);
if ( !MSWCreate(wxApp::GetRegisteredClassName(wxT("wxGLCanvas"), -1, CS_OWNDC),
NULL, pos, size, msflags, exStyle) )
return false;
m_hDC = ::GetDC(GetHwnd());
if ( !m_hDC )
return false;
return true;
}
示例10: 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;
}
示例11: 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;
}
示例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: 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);
// gtk_widget_hide_on_delete is used here to avoid that Gtk automatically destroys
// the dialog when the user press ESC on the dialog: in that case a second call to
// ShowModal() would result in a bunch of Gtk-CRITICAL errors...
g_signal_connect (m_widget,
"delete_event",
G_CALLBACK (gtk_widget_hide_on_delete),
(gpointer)this);
// 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;
}
示例14: Create
bool wxRadioButton::Create( wxWindow *parent,
wxWindowID id,
const wxString& label,
const wxPoint& pos,
const wxSize& size,
long style,
const wxValidator& validator,
const wxString& name )
{
m_acceptsFocus = TRUE;
m_needParent = TRUE;
m_blockEvent = FALSE;
if (!PreCreation( parent, pos, size ) ||
!CreateBase( parent, id, pos, size, style, validator, name ))
{
wxFAIL_MSG( wxT("wxRadioButton creation failed") );
return FALSE;
}
GSList* radioButtonGroup = NULL;
if (!HasFlag(wxRB_GROUP))
{
// search backward for last group start
wxRadioButton *chief = NULL;
wxWindowList::compatibility_iterator node = parent->GetChildren().GetLast();
while (node)
{
wxWindow *child = node->GetData();
if (child->IsRadioButton())
{
chief = (wxRadioButton*) child;
if (child->HasFlag(wxRB_GROUP))
break;
}
node = node->GetPrevious();
}
if (chief)
{
// we are part of the group started by chief
radioButtonGroup = gtk_radio_button_group( GTK_RADIO_BUTTON(chief->m_widget) );
}
}
m_widget = gtk_radio_button_new_with_label( radioButtonGroup, wxGTK_CONV( label ) );
SetLabel(label);
gtk_signal_connect( GTK_OBJECT(m_widget), "clicked",
GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this );
m_parent->DoAddChild( this );
PostCreation(size);
return TRUE;
}
示例15: Create
bool wxToolBar::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("wxToolBar creation failed") );
return false;
}
FixupStyle();
m_toolbar = GTK_TOOLBAR( gtk_toolbar_new() );
#if !GTK_CHECK_VERSION(3,0,0) && !defined(GTK_DISABLE_DEPRECATED)
if (gtk_check_version(2, 12, 0))
{
m_tooltips = gtk_tooltips_new();
g_object_ref(m_tooltips);
gtk_object_sink(GTK_OBJECT(m_tooltips));
}
#endif
GtkSetStyle();
if (style & wxTB_DOCKABLE)
{
m_widget = gtk_handle_box_new();
g_signal_connect(m_widget, "child_detached",
G_CALLBACK(child_detached), NULL);
g_signal_connect(m_widget, "child_attached",
G_CALLBACK(child_attached), NULL);
if (style & wxTB_FLAT)
gtk_handle_box_set_shadow_type( GTK_HANDLE_BOX(m_widget), GTK_SHADOW_NONE );
}
else
{
m_widget = gtk_event_box_new();
ConnectWidget( m_widget );
}
g_object_ref(m_widget);
gtk_container_add(GTK_CONTAINER(m_widget), GTK_WIDGET(m_toolbar));
gtk_widget_show(GTK_WIDGET(m_toolbar));
m_parent->DoAddChild( this );
PostCreation(size);
g_signal_connect_after(m_toolbar, "size_request",
G_CALLBACK(size_request), this);
return true;
}