Esempio n. 1
0
void
ScrollBarTest::ActivateTest(View* controls)
{
	// the radio button group for selecting the orientation

	GroupView* vGroup = new GroupView(B_VERTICAL);
	vGroup->SetFrame(controls->Bounds());
	vGroup->SetSpacing(0, 4);
	controls->AddChild(vGroup);

	fOrientationRadioGroup = new RadioButtonGroup(
		new BMessage(MSG_ORIENTATION_CHANGED), this);

	// horizontal
	LabeledRadioButton* button = new OrientationRadioButton("Horizontal",
		B_HORIZONTAL);
	vGroup->AddChild(button);
	fOrientationRadioGroup->AddButton(button->GetRadioButton());

	// vertical
	button = new OrientationRadioButton("Vertical", B_VERTICAL);
	vGroup->AddChild(button);
	fOrientationRadioGroup->AddButton(button->GetRadioButton());

	// default to horizontal
	fOrientationRadioGroup->SelectButton(0L);

	// glue
	vGroup->AddChild(new Glue());
}
Esempio n. 2
0
void RadioButtonController::OnRadioClicked( Gwen::Controls::Base* pFromPanel )
{
	RadioButton* pCheckedRadioButton = pFromPanel->DynamicCastRadioButton();

	//Iterate through all other buttons and set them to false;
	for (Base::List::iterator iter = Children.begin(); iter != Children.end(); ++iter)
	{
		Base* pChild = *iter;
		LabeledRadioButton* pLRB = pChild->DynamicCastLabeledRadioButton();
		if ( pLRB )
		{
			RadioButton* pChildRadioButton = pLRB->GetRadioButton();
			if ( pChildRadioButton == pCheckedRadioButton )
			{
				m_Selected = pLRB;
			}
			else
			{
				pLRB->GetRadioButton()->SetChecked( false );
			}
		}
	}

	OnChange();
}
Esempio n. 3
0
LabeledRadioButton* RadioButtonController::AddOption( const Gwen::UnicodeString& strText, const Gwen::String& strOptionName )
{
	LabeledRadioButton* lrb = new LabeledRadioButton( this );

	lrb->SetName( strOptionName );
	lrb->GetLabel()->SetText( strText );
	lrb->GetRadioButton()->onChecked.Add( this, &RadioButtonController::OnRadioClicked );
	lrb->Dock( Pos::Top );
	lrb->SetMargin( Margin( 0, 1, 0, 1 ) );
	lrb->SetKeyboardInputEnabled( false );
	lrb->SetTabable( false );

	Invalidate();

	return lrb;
}
Esempio n. 4
0
// ActivateTest
void
BoxTest::ActivateTest(View* controls)
{
	// BBox sets its background color to that of its parent in
	// AttachedToWindow(). Override.
	rgb_color background = ui_color(B_PANEL_BACKGROUND_COLOR);
	fBox->SetViewColor(background);
	fBox->SetLowColor(background);

	GroupView* group = new GroupView(B_VERTICAL);
	group->SetFrame(controls->Bounds());
	group->SetSpacing(0, 8);
	controls->AddChild(group);

	// the radio button group for selecting the border style

	fBorderStyleRadioGroup = new RadioButtonGroup(
		new BMessage(MSG_BORDER_STYLE_CHANGED), this);

	// no border
	LabeledRadioButton* button = new BorderStyleRadioButton("no border",
		B_NO_BORDER);
	group->AddChild(button);
	fBorderStyleRadioGroup->AddButton(button->GetRadioButton());

	// plain border
	button = new BorderStyleRadioButton("plain border", B_PLAIN_BORDER);
	group->AddChild(button);
	fBorderStyleRadioGroup->AddButton(button->GetRadioButton());

	// fancy border
	button = new BorderStyleRadioButton("fancy border", B_FANCY_BORDER);
	group->AddChild(button);
	fBorderStyleRadioGroup->AddButton(button->GetRadioButton());

	// default to no border
	fBorderStyleRadioGroup->SelectButton(0L);

	// spacing
	group->AddChild(new VStrut(10));

	// the radio button group for selecting the label

	fLabelRadioGroup = new RadioButtonGroup(new BMessage(MSG_LABEL_CHANGED),
		this);

	// no label
	button = new LabelRadioButton("No label", NULL);
	group->AddChild(button);
	fLabelRadioGroup->AddButton(button->GetRadioButton());

	// label string
	button = new LabelRadioButton("Label string", "");
	group->AddChild(button);
	fLabelRadioGroup->AddButton(button->GetRadioButton());

	// label view
	button = new LabelRadioButton("Label view", NULL, true);
	group->AddChild(button);
	fLabelRadioGroup->AddButton(button->GetRadioButton());

	// default to no border
	fLabelRadioGroup->SelectButton(0L);

	// spacing
	group->AddChild(new VStrut(10));

	// long label
	fLongLabelCheckBox = new LabeledCheckBox("Long label",
		new BMessage(MSG_LONG_LABEL_CHANGED), this);
	group->AddChild(fLongLabelCheckBox);

	// child
	fChildCheckBox = new LabeledCheckBox("Child",
		new BMessage(MSG_CHILD_CHANGED), this);
	group->AddChild(fChildCheckBox);


	// glue
	group->AddChild(new Glue());
}