From: Robert Roebling Date: Mon, 26 Jul 1999 19:03:53 +0000 (+0000) Subject: Next take at radioboxes X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/e9158f7d8b2538bcca2b7e546a39ced77d3ddc4e Next take at radioboxes git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3155 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/samples/scroll/scroll.cpp b/samples/scroll/scroll.cpp index cb167d00ed..8107e5e22c 100644 --- a/samples/scroll/scroll.cpp +++ b/samples/scroll/scroll.cpp @@ -99,6 +99,8 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id, (void) new wxRadioBox( this, -1, "This", wxPoint(10,200), wxDefaultSize, 5, choices, 2, wxRA_SPECIFY_COLS ); + (void) new wxRadioBox( this, -1, "This", wxPoint(10,300), wxDefaultSize, 5, choices, 2, wxRA_SPECIFY_ROWS ); + wxListCtrl *m_listCtrl = new wxListCtrl( this, -1, wxPoint(200, 10), wxSize(180, 120), wxLC_REPORT | wxSUNKEN_BORDER | wxLC_SINGLE_SEL ); diff --git a/src/gtk/radiobox.cpp b/src/gtk/radiobox.cpp index b85671aaa8..e1977ab2a4 100644 --- a/src/gtk/radiobox.cpp +++ b/src/gtk/radiobox.cpp @@ -184,16 +184,29 @@ wxSize wxRadioBox::LayoutItems() wxSize res( 0, 0 ); - if (m_windowStyle & wxRA_HORIZONTAL) + int num_of_cols = 0; + int num_of_rows = 0; + if (HasFlag(wxRA_SPECIFY_COLS)) { - - for (int j = 0; j < m_majorDim; j++) + num_of_cols = m_majorDim; + num_of_rows = num_per_major; + } + else + { + num_of_cols = num_per_major; + num_of_rows = m_majorDim; + } + + if ( HasFlag(wxRA_SPECIFY_COLS) || + (HasFlag(wxRA_SPECIFY_ROWS) && (num_of_cols > 1)) ) + { + for (int j = 0; j < num_of_cols; j++) { y = 15; int max_len = 0; - wxNode *node = m_boxes.Nth( j*num_per_major ); - for (int i1 = 0; i1< num_per_major; i1++) + wxNode *node = m_boxes.Nth( j*num_of_rows ); + for (int i1 = 0; i1< num_of_rows; i1++) { GtkWidget *button = GTK_WIDGET( node->Data() ); GtkLabel *label = GTK_LABEL( GTK_BUTTON(button)->child ); @@ -210,8 +223,8 @@ wxSize wxRadioBox::LayoutItems() // we don't know the max_len before - node = m_boxes.Nth( j*num_per_major ); - for (int i2 = 0; i2< num_per_major; i2++) + node = m_boxes.Nth( j*num_of_rows ); + for (int i2 = 0; i2< num_of_rows; i2++) { GtkWidget *button = GTK_WIDGET( node->Data() ); diff --git a/src/gtk1/radiobox.cpp b/src/gtk1/radiobox.cpp index b85671aaa8..e1977ab2a4 100644 --- a/src/gtk1/radiobox.cpp +++ b/src/gtk1/radiobox.cpp @@ -184,16 +184,29 @@ wxSize wxRadioBox::LayoutItems() wxSize res( 0, 0 ); - if (m_windowStyle & wxRA_HORIZONTAL) + int num_of_cols = 0; + int num_of_rows = 0; + if (HasFlag(wxRA_SPECIFY_COLS)) { - - for (int j = 0; j < m_majorDim; j++) + num_of_cols = m_majorDim; + num_of_rows = num_per_major; + } + else + { + num_of_cols = num_per_major; + num_of_rows = m_majorDim; + } + + if ( HasFlag(wxRA_SPECIFY_COLS) || + (HasFlag(wxRA_SPECIFY_ROWS) && (num_of_cols > 1)) ) + { + for (int j = 0; j < num_of_cols; j++) { y = 15; int max_len = 0; - wxNode *node = m_boxes.Nth( j*num_per_major ); - for (int i1 = 0; i1< num_per_major; i1++) + wxNode *node = m_boxes.Nth( j*num_of_rows ); + for (int i1 = 0; i1< num_of_rows; i1++) { GtkWidget *button = GTK_WIDGET( node->Data() ); GtkLabel *label = GTK_LABEL( GTK_BUTTON(button)->child ); @@ -210,8 +223,8 @@ wxSize wxRadioBox::LayoutItems() // we don't know the max_len before - node = m_boxes.Nth( j*num_per_major ); - for (int i2 = 0; i2< num_per_major; i2++) + node = m_boxes.Nth( j*num_of_rows ); + for (int i2 = 0; i2< num_of_rows; i2++) { GtkWidget *button = GTK_WIDGET( node->Data() );