Next take at radioboxes

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3155 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
1999-07-26 19:03:53 +00:00
parent a62867a56e
commit e9158f7d8b
3 changed files with 42 additions and 14 deletions

View File

@@ -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,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( wxListCtrl *m_listCtrl = new wxListCtrl(
this, -1, wxPoint(200, 10), wxSize(180, 120), this, -1, wxPoint(200, 10), wxSize(180, 120),
wxLC_REPORT | wxSUNKEN_BORDER | wxLC_SINGLE_SEL ); wxLC_REPORT | wxSUNKEN_BORDER | wxLC_SINGLE_SEL );

View File

@@ -184,16 +184,29 @@ wxSize wxRadioBox::LayoutItems()
wxSize res( 0, 0 ); wxSize res( 0, 0 );
if (m_windowStyle & wxRA_HORIZONTAL) int num_of_cols = 0;
int num_of_rows = 0;
if (HasFlag(wxRA_SPECIFY_COLS))
{ {
num_of_cols = m_majorDim;
for (int j = 0; j < m_majorDim; j++) 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; y = 15;
int max_len = 0; int max_len = 0;
wxNode *node = m_boxes.Nth( j*num_per_major ); wxNode *node = m_boxes.Nth( j*num_of_rows );
for (int i1 = 0; i1< num_per_major; i1++) for (int i1 = 0; i1< num_of_rows; i1++)
{ {
GtkWidget *button = GTK_WIDGET( node->Data() ); GtkWidget *button = GTK_WIDGET( node->Data() );
GtkLabel *label = GTK_LABEL( GTK_BUTTON(button)->child ); GtkLabel *label = GTK_LABEL( GTK_BUTTON(button)->child );
@@ -210,8 +223,8 @@ wxSize wxRadioBox::LayoutItems()
// we don't know the max_len before // we don't know the max_len before
node = m_boxes.Nth( j*num_per_major ); node = m_boxes.Nth( j*num_of_rows );
for (int i2 = 0; i2< num_per_major; i2++) for (int i2 = 0; i2< num_of_rows; i2++)
{ {
GtkWidget *button = GTK_WIDGET( node->Data() ); GtkWidget *button = GTK_WIDGET( node->Data() );

View File

@@ -184,16 +184,29 @@ wxSize wxRadioBox::LayoutItems()
wxSize res( 0, 0 ); wxSize res( 0, 0 );
if (m_windowStyle & wxRA_HORIZONTAL) int num_of_cols = 0;
int num_of_rows = 0;
if (HasFlag(wxRA_SPECIFY_COLS))
{ {
num_of_cols = m_majorDim;
for (int j = 0; j < m_majorDim; j++) 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; y = 15;
int max_len = 0; int max_len = 0;
wxNode *node = m_boxes.Nth( j*num_per_major ); wxNode *node = m_boxes.Nth( j*num_of_rows );
for (int i1 = 0; i1< num_per_major; i1++) for (int i1 = 0; i1< num_of_rows; i1++)
{ {
GtkWidget *button = GTK_WIDGET( node->Data() ); GtkWidget *button = GTK_WIDGET( node->Data() );
GtkLabel *label = GTK_LABEL( GTK_BUTTON(button)->child ); GtkLabel *label = GTK_LABEL( GTK_BUTTON(button)->child );
@@ -210,8 +223,8 @@ wxSize wxRadioBox::LayoutItems()
// we don't know the max_len before // we don't know the max_len before
node = m_boxes.Nth( j*num_per_major ); node = m_boxes.Nth( j*num_of_rows );
for (int i2 = 0; i2< num_per_major; i2++) for (int i2 = 0; i2< num_of_rows; i2++)
{ {
GtkWidget *button = GTK_WIDGET( node->Data() ); GtkWidget *button = GTK_WIDGET( node->Data() );