本文整理汇总了C++中BUTTON_CHILD函数的典型用法代码示例。如果您正苦于以下问题:C++ BUTTON_CHILD函数的具体用法?C++ BUTTON_CHILD怎么用?C++ BUTTON_CHILD使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了BUTTON_CHILD函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: wxT
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;
}
示例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_label("");
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;
if (GTK_IS_MISC(BUTTON_CHILD(m_widget)))
gtk_misc_set_alignment (GTK_MISC (BUTTON_CHILD (m_widget)),
x_alignment, y_alignment);
SetLabel(label);
if (style & wxNO_BORDER)
gtk_button_set_relief( GTK_BUTTON(m_widget), GTK_RELIEF_NONE );
gtk_signal_connect_after( GTK_OBJECT(m_widget), "clicked",
GTK_SIGNAL_FUNC(gtk_button_clicked_callback), (gpointer*)this );
gtk_signal_connect_after( GTK_OBJECT(m_widget), "style_set",
GTK_SIGNAL_FUNC(gtk_button_style_set_callback), (gpointer*) this );
m_parent->DoAddChild( this );
PostCreation(size);
return true;
}
示例3: DoApplyWidgetStyle
void wxBitmapButton::DoApplyWidgetStyle(GtkRcStyle *style)
{
if ( !BUTTON_CHILD(m_widget) )
return;
wxButton::DoApplyWidgetStyle(style);
}
示例4: wxCHECK_RET
void wxButton::SetLabel( const wxString &lbl )
{
wxCHECK_RET( m_widget != NULL, wxT("invalid button") );
wxString label(lbl);
if (label.empty() && wxIsStockID(m_windowId))
label = wxGetStockLabel(m_windowId);
wxControl::SetLabel(label);
#ifdef __WXGTK20__
if (wxIsStockID(m_windowId) && wxIsStockLabel(m_windowId, label))
{
const char *stock = wxGetStockGtkID(m_windowId);
if (stock)
{
gtk_button_set_label(GTK_BUTTON(m_widget), stock);
gtk_button_set_use_stock(GTK_BUTTON(m_widget), TRUE);
return;
}
}
wxString label2 = PrepareLabelMnemonics(label);
gtk_button_set_label(GTK_BUTTON(m_widget), wxGTK_CONV(label2));
gtk_button_set_use_stock(GTK_BUTTON(m_widget), FALSE);
ApplyWidgetStyle( false );
#else
gtk_label_set(GTK_LABEL(BUTTON_CHILD(m_widget)), wxGTK_CONV(GetLabel()));
#endif
}
示例5: wxCHECK_MSG
wxString wxChoice::GetString(unsigned int n) const
{
wxCHECK_MSG( m_widget != NULL, wxEmptyString, wxT("invalid choice") );
GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
unsigned int count = 0;
GList *child = menu_shell->children;
while (child)
{
GtkBin *bin = GTK_BIN( child->data );
if (count == n)
{
GtkLabel *label = NULL;
if (bin->child)
label = GTK_LABEL(bin->child);
if (!label)
label = GTK_LABEL( BUTTON_CHILD(m_widget) );
wxASSERT_MSG( label != NULL , wxT("wxChoice: invalid label") );
return wxString( label->label );
}
child = child->next;
count++;
}
wxFAIL_MSG( wxT("wxChoice: invalid index in GetString()") );
return wxEmptyString;
}
示例6: wxCHECK_RET
void wxChoice::SetString(unsigned int n, const wxString& str )
{
wxCHECK_RET( m_widget != NULL, wxT("invalid choice") );
GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
unsigned int count = 0;
GList *child = menu_shell->children;
while (child)
{
GtkBin *bin = GTK_BIN( child->data );
if (count == n)
{
GtkLabel *label = NULL;
if (bin->child)
label = GTK_LABEL(bin->child);
if (!label)
label = GTK_LABEL( BUTTON_CHILD(m_widget) );
wxASSERT_MSG( label != NULL , wxT("wxChoice: invalid label") );
gtk_label_set_text( label, wxGTK_CONV( str ) );
return;
}
child = child->next;
count++;
}
}
示例7: wxCHECK_MSG
int wxRadioBox::FindString( const wxString &find ) const
{
wxCHECK_MSG( m_widget != NULL, wxNOT_FOUND, wxT("invalid radiobox") );
int count = 0;
wxList::compatibility_iterator node = m_boxes.GetFirst();
while (node)
{
GtkLabel *label = GTK_LABEL( BUTTON_CHILD(node->GetData()) );
#ifdef __WXGTK20__
wxString str( wxGTK_CONV_BACK( gtk_label_get_text(label) ) );
#else
wxString str( label->label );
#endif
if (find == str)
return count;
count++;
node = node->GetNext();
}
return wxNOT_FOUND;
}
示例8: wxCHECK_RET
void wxToggleButton::SetLabel(const wxString& label)
{
wxCHECK_RET(m_widget != NULL, wxT("invalid toggle button"));
wxControl::SetLabel(label);
gtk_label_set(GTK_LABEL(BUTTON_CHILD(m_widget)), wxGTK_CONV( GetLabel() ) );
}
示例9: gtk_widget_set_sensitive
bool wxToggleButton::Enable(bool enable /*=true*/)
{
if (!wxControl::Enable(enable))
return false;
gtk_widget_set_sensitive(BUTTON_CHILD(m_widget), enable);
return true;
}
示例10: WXValidateStyle
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;
WXValidateStyle(&style);
if (!PreCreation( parent, pos, size ) ||
!CreateBase( parent, id, pos, size, style, validator, name ))
{
wxFAIL_MSG( wxT("wxCheckBox creation failed") );
return false;
}
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 = BUTTON_CHILD( m_widgetCheckbox );
m_widget = m_widgetCheckbox;
}
SetLabel( label );
gtk_signal_connect( GTK_OBJECT(m_widgetCheckbox),
"toggled",
GTK_SIGNAL_FUNC(gtk_checkbox_toggled_callback),
(gpointer *)this );
m_parent->DoAddChild( this );
PostCreation(size);
return true;
}
示例11: gtk_widget_set_sensitive
bool wxRadioButton::Enable( bool enable )
{
if ( !wxControl::Enable( enable ) )
return FALSE;
gtk_widget_set_sensitive( BUTTON_CHILD(m_widget), enable );
return TRUE;
}
示例12: wxCHECK_RET
void wxRadioBox::SetString( int item, const wxString& label )
{
wxCHECK_RET( m_widget != NULL, wxT("invalid radiobox") );
wxList::compatibility_iterator node = m_boxes.Item( item );
wxCHECK_RET( node, wxT("radiobox wrong index") );
GtkLabel *g_label = GTK_LABEL( BUTTON_CHILD(node->GetData()) );
gtk_label_set( g_label, wxGTK_CONV( label ) );
}
示例13: wxCHECK_MSG
wxString wxRadioBox::GetString(unsigned int n) const
{
wxCHECK_MSG( m_widget != NULL, wxEmptyString, wxT("invalid radiobox") );
wxList::compatibility_iterator node = m_boxes.Item( n );
wxCHECK_MSG( node, wxEmptyString, wxT("radiobox wrong index") );
GtkLabel *label = GTK_LABEL( BUTTON_CHILD(node->GetData()) );
wxString str( label->label );
return str;
}
示例14: gtk_widget_modify_style
void wxRadioBox::DoApplyWidgetStyle(GtkRcStyle *style)
{
gtk_widget_modify_style( m_widget, style );
wxList::compatibility_iterator node = m_boxes.GetFirst();
while (node)
{
GtkWidget *widget = GTK_WIDGET( node->GetData() );
gtk_widget_modify_style( widget, style );
gtk_widget_modify_style( BUTTON_CHILD(node->GetData()), style );
node = node->GetNext();
}
}
示例15: wxCHECK_RET
void wxButton::SetLabel( const wxString &lbl )
{
wxCHECK_RET( m_widget != NULL, wxT("invalid button") );
wxString label(lbl);
if (label.empty() && wxIsStockID(m_windowId))
label = wxGetStockLabel(m_windowId);
wxControl::SetLabel(label);
const wxString labelGTK = GTKRemoveMnemonics(label);
gtk_label_set(GTK_LABEL(BUTTON_CHILD(m_widget)), wxGTK_CONV(labelGTK));
}