Пример #1
0
Файл: main.cpp Проект: EQ4/axLib
int main(int argc, char* argv[])
{
	string path;
	// cout << "TEST" << endl;
	// if(string(argv[0]) == string("main"))
	// {
		path = argv[0];
	// }

	axApp app(axSize(500, 530));
	SetNoBorder(&app);

	TitleBar* titlebar = new TitleBar(&app, nullptr, axRect(0, 0, 500, 530));

	FileDialog* file_dialog = new FileDialog(&app, nullptr, 
								  axRect(3, 30, 494, 497), path);


	
	
	// file_dialog->Reparent(titlebar, axPoint(0, 0));


	// app.GetCore();
	// XReparentWindow(dpy, (Window)win, parent, 3, 30);

	// Window win = static_cast<axCoreX11*>(app->GetCore())->GetWindow();
	// Display* dpy = static_cast<axCoreX11*>(app->GetCore())->GetDisplay();

	app.MainLoop();

	return 0;
}
Пример #2
0
TalkBox::TalkBox(const Point2i& size, Font::font_size_t fsize, Font::font_style_t fstyle) :
  VBox(size.x, false, false, false)
{
  SetNoBorder();

  msg_box = new MsgBox(Point2i(size.x, size.y - 20), fsize, fstyle);
  AddWidget(msg_box);

  HBox* tmp2_box = new HBox(16, false, false);
  tmp2_box->SetMargin(4);
  tmp2_box->SetNoBorder();
  line_to_send_tbox = new TextBox("", size.x-20, fsize, fstyle);
  tmp2_box->AddWidget(line_to_send_tbox);

  Profile *res = GetResourceManager().LoadXMLProfile( "graphism.xml",false);
  send_txt_bt = new Button(res, "menu/send_txt", true);
  tmp2_box->AddWidget(send_txt_bt);

  AddWidget(tmp2_box);
}
Пример #3
0
 GameInfoBox(uint width, bool pwd, const std::string& ip,
             const std::string& port, const std::string& name)
   : HBox(width, false, false, false)
   , password(pwd)
   , port(port)
   , ip_address(ip)
 {
   if (pwd) {
     AddWidget(new PictureWidget(Point2i(16, 16), "menu/password_lock",
                                 PictureWidget::FIT_SCALING));
   } else {
     AddWidget(new NullWidget(Point2i(16, 16)));
   }
   width -= 20;
   AddWidget(new Label(ip, 0.3f*width));
   AddWidget(new Label(port, 0.2f*width));
   AddWidget(new Label(name, 0.5f*width));
   SetNoBorder();
   Pack();
 }
