Example #1
0
 void SharedStateButton::createButtonGroup(ButtonGroup group)
 {
     for (ButtonGroup::iterator it = group.begin(); it != group.end(); ++it)
     {
         (*it)->shareStateWith(group);
     }
 }
Example #2
0
 void SharedStateButton::shutdownOverride()
 {
     ButtonGroup group = mSharedWith; // make a copy so that we don't nuke the vector during iteration
     for (ButtonGroup::iterator it = group.begin(); it != group.end(); ++it)
     {
         (*it)->shareStateWith(ButtonGroup());
     }
 }
Example #3
0
//--------- Begin of static function detect_nation_info ---------//
//
static void detect_nation_info()
{
	int nationRecno = nation_filter(browse_nation.recno());

	Nation* viewingNation = nation_array[info.viewing_nation_recno];

	if( button_allow_attack.detect() >= 0 )
		viewingNation->set_relation_should_attack(nationRecno, button_allow_attack.button_pressed, COMMAND_PLAYER);
}
Example #4
0
//------- Begin of function Crime::deinit ---------------//
//!
void Crime::deinit() {
    crime_index.deinit();
    financial_spinner_budget1.deinit();
    financial_button_group.deinit_buttons();

    for( int i = 0; i < 3; ++i ) {
	if( financial_button_up_bitmap[i] ) {
	    mem_del(financial_button_up_bitmap[i]);
	    financial_button_up_bitmap[i] = NULL;
	}
	if( financial_button_down_bitmap[i] ) {
	    mem_del(financial_button_down_bitmap[i]);
	    financial_button_down_bitmap[i] = NULL;
	}
    }
    crime_init_flag = 0;
}
Example #5
0
// ----- begin of function ScenarioEditor::detect_monster_main ------//
//
void ScenarioEditor::detect_monster_main()
{
	// detect interface area
	int rc;

	if (!spinner_race_group.vbrowse_enable_flag)
	{
		rc = button_unit_or_struct.detect();
		if( rc >= 0 )
			unit_or_struct = rc;

		rc = button_player_recno.detect();
		if( rc >= 0 )
			brush_player_recno = rc;

		if( !unit_or_struct )
		{
			rc = vbrowse_unit_id.detect();
			// ###### begin gilbert 22/2 ########//
			//if( rc > 0 )
			//	monster_unit_id_browse_recno = rc;
			monster_unit_id_browse_recno = vbrowse_unit_id.recno();
			// ###### end gilbert 22/2 ########//
		}
		else
		{
			rc = vbrowse_firm_build.detect();
			// ###### begin Gilbert 22/2 #########//
			// if( rc > 0 )
			//		monster_firm_group_browse_recno = rc;
			monster_firm_group_browse_recno = vbrowse_firm_build.recno();
			// ###### end Gilbert 22/2 #########//
		}
	}

	//	rc = button_race_group.detect();
	rc = spinner_race_group.detect();
	if( rc >= 0 )
	{
		monster_race_filter = -rc;
		return;
	}
}
Example #6
0
//--------- Begin of function FirmHarbor::put_det ---------//
//
void FirmHarbor::put_det(int refreshFlag)
{
	if( refreshFlag == INFO_REPAINT )
		vga_util.d3_panel_up( SHIP_DET_X1, SHIP_DET_Y1, SHIP_DET_X2, SHIP_DET_Y2 );
	else
		vga_util.blt_buf( SHIP_DET_X1, SHIP_DET_Y1, SHIP_DET_X2, SHIP_DET_Y2, 0 );

	if( browse_ship.none_record )
		return;

	refreshFlag = INFO_REPAINT;		// for calling disp_ship_units() and disp_ship_goods()

	//------- display info of the ship --------//

	UnitMarine* shipUnitPtr  = (UnitMarine*) unit_array[ ship_recno_array[browse_ship.recno()-1] ];
	UnitInfo*   shipUnitInfo = unit_res[shipUnitPtr->unit_id];

	//----- if the ship can carry both goods and units, display mode selection button ---//

	if( shipUnitInfo->carry_goods_capacity > 0 &&
		 shipUnitInfo->carry_unit_capacity > 0 )
	{
		button_mode[0].create_text( SHIP_DET_X1+10, SHIP_DET_Y1+3, SHIP_DET_X1+80, SHIP_DET_Y1+19, "Units" );
		button_mode[1].create_text( SHIP_DET_X1+90, SHIP_DET_Y1+3, SHIP_DET_X2-10, SHIP_DET_Y1+19, "Goods" );
		button_mode.paint(ship_disp_mode);

		if( ship_disp_mode == SHIP_MENU_UNIT )
			disp_ship_units(shipUnitPtr, SHIP_DET_Y1+22, refreshFlag);
		else
			disp_ship_goods(shipUnitPtr, SHIP_DET_Y1+22, refreshFlag);
	}
	else if( shipUnitInfo->carry_goods_capacity > 0 )
	{
		disp_ship_goods(shipUnitPtr, SHIP_DET_Y1+22, refreshFlag);
	}
	else if( shipUnitInfo->carry_unit_capacity > 0 )
	{
		disp_ship_units(shipUnitPtr, SHIP_DET_Y1+22, refreshFlag);
	}
}
Example #7
0
//--------- Begin of function FirmHarbor::detect_det ---------//
//
int FirmHarbor::detect_det()
{
	if( browse_ship.none_record )
		return 0;

	UnitMarine* shipUnitPtr  = (UnitMarine*) unit_array[ ship_recno_array[browse_ship.recno()-1] ];
	UnitInfo*   shipUnitInfo = unit_res[shipUnitPtr->unit_id];

	if( shipUnitInfo->carry_goods_capacity > 0 &&
		 shipUnitInfo->carry_unit_capacity > 0 )
	{
		if( button_mode.detect() >= 0 )
		{
			ship_disp_mode = button_mode.button_pressed;
			vga_util.blt_buf( SHIP_DET_X1, SHIP_DET_Y1+22, SHIP_DET_X2, SHIP_DET_Y2, 0 );
			put_det(INFO_UPDATE);
			return 1;
		}
	}

	return 0;
}
Example #8
0
// ----- begin of function ScenarioEditor::disp_monster_main ------//
//
void ScenarioEditor::disp_monster_main(int refreshFlag)
{
	String str;

	// unit or structure button group

	button_unit_or_struct[0].create_text( INFO_X1+15, INFO_Y1+5, INFO_X1+110, INFO_Y1+25,
		text_editor.str_unit(), 0 ); // "Unit", 0 );
	button_unit_or_struct[1].create_text( INFO_X1+115, INFO_Y1+5, INFO_X1+210, INFO_Y1+25,
		text_editor.str_structure(), 0 ); //"Structure", 0 );

	font_zoom.put( INFO_X1+10, INFO_Y2-28, text_editor.str_double_left_add(), 0, INFO_X2-5);
	font_zoom.put( INFO_X1+10, INFO_Y2-14, text_editor.str_double_right_del(), 0, INFO_X2-5);

	button_unit_or_struct.paint(unit_or_struct);

	{
		// player number button group

		for( int nationRecno = 0; nationRecno <= MAX_NATION; ++nationRecno )
		{
			button_player_recno[nationRecno].create( INFO_X1+16+nationRecno*25, INFO_Y1+30,
				INFO_X1+16+(nationRecno+1)*25-2, INFO_Y1+57, i_disp_nation_button,
				ButtonCustomPara(NULL, nationRecno), 0 );
			button_player_recno[nationRecno].visible_flag = 
				button_player_recno[nationRecno].enable_flag =
				!nationRecno || !nation_array.is_deleted(nationRecno);		// nation 0 always enable
		}
	}

	if( brush_player_recno && nation_array.is_deleted(brush_player_recno) )
	{
		brush_player_recno = 0;			// set to nation 0 if that nation is deleted
	}
	button_player_recno.paint(brush_player_recno);

	// display browser

	collect_monster_unit(monster_race_filter);
	collect_monster_firm(monster_race_filter);

	// display browser 

	if( !unit_or_struct )
	{
		// init unit browser
		vbrowse_unit_id.init( INFO_X1+5, INFO_Y1+80, INFO_X2-5, INFO_Y2-30,
			-1, 20, monster_unit_id_count, disp_monster_unit_id );
		vbrowse_unit_id.open(monster_unit_id_browse_recno);
		browse_unit_width = vbrowse_unit_id.ix2 - vbrowse_unit_id.ix1 + 1;
		vbrowse_unit_id.paint();
		vbrowse_unit_id.refresh();
	}
	else
	{
		// init firm browser
		vbrowse_firm_build.init( INFO_X1+5, INFO_Y1+80, INFO_X2-5, INFO_Y2-30,
			-1, 20, monster_firm_group_count, disp_monster_firm_group );
		vbrowse_firm_build.open(monster_firm_group_browse_recno);
		browse_firm_width = vbrowse_firm_build.ix2 - vbrowse_firm_build.ix1 + 1;
		vbrowse_firm_build.paint();
		vbrowse_firm_build.refresh();
	}

	// init race filter button

//	int raceLength = ((INFO_X2-4) - (INFO_X1+5) + 1) / (1+MAX_MONSTER_TYPE);
//	char raceAbbr[2] = " ";
//	for( int r = 0; r <= MAX_MONSTER_TYPE; ++r )
//	{
//		if( r > 0 ) 
//			raceAbbr[0] = monster_res[r]->name[0];
//		button_race_group[r].create_text( INFO_X1+5+r*raceLength, INFO_Y1+58,
//			INFO_X1+5+(r+1)*raceLength-1, INFO_Y1+78, raceAbbr );
//	}
	spinner_race_group.create( INFO_X1+80, INFO_Y1+58, INFO_X1+210, INFO_Y1+78, 200,//146,
		0, 1+MAX_MONSTER_TYPE, i_disp_race_spinner, -monster_race_filter );
	// button_race_group.paint(-monster_race_filter);
	spinner_race_group.paint(-monster_race_filter);

}
Example #9
0
	foreach (const ButtonGroup& group, m_buttongroups)
	{
		log.debug("loadSettings: %1 = %2", group.optionname(), settings.value(group.optionname()).toString());
		group.setValue(settings.value(group.optionname(), group.defaultValue()).toString());
	}
