}
else if ( !win->m_hasFocus )
{
- win->m_hasFocus = TRUE;
+ win->m_hasFocus = true;
wxFocusEvent event( wxEVT_SET_FOCUS, win->GetId() );
event.SetEventObject( win );
// we might have lost the focus, but may be not - it may have just gone to
// another button in the same radiobox, so we'll check for it in the next
- // idle iteration (leave m_hasFocus == TRUE for now)
- win->m_lostFocus = TRUE;
+ // idle iteration (leave m_hasFocus == true for now)
+ win->m_lostFocus = true;
return FALSE;
}
void wxRadioBox::Init()
{
- m_needParent = TRUE;
- m_acceptsFocus = TRUE;
+ m_needParent = true;
+ m_acceptsFocus = true;
m_hasFocus =
- m_lostFocus = FALSE;
+ m_lostFocus = false;
}
bool wxRadioBox::Create( wxWindow *parent, wxWindowID id,
!CreateBase( parent, id, pos, size, style, validator, name ))
{
wxFAIL_MSG( wxT("wxRadioBox creation failed") );
- return FALSE;
+ return false;
}
m_widget = gtk_frame_new( wxGTK_CONV( title ) );
if ( wasShown )
Show();
- return TRUE;
+ return true;
}
wxRadioBox::~wxRadioBox()
if (req.width > size.x)
size.x = req.width;
+ CacheBestSize(size);
return size;
}
num_of_cols = num_per_major;
num_of_rows = m_majorDim;
}
-
+
int lineheight = GetCharHeight()+2;
-
+
if ( HasFlag(wxRA_SPECIFY_COLS) ||
(HasFlag(wxRA_SPECIFY_ROWS) && (num_of_cols > 1)) )
{
req.height = 2;
(* GTK_WIDGET_CLASS( GTK_OBJECT_GET_CLASS(button) )->size_request )
(button, &req );
-
+
if (req.width > max_len) max_len = req.width;
if ( !justCalc )
bool wxRadioBox::Show( bool show )
{
- wxCHECK_MSG( m_widget != NULL, FALSE, wxT("invalid radiobox") );
+ wxCHECK_MSG( m_widget != NULL, false, wxT("invalid radiobox") );
if (!wxControl::Show(show))
{
// nothing to do
- return FALSE;
+ return false;
}
if ( HasFlag(wxNO_BORDER) )
node = node->GetNext();
}
- return TRUE;
+ return true;
}
int wxRadioBox::FindString( const wxString &find ) const
wxControl::SetLabel( label );
gtk_frame_set_label( GTK_FRAME(m_widget), wxGTK_CONV( wxControl::GetLabel() ) );
-
- PostSetLabel();
}
void wxRadioBox::SetString( int item, const wxString& label )
bool wxRadioBox::Enable( bool enable )
{
if ( !wxControl::Enable( enable ) )
- return FALSE;
+ return false;
wxList::compatibility_iterator node = m_boxes.GetFirst();
while (node)
node = node->GetNext();
}
- return TRUE;
+ return true;
}
void wxRadioBox::Enable( int item, bool enable )
bool wxRadioBox::SetStringSelection( const wxString &s )
{
- wxCHECK_MSG( m_widget != NULL, FALSE, wxT("invalid radiobox") );
+ wxCHECK_MSG( m_widget != NULL, false, wxT("invalid radiobox") );
int res = FindString( s );
- if (res == -1) return FALSE;
+ if (res == -1) return false;
SetSelection( res );
- return TRUE;
+ return true;
}
int wxRadioBox::GetCount() const
return m_boxes.GetCount();
}
-int wxRadioBox::GetNumberOfRowsOrCols() const
-{
- return 1;
-}
-
-void wxRadioBox::SetNumberOfRowsOrCols( int WXUNUSED(n) )
-{
- wxFAIL_MSG(wxT("wxRadioBox::SetNumberOfRowsOrCols not implemented."));
-}
-
void wxRadioBox::GtkDisableEvents()
{
wxList::compatibility_iterator node = m_boxes.GetFirst();
{
gtk_widget_modify_style( m_widget, style );
+#ifdef __WXGTK20__
+ gtk_widget_modify_style(GTK_FRAME(m_widget)->label_widget, style);
+#endif
+
wxList::compatibility_iterator node = m_boxes.GetFirst();
while (node)
{
bool wxRadioBox::IsOwnGtkWindow( GdkWindow *window )
{
- if (window == m_widget->window) return TRUE;
+ if (window == m_widget->window) return true;
wxList::compatibility_iterator node = m_boxes.GetFirst();
while (node)
{
GtkWidget *button = GTK_WIDGET( node->GetData() );
- if (window == button->window) return TRUE;
+ if (window == button->window) return true;
node = node->GetNext();
}
- return FALSE;
+ return false;
}
void wxRadioBox::OnInternalIdle()
{
if ( m_lostFocus )
{
- m_hasFocus = FALSE;
- m_lostFocus = FALSE;
+ m_hasFocus = false;
+ m_lostFocus = false;
wxFocusEvent event( wxEVT_KILL_FOCUS, GetId() );
event.SetEventObject( this );
wxRadioBox::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
{
wxVisualAttributes attr;
+ // NB: we need toplevel window so that GTK+ can find the right style
+ GtkWidget *wnd = gtk_window_new(GTK_WINDOW_TOPLEVEL);
GtkWidget* widget = gtk_radio_button_new_with_label(NULL, "");
+ gtk_container_add(GTK_CONTAINER(wnd), widget);
attr = GetDefaultAttributesFromGTKWidget(widget);
- gtk_widget_destroy(widget);
+ gtk_widget_destroy(wnd);
return attr;
}
+#if WXWIN_COMPATIBILITY_2_2
+
+int wxRadioBox::Number() const
+{
+ return GetCount();
+}
+
+wxString wxRadioBox::GetLabel(int n) const
+{
+ return GetString(n);
+}
+
+void wxRadioBox::SetLabel( int item, const wxString& label )
+{
+ SetString(item, label);
+}
+
+#endif // WXWIN_COMPATIBILITY_2_2
+
#endif // wxUSE_RADIOBOX