Пример #4
0
TeamBox::TeamBox(const std::string& _player_name, const Point2i& _size) :
  HBox(_size.y, false, false, false),
  ai_name(NO_AI_NAME)
{
  associated_team = NULL;

  SetMargin(2);
  SetNoBorder();
  Widget::SetBackgroundColor(transparent_color);

  Profile *res = GetResourceManager().LoadXMLProfile("graphism.xml", false);

  /********        Logos: team mascott, player type icon      ********/
  Box * tmp_logo_box = new VBox(W_UNDEF, false, false, false);
  tmp_logo_box->SetMargin(1);
  tmp_logo_box->SetNoBorder();

  team_logo = new PictureWidget(Point2i(38, 38));
  tmp_logo_box->AddWidget(team_logo);

  player_local_ai_surf = GetResourceManager().LoadImage(res, "menu/player_local_ai");
  player_local_human_surf = GetResourceManager().LoadImage(res, "menu/player_local_human");
  player_remote_ai_surf = GetResourceManager().LoadImage(res, "menu/player_remote_ai");
  player_remote_human_surf = GetResourceManager().LoadImage(res, "menu/player_remote_human");

  player_type =  new PictureWidget(Point2i(38, 30));
  player_type->SetSurface(player_local_ai_surf);
  tmp_logo_box->AddWidget(player_type);

  AddWidget(tmp_logo_box);

  /********    Center box: team name, commander   *********/
  int width = _size.x - (2*2+(38+2*2)+(110+2*2));
  Box * tmp_player_box = new VBox(_size.y, false, false, false);
  tmp_player_box->SetMargin(0);
  tmp_player_box->SetNoBorder();

  previous_player_name = "team";
  team_name = new Label(previous_player_name, width,
                        Font::FONT_MEDIUM, Font::FONT_BOLD);
  tmp_player_box->AddWidget(team_name);

  /********    Names: "Head commander" + text/custom team    *******/
  tmp_player_box->AddWidget(new Label(_("Head commander"), width,
                                      Font::FONT_SMALL, Font::FONT_BOLD));

  custom_team_list = GetCustomTeamsList().GetList();
  custom_team_current_id = 0;

  if (custom_team_list.empty()) {
    player_name = new TextBox(_player_name, width,
                              Font::FONT_SMALL, Font::FONT_BOLD);
    tmp_player_box->AddWidget(player_name);

    next_custom_team = NULL;
    previous_custom_team = NULL;

  } else {
    next_custom_team = new Button(res, "menu/plus");
    previous_custom_team = new Button(res, "menu/minus");

    player_name = new TextBox(_player_name, width - 2 * (next_custom_team->GetSizeY() + 2),
                              Font::FONT_SMALL, Font::FONT_BOLD);

    Box * tmp_name_box = new HBox(player_name->GetSizeY(), false, false, false);
    tmp_name_box->SetNoBorder();
    tmp_name_box->SetMargin(2);

    tmp_name_box->AddWidget(previous_custom_team);
    tmp_name_box->AddWidget(player_name);
    tmp_name_box->AddWidget(next_custom_team);
    tmp_player_box->AddWidget(tmp_name_box);
  }
  AddWidget(tmp_player_box);


  /**********     Number of characters        **********/
  nb_characters = new SpinButtonWithPicture(_("Number of characters"), "menu/ico_play",
                                            Point2i(110, 120), 6, 1, 1, 10);
  AddWidget(nb_characters);
}
Пример #5
0
TeamsSelectionBox::TeamsSelectionBox(const Point2i &_size, bool network, bool w_border) :
  HBox(_size.y, w_border, false)
{
  if (!w_border)
    SetNoBorder();
  SetMargin(0);

  // How many teams ?
  VBox *tmp = new VBox(120, false, false, true);
  if (network) {
    local_teams_nb =
      new SpinButtonWithPicture(_("Local teams:"), "menu/team_number",
                                Point2i(100, 130), 0, 1, 0, MAX_NB_TEAMS);
  } else {
    local_teams_nb =
      new SpinButtonWithPicture(_("Number of teams:"), "menu/team_number",
                                Point2i(100, 130), 2, 1, 2, MAX_NB_TEAMS);
  }
  tmp->AddWidget(local_teams_nb);
  //tmp->AddWidget(new NullWidget(Point2i(120, 120)));
  AddWidget(tmp);

  uint box_w = _size.x - local_teams_nb->GetSizeX() - 10;
  Point2i grid_size = Point2i(box_w, _size.y);
  Point2i grid_dim = grid_size / Point2i(300 + 10, 130 + 10);
  Point2i box_size;
  bool use_list;
  if (grid_dim.x*grid_dim.y < (int)MAX_NB_TEAMS) {
    use_list = true;
    box_size.SetValues(box_w - 40, 120);
  } else {
    use_list = false;
    box_size.SetValues((grid_size / grid_dim) - 10);
  }

  for (uint i=0; i < MAX_NB_TEAMS; i++) {
    std::string player_name = _("Player") ;
    char num_player[4];
    sprintf(num_player, " %d", i+1);
    player_name += num_player;
    teams_selections.push_back(new TeamBox(player_name, box_size));
  }

  // If the intended gridbox would be too big for the intended size,
  // instead create a listbox
  if (use_list) {
    // Warning: this box takes the ownership of the widgets in teams_selections:
    // while any other Box will delete the ones it contains, TeamScrollBox
    // doesn't really contain them as widgets. They therefore aren't released
    // through this mechanism, but with a manual one. This manual mechanism
    // requires we have a *real* copy of the vector for when it is destroyed.
    list_box = new TeamScrollBox(teams_selections, Point2i(box_w-20, _size.y-10));
    list_box->SetNbTeams(0);

    AddWidget(list_box);
  } else {
    list_box = NULL;
    Box * teams_grid_box = new GridBox(grid_dim.y, grid_dim.x, 10, false);
    teams_grid_box->SetNoBorder();

    for (uint i=0; i<MAX_NB_TEAMS; i++)
      teams_grid_box->AddWidget(teams_selections[i]);

    AddWidget(teams_grid_box);
  }

  // Load Teams' list
  GetTeamsList().full_list.sort(compareTeams);
}