Example #10
0
//--------- Begin of static function disp_nation_info ---------//
//
static void disp_nation_info()
{
	vga.d3_panel_down( REPORT_DET_X1, REPORT_DET_Y1, REPORT_DET_X2, REPORT_DET_Y2 );

	//----------- display info ------------//

	int	  nationRecno  = nation_filter(browse_nation.recno());
	Nation* nationPtr    = nation_array[nationRecno];
	Nation* viewingNation = nation_array[info.viewing_nation_recno];
	NationRelation* nationRelation = viewingNation->get_relation(nationRecno);

	int x1=REPORT_DET_X1+6, x2=REPORT_DET_X1+340, x3=REPORT_DET_X2-10;
	int y=REPORT_DET_Y1+6;

	//-------- display economic data ----------//

	String str;

	if( nationRecno == info.viewing_nation_recno )
	{
		font_san.put_field( x1, y, "Your Food", x2, nationPtr->food_str() );

		str  = "$";
		str += nationPtr->cash_str();

		font_san.put_field( x1, y+=16, "Your Treasure", x2, str );

		font_san.field( x1, y+=16, "Your Continuous Peace Time", x2, nationPtr->peace_duration_str(), x3, INFO_REPAINT, "PEACE" );
	}
	else
	{
		str  = translate.process("Your Yearly Import from ");
		str += nationPtr->nation_name();

		font_san.field( x1, y    , str, x2, (int) viewingNation->get_relation(nationRecno)->import_365days(IMPORT_TOTAL), 2, x3, INFO_REPAINT, "IMPORT" );

		str  = translate.process("Your Yearly Export to ");
		str += nationPtr->nation_name();

		font_san.field( x1, y+=16, str, x2, (int) nationPtr->get_relation(info.viewing_nation_recno)->import_365days(IMPORT_TOTAL), 2, x3, INFO_REPAINT, "EXPORT" );

		str  = translate.process("Continuous Peace Time of ");
		str += nationPtr->nation_name();

		font_san.field( x1, y+=16, str, x2, nationPtr->peace_duration_str(), x3, INFO_REPAINT, "PEACE" );

		//--------- duration of current status ----------//

#if(defined(SPANISH))
		str  = "Duración del estado de ";
		str += translate.process(nationRelation->status_str());
#elif(defined(FRENCH))
		str  = "Duration of ";
		str += nationRelation->status_str();
		str += " Status";
		str  = translate.process(str);
#else
		// GERMAN and US
		str  = translate.process("Duration of ");
		str += translate.process(nationRelation->status_str());
		str += " Status";
#endif

		font_san.field( x1, y+=16, str, x2, nationRelation->status_duration_str(), x3, INFO_REPAINT, "STATTIME" );

		//------- display the allow_attack field --------//

		#if(defined(SPANISH))
			// str  = "Permitir que tus Unidades ataquen al ";
			str  = "Permitir atacar al ";
			str += nationPtr->nation_name();
		#elif(defined(FRENCH))
			str  = "Autoriser attaque contre le ";
			str += nationPtr->nation_name();
		#elif(defined(GERMAN))
			str  = "Angriffe auf ";
			str += nationPtr->nation_name();
			str += " erlauben";
		#else
			str  = "Allow Your Units to Attack ";
			str += nationPtr->nation_name();
		#endif

		font_san.field( x1, y+=16, str, x2, "", x3, INFO_REPAINT, "ALLOWATK" );

		button_allow_attack[1].create_text( x2+6 , y, x2+50 , y+15, "Yes" );
		button_allow_attack[0].create_text( x2+54, y, x2+100, y+15, "No"  );

		button_allow_attack.paint( viewingNation->get_relation(nationRecno)->should_attack );

		//---- if this nation is our ally, display its cash and food ----//

		if( viewingNation->get_relation(nationRecno)->status == NATION_ALLIANCE )
		{
#if(defined(SPANISH))
			str  = "Tesoro del ";
			str += nationPtr->nation_name();
#elif(defined(FRENCH))
			str  = "Trésor du ";
			str += nationPtr->nation_name();
#else
			// GERMAN and US
			str  = nationPtr->nation_name();
			str += " 's Treasure";
#endif

			font_san.field( x1, y+=16, str, x2, nationPtr->cash, 2, x3, INFO_REPAINT );

#if(defined(SPANISH))
			str = "Alimentos del ";
			str += nationPtr->nation_name();
#elif(defined(FRENCH))
			str = "Réserves de nourriture du ";
			str += nationPtr->nation_name();
#else
			// GERMAN and US
			str  = nationPtr->nation_name();
			str += " 's Food";
#endif

			font_san.field( x1, y+=16, str, x2, nationPtr->food, 2, x3, INFO_REPAINT );
		}
	}

	y+=26;

	//----- display its relation status with other nations -----//

	if( info.viewing_nation_recno != nationRecno )
	{
		String str;

#if(defined(SPANISH))
		str  = "Estado Diplomático del ";
		str += nationPtr->nation_name();
		str += " con otros Reinos:";
#elif(defined(FRENCH))
		str  = "Relations diplomatiques de ";
		str += nationPtr->nation_name();
		str += " avec les autres royaumes:";
#else
		// GERMAN and US
		str  = nationPtr->nation_name();
		str += "'s ";
		str += translate.process( "Diplomatic Status with Other Kingdoms:" );
#endif

		nationPtr->disp_nation_color(x1, y+1);
		font_san.put(x1+20, y, str);
		y+=20;

		for( int i=1 ; i<=nation_array.size() ; i++ )
		{
			if( nation_array.is_deleted(i) ||
				 i == nationRecno ||
				 i == info.viewing_nation_recno )
			{
				continue;
			}

			nation_array[i]->disp_nation_color(x1, y+1);

			font_san.put( x1+20, y, nation_array[i]->nation_name() );
			font_san.put( x1+240, y, nationPtr->get_relation(i)->status_str() );

			if( nationPtr->get_relation(i)->trade_treaty )
			{
				font_san.put( x1+330, y, "Trade Treaty" );
#if(defined(FRENCH))
				font_san.put( x1+460, y, m.format((int)nationPtr->total_year_trade(i),2) );
#else
				// German and US
				font_san.put( x1+450, y, m.format((int)nationPtr->total_year_trade(i),2) );
#endif
			}

			if( config.show_ai_info )
			{
				font_san.put( x1+500, y, nationPtr->get_relation(i)->ai_relation_level );
				font_san.put( x1+530, y, (int) nationPtr->get_relation(i)->good_relation_duration_rating );
			}

			y+=16;
		}
	}
}
Example #11
0
WidgetsDemo::WidgetsDemo(int argc, char* argv[])
        : Application(&argc, &argv, (AppOptions) (OptDaleAuto | OptSound))
{
    setMargins(5, 5, 5, 5);
    setLayout(new VBoxLayout());

    // ToolBar
    ToolBar* bar = new ToolBar();
    bar->addWidget(new Label("ilixi_widgets"));
    bar->addWidget(new Spacer(Horizontal));
    ToolBarButton* barButton = new ToolBarButton("Quit");
    barButton->setIcon(StyleHint::Cross);
    barButton->sigClicked.connect(sigc::ptr_fun(WidgetsDemo::quit));
    bar->addWidget(barButton);
    setToolbar(bar);

    // TabPanel
    TabPanel* tab = new TabPanel();
//    tab->surface()->setSurfaceFlag(Surface::SubSurface);
//    tab->surface()->unsetSurfaceFlag(Surface::SharedSurface);
    addWidget(tab);

    // Buttons Tab
    VBoxLayout* vBox = new VBoxLayout();
    tab->addTab(vBox, "Tab 1");

    // Label
    vBox->addWidget(createLabelGroup());
    vBox->addWidget(new LineSeperator());

    // CheckBox and RadioButton
    HBoxLayout* box1 = new HBoxLayout();
    box1->addWidget(createCheckGroup());
    box1->addWidget(createRadioGroup());
    vBox->addWidget(box1);
    vBox->addWidget(new LineSeperator());

    // PushButton
    vBox->addWidget(createPBGroup());
    vBox->addWidget(new LineSeperator());

    // ToolButton
    vBox->addWidget(createTBGroup());
    vBox->addWidget(new LineSeperator());

    // ButtonGroup
    DirectionalButton* db1 = new DirectionalButton("Left");
    DirectionalButton* db2 = new DirectionalButton("1");
    DirectionalButton* db3 = new DirectionalButton("2");
    DirectionalButton* db4 = new DirectionalButton("3");
    DirectionalButton* db5 = new DirectionalButton("Right");

    ButtonGroup* bg = new ButtonGroup(Horizontal);
    bg->addButton(db1);
    bg->addButton(db2);
    bg->addButton(db3);
    bg->addButton(db4);
    bg->addButton(db5);
    vBox->addWidget(bg);

    vBox->addWidget(new Spacer(Vertical));

    // Disabled
    VBoxLayout* vBox4 = new VBoxLayout();
    tab->addTab(vBox4, "Tab 2");
    tab->setTabEnabled(1, false);

    // LineInput Tab
    VBoxLayout* vBox2 = new VBoxLayout();
    tab->addTab(vBox2, "Tab 3");

    LineInput *li1 = new LineInput("123...");
    li1->sigTextEntered.connect(sigc::mem_fun(this, &WidgetsDemo::print));
    vBox2->addWidget(li1);
    vBox2->addWidget(new Spacer(Vertical));

    LineInput *li2 = new LineInput("Line input has some text...");
    vBox2->addWidget(li2);
    vBox2->addWidget(new Spacer(Vertical));

    LineInput *li3 = new LineInput("Line input has some text...");
    vBox2->addWidget(li3);
    vBox2->addWidget(new Spacer(Vertical));

    LineInput *li4 = new LineInput("Line input has some text...");
    vBox2->addWidget(li4);
    li4->setDisabled();
    vBox2->addWidget(new Spacer(Vertical));

    LineInput *li5 = new LineInput("Line input has some text...");
    vBox2->addWidget(li5);

    VBoxLayout* vBox3 = new VBoxLayout();
    tab->addTab(vBox3, "Tab 4");

    ProgressBar* bar1 = new ProgressBar();
    bar1->setValue(5);
    vBox3->addWidget(bar1);

    ProgressBar* bar1d = new ProgressBar();
    bar1d->setValue(5);
    bar1d->setDisabled();
    vBox3->addWidget(bar1d);

    Slider* slider1 = new Slider();
    slider1->sigValueChanged.connect(sigc::mem_fun(bar1, &ProgressBar::setValue));
    vBox3->addWidget(slider1);

    Slider* slider11 = new Slider();
    slider11->setValue(48);
    slider11->setDisabled();
    vBox3->addWidget(slider11);

    Slider* slider2 = new Slider();
    slider2->setInverted(true);
    slider2->sigValueChanged.connect(sigc::mem_fun(bar1, &ProgressBar::setValue));
    vBox3->addWidget(slider2);

    ScrollBar* sb1 = new ScrollBar(Horizontal);
    sb1->setRange(0, 10);
    vBox3->addWidget(sb1);

    ScrollBar* sb12 = new ScrollBar(Horizontal);
    sb12->setDisabled();
    sb12->setRange(0, 10);
    sb12->setValue(5);
    vBox3->addWidget(sb12);

    // Verticals
    HBoxLayout* vSliderLayout = new HBoxLayout();
    vBox3->addWidget(vSliderLayout);

    ProgressBar* bar2 = new ProgressBar();
    bar2->setValue(5);
    bar2->setOrientation(Vertical);
    vSliderLayout->addWidget(bar2);

    Slider* slider3 = new Slider();
    slider3->setOrientation(Vertical);
    slider3->sigValueChanged.connect(sigc::mem_fun(bar2, &ProgressBar::setValue));
    vSliderLayout->addWidget(slider3);

    Slider* slider4 = new Slider();
    slider4->setOrientation(Vertical);
    slider4->setInverted(true);
    slider4->sigValueChanged.connect(sigc::mem_fun(bar2, &ProgressBar::setValue));
    vSliderLayout->addWidget(slider4);

    ScrollBar* sb2 = new ScrollBar(Vertical);
    sb2->setRange(0, 10);
    vSliderLayout->addWidget(sb2);

    ComboBox::StringList list;

    char str[5];
    for (int i = 2005; i > 1900; --i)
    {
        sprintf(str, "%d", i);
        list.push_back(str);
    }

    ComboBox* co1 = new ComboBox("Select your date of birth:");
    co1->addItems(list);
    vBox3->addWidget(co1);

    SpinBox* spin1 = new SpinBox(5);
    vBox3->addWidget(spin1);


}
Example #12
0
int main(int argc, char * argv[])
{
  Font *font(FontFactory::create(
        (unsigned char*)_binary_sans_set_bin_start,
        (unsigned char*)_binary_sans_map_bin_start));
  TextAreaFactory::setFont(font);
  //TextAreaFactory::usePaletteData((const char*)_binary_vera_pal_bin_start, 32);
  Keyboard * keyBoard = new Keyboard();
  ScrollPane scrollPane;
  keyBoard->setTopLevel(&scrollPane);
#if 1
  TextField * tf = new TextField("Enter the value here. This line is too big to fit in");
  TextField * passwd = new TextField(std::string());
  RichTextArea * rich = (RichTextArea*)TextAreaFactory::create(TextAreaFactory::TXT_RICH);
  Button * goBtn = new Button("Go");
  rich->appendText("This is some long text ");
  passwd->setSize(60,18);
  
  scrollPane.setTopLevel();
  scrollPane.add(rich);
  scrollPane.add(passwd);
  scrollPane.add(goBtn);
  scrollPane.setSize(Canvas::instance().width(),Canvas::instance().height());
  scrollPane.add(tf);
  scrollPane.setScrollIncrement(13);

#else
  RichTextArea * rich = (RichTextArea*)TextAreaFactory::create(TextAreaFactory::TXT_RICH);
  TextArea * t = TextAreaFactory::create();
  EditableTextArea * t2 = (EditableTextArea*)TextAreaFactory::create(TextAreaFactory::TXT_EDIT);
  // t2->setBackgroundColor(Color(31,31,0));

  
  ScrollPane * subPane = new ScrollPane;
  subPane->add(t2);
  subPane->setTopLevel(false);
  subPane->setSize(Canvas::instance().width(),Canvas::instance().height());
  subPane->setScrollIncrement(t2->font().height());
  subPane->setStretchChildren(true);
  
  
  ComboBox * emptyCombo = new ComboBox();
  ComboBox * oneValCombo = new ComboBox();
  ComboBox * combo = new ComboBox();
  combo->setSize(60, 18);
  ComboBox * combo2 = new ComboBox();
  combo2->setSize(90, 18);
  
  std::string str("Hello World");
  Button * b1 = new Button(str);

  str = "Combo box!";
  oneValCombo->addItem(str);
  combo->addItem(str);
  combo2->addItem(str);
  combo2->addItem(str);
  str = "Another One - with very wide text";
  Button * b2 = new Button(str);
  combo->addItem(str);
  combo2->addItem(str);
  combo2->addItem(str);
  str = "Three- wide, but fixed width";
  Button * b3 = new Button(str);
  b3->setSize(60, 18);
  combo2->addItem(str);
  combo2->addItem(str);
  str = "Go";
  Button * b4 = new Button(str);
  //b4->setSize(6*13, 10);
  str = "Last one!";
  Button * b5 = new Button(str);
  combo->addItem(str);
  combo2->addItem(str);
  combo2->addItem(str);

  t2->setListener(keyBoard);
  
  str = "A text field that has a very, very long and pointless string";
  TextField * tf1 = new TextField(str);
  tf1->setSize(160, 18);
  tf1->setListener(keyBoard);
  combo2->addItem(str);

  TextArea * rbLabel = TextAreaFactory::create();
  str = "Radio button label.";
  rbLabel->appendText(str);

  TextArea * cbLabel = TextAreaFactory::create();
  str = "CheckBox label.";
  cbLabel->appendText(str);

  RadioButton * rb = new RadioButton();
  RadioButton * rb2 = new RadioButton();
  RadioButton * rb3 = new RadioButton();
  CheckBox * cb = new CheckBox();
  ButtonGroup bg;
  bg.add(rb);
  bg.add(rb2);
  bg.add(rb3);
  keyBoard->setTopLevel(&scrollPane);
  scrollPane.setTopLevel();
  scrollPane.add(rich);
  scrollPane.add(t);
  scrollPane.add(b1);
  scrollPane.add(b2);
 
  scrollPane.add(b3);
  scrollPane.add(tf1);
  scrollPane.add(b4);
  scrollPane.add(emptyCombo);
  scrollPane.add(oneValCombo);
  scrollPane.add(combo2);
  scrollPane.add(rb);
  scrollPane.add(rb2);
  scrollPane.add(rb3);
  scrollPane.add(rbLabel);
  scrollPane.add(cb);
  scrollPane.add(cbLabel);
  scrollPane.add(subPane);
  scrollPane.add(combo);
  scrollPane.add(b5);
  
  scrollPane.setSize(Canvas::instance().width(),Canvas::instance().height());
  scrollPane.setScrollIncrement(t->font().height());

  std::string richText1("This is normal text. ");
  std::string richText2("This is a link.");
  std::string richText3("Longer text, but still normal. ");
  std::string richText4("Normal text. ");
  std::string richText5("Link text. ");
  rich->appendText(richText1);
  rich->insertNewline();
  rich->appendText(richText1);
  rich->appendText(richText1);
  rich->appendText(richText3);
  rich->appendText(richText4);
  rich->addLink("www.link1.com");
  rich->appendText(richText2);
  rich->endLink();
  rich->appendText(richText3);
  rich->appendText(richText1);
  rich->addLink("www.link2.com");
  rich->appendText(richText5);
  rich->endLink();


  std::string s(_binary_test_map_bin_start, 1000);
  t->appendText(s);
  std::string s2(&_binary_test_map_bin_start[1200], 1300);
  t2->appendText(s2);
  subPane->setSize(t2->width(), 100);
  t2->setParentScroller(subPane);
#endif
  scrollPane.setLocation(0,0);
  scrollPane.setSize(Canvas::instance().width(),Canvas::instance().height());

  bool needsPainting = true;
  while(true)
  {
    swiWaitForVBlank();
    scanKeys();
    u16 keys = keysDownRepeat();
    //u16 keys = keysHeld();
    if (keys & KEY_UP) 
    {
      scrollPane.up();
      scrollPane.up();
      needsPainting = true;
    }
    if (keys & KEY_DOWN) 
    {
      scrollPane.down();
      scrollPane.down();
      needsPainting = true;
    }
    if (keys & KEY_X)
    {
      //printf("%s\n",t2->asString().c_str());
      break;
    }

    if (keys & KEY_Y) {
      scrollPane.setVisible(not scrollPane.visible());
      keyBoard->setVisible(not keyBoard->visible());
      needsPainting = true;
    }

    if (keys & KEY_TOUCH)
    {
      touchPosition tp;
      touchRead(&tp);
      Stylus stylus;
      stylus.update(Stylus::DOWN, true, tp.px, tp.py+SCREEN_HEIGHT);
      needsPainting = keyBoard->dirty();
      if (not needsPainting)
        needsPainting = scrollPane.dirty();
    }

    needsPainting |= keyBoard->tick();
    if (needsPainting)
    {
      scrollPane.paint(scrollPane.preferredSize());
      keyBoard->paint(scrollPane.preferredSize());
      Canvas::instance().endPaint();
    }
    needsPainting = false;
  }
  delete keyBoard;
}
Example #13
0
//--------- Begin of static function disp_nation_info ---------//
//
static void disp_nation_info()
{
	vga_util.d3_panel_down( REPORT_DET_X1, REPORT_DET_Y1, REPORT_DET_X2, REPORT_DET_Y2 );

	//----------- display info ------------//

	int	  nationRecno  = info.nation_filter(browse_nation.recno());
	Nation* nationPtr    = nation_array[nationRecno];
	Nation* viewingNation = nation_array[info.viewing_nation_recno];
	NationRelation* nationRelation = viewingNation->get_relation(nationRecno);

	int x1=REPORT_DET_X1+6, x2=REPORT_DET_X1+380, x3=REPORT_DET_X2-10;
	int y=REPORT_DET_Y1+6;
	const int lineSpacing = 19;

	//---- display the nationality of the king ----//

	if( nationPtr->is_human() )
		font_bld.put_field( x1, y, text_reports.str_king_race(nationPtr->race_id), x2, 
		nationPtr->is_human() ? race_res[nationPtr->race_id]->name : monster_res[nationPtr->monster_id()]->name );

	y += lineSpacing;

		//-------- display economic data ----------//

	String str;

	if( nationRecno == info.viewing_nation_recno )
	{
		// font_bld.put_field( x1, y, "Your Food", x2, nationPtr->food_str() );
		font_bld.put_field( x1, y, text_reports.str_your_food(), x2, nationPtr->food_str() );

		str  = "$";
		str += nationPtr->cash_str();

		font_bld.put_field( x1, y+=lineSpacing, text_reports.str_your_treasure(), x2, str );

		if( nationPtr->is_monster() )
			font_bld.put_field( x1, y+=lineSpacing, text_reports.str_your_live_points(), x2, (int) nationPtr->live_points );

		font_bld.field( x1, y+=lineSpacing, text_reports.str_your_peace_time(), x2, nationPtr->peace_duration_str(), x3, INFO_REPAINT, "PEACE" );
	}
	else
	{
		//str  = translate.process("Your Yearly Import from ");
		//str += nationPtr->nation_name();
		// font_bld.field( x1, y    , str, x2, (int) viewingNation->get_relation(nationRecno)->import_365days(IMPORT_TOTAL), 2, x3, INFO_REPAINT, "IMPORT" );
		font_bld.field( x1, y    , text_reports.str_enemy_import_from(nationPtr->nation_name()),
			x2, (int) viewingNation->get_relation(nationRecno)->import_365days(IMPORT_TOTAL), 2, x3, INFO_REPAINT, "IMPORT" );

		// str  = translate.process("Your Yearly Export to ");
		// str += nationPtr->nation_name();
		// font_bld.field( x1, y+=lineSpacing, str, x2, (int) nationPtr->get_relation(info.viewing_nation_recno)->import_365days(IMPORT_TOTAL), 2, x3, INFO_REPAINT, "EXPORT" );
		font_bld.field( x1, y+=lineSpacing, text_reports.str_enemy_export_to(nationPtr->nation_name()),
			x2, (int) nationPtr->get_relation(info.viewing_nation_recno)->import_365days(IMPORT_TOTAL), 2, x3, INFO_REPAINT, "EXPORT" );

		// str  = translate.process("Continuous Peace Time of ");
		// str += nationPtr->nation_name();
		// font_bld.field( x1, y+=lineSpacing, str, x2, nationPtr->peace_duration_str(), x3, INFO_REPAINT, "PEACE" );
		font_bld.field( x1, y+=lineSpacing, text_reports.str_enemy_peace_time(nationPtr->nation_name()),
			x2, nationPtr->peace_duration_str(), x3, INFO_REPAINT, "PEACE" );

		//--------- duration of current status ----------//

//		str  = translate.process("Duration of ");
//		str += translate.process(nationRelation->status_str());
//		str += " Status";
//		font_bld.field( x1, y+=lineSpacing, str, x2, nationRelation->status_duration_str(), x3, INFO_REPAINT, "STATTIME" );
		font_bld.field( x1, y+=lineSpacing, text_reports.str_enemy_status_duration(nationRelation->status_str()),
			x2, nationRelation->status_duration_str(), x3, INFO_REPAINT, "STATTIME" );

		//------- display the allow_attack field --------//

		// str  = "Allow Your Units to Attack ";
		// str += nationPtr->nation_name();
		// font_bld.field( x1, y+=lineSpacing, str, x2, "", x3, INFO_REPAINT, "ALLOWATK" );
		font_bld.field( x1, y+=lineSpacing, text_reports.str_enemy_allow_attack(nationPtr->nation_name()),
			x2, "", x3, INFO_REPAINT, "ALLOWATK" );

//		button_allow_attack[0].set_font( &font_bld );
//		button_allow_attack[1].set_font( &font_bld );
		button_allow_attack[1].create_text( x2+6 , y, x2+50 , y+lineSpacing-1, text_reports.str_no_yes(1)); // "Yes" );
		button_allow_attack[0].create_text( x2+54, y, x2+100, y+lineSpacing-1, text_reports.str_no_yes(0)); // "No"  );

		button_allow_attack.paint( viewingNation->get_relation(nationRecno)->should_attack );

		//---- if this nation is our ally, display its cash and food ----//

		if( viewingNation->get_relation(nationRecno)->status == RELATION_ALLIANCE )
		{
			// str  = nationPtr->nation_name();
			// str += " 's Treasure";
			// font_bld.field( x1, y+=lineSpacing, str, x2, nationPtr->cash, 2, x3, INFO_REPAINT );
			font_bld.field( x1, y+=lineSpacing, text_reports.str_ally_cash(nationPtr->nation_name()),
				x2, nationPtr->cash, 2, x3, INFO_REPAINT );

			// str  = nationPtr->nation_name();
			// str += " 's Food";
			// font_bld.field( x1, y+=lineSpacing, str, x2, nationPtr->food, 1, x3, INFO_REPAINT );
			font_bld.field( x1, y+=lineSpacing, text_reports.str_ally_food(nationPtr->nation_name()),
				x2, nationPtr->food, 1, x3, INFO_REPAINT );
		}
	}

	y+=lineSpacing+10;

	//----- display its relation status with other nations -----//

	if( info.viewing_nation_recno != nationRecno )
	{
		// String str;

		nationPtr->disp_nation_color(x1, y+1);
		font_bld.put(x1+20, y, text_reports.str_enemy_relation(nationPtr->nation_name()));
		y+=20;

		for( int i=1 ; i<=nation_array.size() ; i++ )
		{
			if( nation_array.is_deleted(i) ||
				 i == nationRecno ||
				 i == info.viewing_nation_recno )
			{
				continue;
			}

			nation_array[i]->disp_nation_color(x1, y+1);

			font_bld.put( x1+20, y, nation_array[i]->nation_name() );
			font_bld.put( x1+240, y, nationPtr->get_relation(i)->status_str() );

			if( nationPtr->get_relation(i)->trade_treaty )
			{
				int x2 = font_bld.put( x1+330, y, text_talk.str_trade_treaty()); // "Trade Treaty" );
				// font_bld.put( x1+450, y, misc.format((int)nationPtr->total_year_trade(i),2) );
				font_bld.put( x2+10, y, misc.format((int)nationPtr->total_year_trade(i),2) );
			}

			if( config.show_debug_info )
			{
				font_bld.put( x1+500, y, nationPtr->get_relation(i)->ai_relation_level );
				font_bld.put( x1+530, y, (int) nationPtr->get_relation(i)->good_relation_duration_rating );
			}

			y+=16;
		}
	}
}
Example #14
0
// ----- begin of function ScenarioEditor::disp_players_main ------//
//
void ScenarioEditor::disp_players_main(int refreshFlag)
{
	// ------- display scroll area ----------//

	browse_nation.init( INFO_X1, INFO_Y1, INFO_X2, INFO_Y1+168,
		-1, 32, MAX_NATION, disp_nation_rec );
	browse_nation.open(brush_player_recno);
	browse_nation.paint();
	// ######## begin Gilbert 22/2 #######//
	// browse_nation.refresh(brush_player_recno);
	browse_nation.refresh();
	// ######## end Gilbert 22/2 #######//

	// ------ display king name -------//

	int y = INFO_Y1+170;

//	if( !nation_array.is_deleted(brush_player_recno) )
//		font_whbl.put( font_whbl.put( INFO_X1+20, y, text_editor.str_king_name()) // "King Name" )
//		+10, y, nation_array[brush_player_recno]->king_name() ) ;

	if( !nation_array.is_deleted(brush_player_recno) )
	{
		vga_buffer.d3_panel_up( INFO_X1+5, y, INFO_X2-5, y+8+font_cara_w.max_font_height );
		font_cara_w.center_put( INFO_X1+5, y, INFO_X2-5, y+8+font_cara_w.max_font_height,
			nation_array[brush_player_recno]->nation_name() );
	}

	y+=30;

	// ------- treasure, food, reputation --------//
	button_cash_up.create_text(    INFO_X1+140, y,    INFO_X1+150, y+9,  "+" );
	button_cash_down.create_text(  INFO_X1+140, y+10, INFO_X1+150, y+19, "-" );
	button_food_up.create_text(    INFO_X1+140, y+22, INFO_X1+150, y+31, "+" );
	button_food_down.create_text(  INFO_X1+140, y+32, INFO_X1+150, y+41, "-" );
	button_reput_up.create_text(   INFO_X1+140, y+44, INFO_X1+150, y+53, "+" );
	button_reput_down.create_text( INFO_X1+140, y+54, INFO_X1+150, y+63, "-" );
	button_live_up.create_text(    INFO_X1+140, y+66, INFO_X1+150, y+75, "+" );
	button_live_down.create_text(  INFO_X1+140, y+76, INFO_X1+150, y+85, "-" );

//	button_adjustment[0].create_text( INFO_X1+152, y, INFO_X1+214, y+18, text_editor.str_fine_coarse(0) ); // "Fine" );
//	button_adjustment[1].create_text( INFO_X1+152, y+20, INFO_X1+214, y+38, text_editor.str_fine_coarse(1) ); // "Medium" );
//	button_adjustment[2].create_text( INFO_X1+152, y+40, INFO_X1+214, y+58, text_editor.str_fine_coarse(2) ); // "Coarse" );

	if( !nation_array.is_deleted(brush_player_recno) )
	{
		vga_buffer.bar( INFO_X1+15, y, INFO_X2-10, y+66, V_BLACK );

		Nation *nationPtr = nation_array[brush_player_recno];

		// -------- treasure --------//

		font_whbl.put( INFO_X1+15, y, text_editor.str_player_treasure() ); //"Treasure" );
		font_whbl.right_put( INFO_X1+140-4, y, m.format( (int)nationPtr->cash, 2) );
		button_cash_up.paint();
		button_cash_down.paint();

		// --------- food ----------//

		font_whbl.put( INFO_X1+15, y+22, text_editor.str_player_food() ); // "Food" );
		font_whbl.right_put( INFO_X1+140-4, y+22, m.format((int)nationPtr->food) );
		button_food_up.paint();
		button_food_down.paint();

		// --------- reputation -------//

		font_whbl.put( INFO_X1+15, y+44, text_editor.str_player_reputation() ); // "Reputation" );
		font_whbl.right_put( INFO_X1+140-4, y+44, m.format( (int)nationPtr->reputation) );
		button_reput_up.paint();
		button_reput_down.paint();

		// --------- live points ---------//

		font_whbl.put( INFO_X1+15, y+66, text_editor.str_player_live_points() ); // "Life Points" );
		font_whbl.right_put( INFO_X1+140-4, y+66, m.format( (int)nationPtr->live_points) );
		button_live_up.paint();
		button_live_down.paint();
	}

	y += 87;
	button_adjustment[0].create_text( INFO_X1+147, y+18, INFO_X1+216, y+38, text_editor.str_fine_coarse(0) ); // "Fine" );
	button_adjustment[1].create_text( INFO_X1+76, y+18, INFO_X1+145, y+38, text_editor.str_fine_coarse(1) ); // "Medium" );
	button_adjustment[2].create_text( INFO_X1+5, y+18, INFO_X1+74, y+38, text_editor.str_fine_coarse(2) ); // "Coarse" );
	font_whbl.put( INFO_X1+15, y, text_editor.str_adjustment() );
	button_adjustment.paint();

	// ------- player type --------//

//	button_player_type[0].create_text( INFO_X1+50, y, INFO_X1+100, y+18, "Either" );
//	button_player_type[1].create_text( INFO_X1+50, y, INFO_X1+100, y+18, "Computer" );
	if( !nation_array.is_deleted(brush_player_recno) )
	{
//		button_player_type.paint( nation_array[brush_player_recno]->is_ai() );
	}
}
Example #15
0
// ----- begin of function ScenarioEditor::detect_players_main ------//
//
void ScenarioEditor::detect_players_main()
{
	int rc;

	// ------- detect scroll area ----------//

	if( (rc = browse_nation.detect()) > 0 )
	{
		// ###### begin Gilbert 22/2 #######//
		// brush_player_recno = rc;
		// ###### end Gilbert 22/2 #######//
	}
	brush_player_recno = browse_nation.recno();

	if( nation_array.is_deleted(brush_player_recno) )
		return;

	Nation *nationPtr = nation_array[brush_player_recno];

	int y = INFO_Y1+170;

	if( mouse.single_click( INFO_X1+5, y, INFO_X2-5, y+8+font_cara_w.max_font_height ) )
	{
		// create geta to edit nation name

		const int yOffs = 4;
		const int lrMargin = 5;
		const unsigned int FIELD_LEN = 30;

		// paint the background again
		int y2 = y+8+font_cara_w.max_font_height;
		vga_buffer.d3_panel_up( INFO_X1+5, y, INFO_X2-5, y2 );
		Blob2DW backGroundBuf;
		backGroundBuf.resize( 0, 0, (INFO_X2-5)-(INFO_X1+5+lrMargin)+1, y2-(y+yOffs)+1 );
		vga_buffer.read_bitmapW( INFO_X1+5+lrMargin, y+yOffs, INFO_X2-5, y2, 
			backGroundBuf.bitmap_ptr() );		// get a wider background

		char nationStr[FIELD_LEN+1];
		strncpy( nationStr, nationPtr->nation_name(), FIELD_LEN );
		nationStr[FIELD_LEN] = '\0';

		GetA nation_name_field;
		nation_name_field.init( INFO_X1+5+lrMargin, y+yOffs, INFO_X2-5-lrMargin, nationStr, 
			FIELD_LEN, &font_cara_w, 1, 1 );
		nation_name_field.set_background( backGroundBuf.ptr );
		nation_name_field.paint();

		while(1)
		{
			sys.yield();
			mouse.get_event();
			music.yield();
                        vga.flip();

			int rc = nation_name_field.detect();
			if( rc == KEY_RETURN )
			{
				nation_array.set_custom_nation_name( brush_player_recno, nationStr );
				break;
			}
			else if( rc == KEY_ESC )
			{
				break;		// cancel
			}

			if( rc )
				nation_name_field.paint(1);
		}
	}

	int cashAdjustment[3] = { 100, 1000, 10000 };
	if( button_cash_up.detect() )
	{
		nationPtr->cash += cashAdjustment[button_adjustment()];
	}
	if( button_cash_down.detect() )
	{
		nationPtr->cash -= cashAdjustment[button_adjustment()];
	}

	int foodAdjustment[3] = { 100, 1000, 10000 };
	if( button_food_up.detect() )
	{
		nationPtr->food += foodAdjustment[button_adjustment()];
	}
	if( button_food_down.detect() )
	{
		nationPtr->food -= foodAdjustment[button_adjustment()];
	}

	int reputationAdjustment[3] = { 1, 10, 100 };
	if( button_reput_up.detect() )
	{
		nationPtr->reputation += reputationAdjustment[button_adjustment()];
		if( nationPtr->reputation > 100 )
			nationPtr->reputation = 100;
	}
	if( button_reput_down.detect() )
	{
		nationPtr->reputation -= reputationAdjustment[button_adjustment()];
		if( nationPtr->reputation < -100 )
			nationPtr->reputation = -100;
	}

	if( nationPtr->is_monster() )
	{
		int lifeAdjustment[3] = { 100, 1000, 10000 };
		if( button_live_up.detect() )
		{
			nationPtr->live_points += lifeAdjustment[button_adjustment()];
		}
		if( button_live_down.detect() )
		{
			nationPtr->live_points -= lifeAdjustment[button_adjustment()];
		}
	}

	button_adjustment.detect();

//	if( (rc = button_player_type.detect()) >= 0 )
//	{
//		nation_array[brush_player_recno]->nation_type = rc ? NATION_AI : NATION_REMOTE;
//	}
}
Example #16
0
ConfigDialog::ConfigDialog(MovieRecorderImpl* recorder)
    : recorder(recorder),
      updateViewComboLater(std::bind(&ConfigDialog::updateViewCombo, this))
{
    setWindowTitle(_("Movie Recorder"));
    
    QVBoxLayout* vbox = new QVBoxLayout();
    setLayout(vbox);

    QHBoxLayout* hbox = new QHBoxLayout();
    hbox->addWidget(new QLabel(_("Target view:")));

    targetViewCombo.sigCurrentIndexChanged().connect(
        std::bind(&ConfigDialog::onTargetViewIndexChanged, this, std::placeholders::_1));
    hbox->addWidget(&targetViewCombo);

    viewMarkerCheck.setText(_("Show the marker"));
    viewMarkerCheck.sigToggled().connect(
        std::bind(&MovieRecorderImpl::onViewMarkerToggled, recorder, std::placeholders::_1));
    hbox->addWidget(&viewMarkerCheck);
    
    hbox->addStretch();
    vbox->addLayout(hbox);

    hbox = new QHBoxLayout();
    hbox->addWidget(new QLabel(_("Recording mode: ")));
    ButtonGroup* modeGroup = new ButtonGroup();
    for(int i=0; i < N_RECORDING_MODES; ++i){
        RadioButton* radio = &modeRadioButtons[i];
        radio->setText(recorder->recordingMode.label(i));
        modeGroup->addButton(radio, i);
        hbox->addWidget(radio);
    }
    modeRadioButtons[0].setChecked(true);
    modeGroup->sigButtonClicked().connect(
        std::bind(&ConfigDialog::onRecordingModeRadioClicked, this, std::placeholders::_1));
    hbox->addStretch();
    vbox->addLayout(hbox);

    hbox = new QHBoxLayout();
    hbox->addWidget(new QLabel(_("Directory")));
    hbox->addWidget(&directoryEntry);

    QIcon folderIcon = QIcon::fromTheme("folder");
    if(folderIcon.isNull()){
        directoryButton.setText(_("Select"));
    } else {
        directoryButton.setIcon(folderIcon);
    }
    directoryButton.sigClicked().connect(
        std::bind(&ConfigDialog::showDirectorySelectionDialog, this));
    hbox->addWidget(&directoryButton);
    vbox->addLayout(hbox);

    hbox = new QHBoxLayout();
    hbox->addWidget(new QLabel(_("Basename")));
    basenameEntry.setText("scene");
    hbox->addWidget(&basenameEntry);
    hbox->addStretch();
    vbox->addLayout(hbox);

    hbox = new QHBoxLayout();
    hbox->addWidget(new QLabel(_("Frame rate")));
    fpsSpin.setDecimals(1);
    fpsSpin.setRange(1.0, 9999.9);
    fpsSpin.setValue(30.0);
    fpsSpin.setSingleStep(0.1);
    hbox->addWidget(&fpsSpin);
    hbox->addWidget(new QLabel(_("[fps]")));
    hbox->addStretch();
    vbox->addLayout(hbox);

    hbox = new QHBoxLayout();
    startTimeCheck.setText(_("Start time"));
    hbox->addWidget(&startTimeCheck);
    startTimeSpin.setDecimals(2);
    startTimeSpin.setRange(0.00, 9999.99);
    startTimeSpin.setSingleStep(0.1);
    hbox->addWidget(&startTimeSpin);
    hbox->addWidget(new QLabel(_("[s]")));
    hbox->addSpacing(4);

    finishTimeCheck.setText(_("Finish time"));
    hbox->addWidget(&finishTimeCheck);
    finishTimeSpin.setDecimals(2);
    finishTimeSpin.setRange(0.00, 9999.99);
    finishTimeSpin.setSingleStep(0.1);
    hbox->addWidget(&finishTimeSpin);
    hbox->addWidget(new QLabel(_("[s]")));
    hbox->addStretch();
    vbox->addLayout(hbox);
    
    hbox = new QHBoxLayout();
    imageSizeCheck.setText(_("Image size"));
    hbox->addWidget(&imageSizeCheck);
    
    imageWidthSpin.setRange(1, 9999);
    imageWidthSpin.setValue(640);
    hbox->addWidget(&imageWidthSpin);

    hbox->addWidget(new QLabel("x"));
    imageHeightSpin.setRange(1, 9999);
    imageHeightSpin.setValue(480);
    hbox->addWidget(&imageHeightSpin);
    hbox->addStretch();
    vbox->addLayout(hbox);

    if(ENABLE_MOUSE_CURSOR_CAPTURE){
        hbox = new QHBoxLayout();
        mouseCursorCheck.setText(_("Capture the mouse cursor"));
        hbox->addWidget(&mouseCursorCheck);
        hbox->addStretch();
        vbox->addLayout(hbox);
    }

    vbox->addWidget(new HSeparator());
    QDialogButtonBox* buttonBox = new QDialogButtonBox(this);

    recordingToggle.setText(_("&Record"));
    recordingToggle.setDefault(true);
    recordingToggle.sigToggled().connect(
        std::bind(&MovieRecorderImpl::activateRecording, recorder, std::placeholders::_1, true));
    buttonBox->addButton(&recordingToggle, QDialogButtonBox::ActionRole);

    vbox->addWidget(buttonBox);
}