HousePalettePanel::HousePalettePanel(wxWindow* parent, wxWindowID id) : PalettePanel(parent, id), map(nullptr), do_resize_on_display(true), fix_size_timer(this, PALETTE_LAYOUT_FIX_TIMER) { wxSizer* topsizer = newd wxBoxSizer(wxVERTICAL); wxSizer* tmpsizer; wxSizer* sidesizer = newd wxStaticBoxSizer(wxVERTICAL, this, wxT("Houses")); town_choice = newd wxChoice(this, PALETTE_HOUSE_TOWN_CHOICE, wxDefaultPosition, wxDefaultSize, (int)0, (const wxString*)nullptr); sidesizer->Add(town_choice, 0, wxEXPAND); house_list = newd wxListBox(this, PALETTE_HOUSE_LISTBOX, wxDefaultPosition, wxDefaultSize, 0, nullptr, wxLB_SINGLE | wxLB_NEEDED_SB | wxLB_SORT); sidesizer->Add(house_list, 1, wxEXPAND); tmpsizer = newd wxBoxSizer(wxHORIZONTAL); tmpsizer->Add(add_house_button = newd wxButton(this, PALETTE_HOUSE_ADD_HOUSE, wxT("Add"), wxDefaultPosition, wxSize(50, -1)), wxSizerFlags(1).Right()); tmpsizer->Add(edit_house_button = newd wxButton(this, PALETTE_HOUSE_EDIT_HOUSE, wxT("Edit"), wxDefaultPosition, wxSize(50, -1)), wxSizerFlags(1).Right()); tmpsizer->Add(remove_house_button = newd wxButton(this, PALETTE_HOUSE_REMOVE_HOUSE, wxT("Remove"), wxDefaultPosition, wxSize(70, -1)), wxSizerFlags(1).Right()); sidesizer->Add(tmpsizer, wxSizerFlags(0).Right()); topsizer->Add(sidesizer, 1, wxEXPAND); // Temple position sidesizer = newd wxStaticBoxSizer(newd wxStaticBox(this, wxID_ANY, wxT("Brushes"), wxDefaultPosition, wxSize(150, 200)), wxVERTICAL); //sidesizer->Add(180, 1, wxEXPAND); tmpsizer = newd wxBoxSizer(wxHORIZONTAL); house_brush_button = newd wxToggleButton(this, PALETTE_HOUSE_BRUSH_BUTTON, wxT("House tiles")); tmpsizer->Add(house_brush_button); sidesizer->Add(tmpsizer, wxSizerFlags(1).Center()); tmpsizer = newd wxBoxSizer(wxHORIZONTAL); select_position_button = newd wxToggleButton(this, PALETTE_HOUSE_SELECT_EXIT_BUTTON, wxT("Select Exit")); tmpsizer->Add(select_position_button); sidesizer->Add(tmpsizer, wxSizerFlags(1).Center()); topsizer->Add(sidesizer, 0, wxEXPAND); SetSizerAndFit(topsizer); }
BrushPalettePanel::BrushPalettePanel(wxWindow* parent, const TilesetContainer& tilesets, TilesetCategoryType category, wxWindowID id) : PalettePanel(parent, id), palette_type(category), choicebook(nullptr), size_panel(nullptr) { wxSizer* topsizer = newd wxBoxSizer(wxVERTICAL); // Create the tileset panel wxSizer* ts_sizer = newd wxStaticBoxSizer(wxVERTICAL, this, wxT("Tileset")); wxChoicebook* tmp_choicebook = newd wxChoicebook(this, wxID_ANY, wxDefaultPosition, wxSize(180,250)); ts_sizer->Add(tmp_choicebook, 1, wxEXPAND); topsizer->Add(ts_sizer, 1, wxEXPAND); for(TilesetContainer::const_iterator iter = tilesets.begin(); iter != tilesets.end(); ++iter) { const TilesetCategory* tcg = iter->second->getCategory(category); if(tcg && tcg->size() > 0) { BrushPanel* panel = newd BrushPanel(tmp_choicebook); panel->AssignTileset(tcg); tmp_choicebook->AddPage(panel, wxstr(iter->second->name)); } } SetSizerAndFit(topsizer); choicebook = tmp_choicebook; }
EditHouseDialog::EditHouseDialog(wxWindow* parent, Map* map, House* house) : wxDialog(parent, wxID_ANY, wxT("House"), wxDefaultPosition, wxSize(250,160)), map(map), what_house(house) { ASSERT(map); ASSERT(house); // Create topsizer wxSizer* sizer = newd wxBoxSizer(wxVERTICAL); wxSizer* tmpsizer; house_name = wxstr(house->name); house_id = i2ws(house->id); house_rent = i2ws(house->rent); // House options tmpsizer = newd wxStaticBoxSizer(wxHORIZONTAL, this, wxT("Name")); name_field = newd wxTextCtrl(this, wxID_ANY, wxT(""), wxDefaultPosition, wxSize(230,20), 0, wxTextValidator(wxFILTER_ASCII, &house_name)); tmpsizer->Add(name_field); sizer->Add(tmpsizer, wxSizerFlags().Border(wxALL, 20)); tmpsizer = newd wxStaticBoxSizer(wxHORIZONTAL, this, wxT("Rent / ID")); rent_field = newd wxTextCtrl(this, wxID_ANY, wxT(""), wxDefaultPosition, wxSize(160,20), 0, wxTextValidator(wxFILTER_NUMERIC, &house_rent)); tmpsizer->Add(rent_field); id_field = newd wxTextCtrl(this, wxID_ANY, wxT(""), wxDefaultPosition, wxSize(70,20), 0, wxTextValidator(wxFILTER_NUMERIC, &house_id)); id_field->Enable(false); tmpsizer->Add(id_field); sizer->Add(tmpsizer, wxSizerFlags().Border(wxALL, 20)); // House options guildhall_field = newd wxCheckBox(this, wxID_ANY, wxT("Guildhall"), wxDefaultPosition); sizer->Add(guildhall_field, wxSizerFlags().Border(wxRIGHT | wxLEFT | wxBOTTOM, 20)); guildhall_field->SetValue(house->guildhall); // OK/Cancel buttons tmpsizer = newd wxBoxSizer(wxHORIZONTAL); tmpsizer->Add(newd wxButton(this, wxID_OK, wxT("OK")), wxSizerFlags(1).Center()); tmpsizer->Add(newd wxButton(this, wxID_CANCEL, wxT("Cancel")), wxSizerFlags(1).Center()); sizer->Add(tmpsizer, wxSizerFlags(1).Center().Border(wxRIGHT | wxLEFT | wxBOTTOM, 20)); SetSizerAndFit(sizer); }
void PalettePanel::AddToolPanel(PalettePanel* panel) { wxSizer* sp_sizer = newd wxStaticBoxSizer(wxVERTICAL, this, panel->GetName()); sp_sizer->Add(panel, 0, wxEXPAND); GetSizer()->Add(sp_sizer, 0, wxEXPAND); //GetSizer()->SetDimension(wxDefaultCoord, wxDefaultCoord, wxDefaultCoord, wxDefaultCoord); //GetSizer()->Layout(); Fit(); // tool_bars.push_back(panel); }