//------------------------------------------------------------------- // Constructor / Destructor //------------------------------------------------------------------- CList::CList() { // Add sprite_disabled! TODO AddSetting(GUIST_float, "buffer_zone"); //AddSetting(GUIST_CGUIString, "caption"); will it break removing this? If I know my system, then no, but test just in case TODO (Gee). AddSetting(GUIST_CStrW, "font"); AddSetting(GUIST_bool, "scrollbar"); AddSetting(GUIST_CStr, "scrollbar_style"); AddSetting(GUIST_CGUISpriteInstance, "sprite"); AddSetting(GUIST_CGUISpriteInstance, "sprite_selectarea"); AddSetting(GUIST_int, "cell_id"); AddSetting(GUIST_EAlign, "text_align"); AddSetting(GUIST_CColor, "textcolor"); AddSetting(GUIST_CColor, "textcolor_selected"); AddSetting(GUIST_int, "selected"); // Index selected. -1 is none. AddSetting(GUIST_CStrW, "tooltip"); AddSetting(GUIST_CStr, "tooltip_style"); // Each list item has both a name (in 'list') and an associated data string (in 'list_data') AddSetting(GUIST_CGUIList, "list"); AddSetting(GUIST_CGUIList, "list_data"); // TODO: this should be a list of raw strings, not of CGUIStrings GUI<bool>::SetSetting(this, "scrollbar", false); // Nothing is selected as default. GUI<int>::SetSetting(this, "selected", -1); // Add scroll-bar CGUIScrollBarVertical * bar = new CGUIScrollBarVertical(); bar->SetRightAligned(true); bar->SetUseEdgeButtons(true); AddScrollBar(bar); }
CList::CList() : m_Modified(false) { // Add sprite_disabled! TODO AddSetting(GUIST_float, "buffer_zone"); AddSetting(GUIST_CStrW, "font"); AddSetting(GUIST_bool, "scrollbar"); AddSetting(GUIST_CStr, "scrollbar_style"); AddSetting(GUIST_CStrW, "sound_disabled"); AddSetting(GUIST_CStrW, "sound_selected"); AddSetting(GUIST_CGUISpriteInstance, "sprite"); AddSetting(GUIST_CGUISpriteInstance, "sprite_selectarea"); AddSetting(GUIST_int, "cell_id"); AddSetting(GUIST_EAlign, "text_align"); AddSetting(GUIST_CColor, "textcolor"); AddSetting(GUIST_CColor, "textcolor_selected"); AddSetting(GUIST_int, "selected"); // Index selected. -1 is none. AddSetting(GUIST_CStrW, "tooltip"); AddSetting(GUIST_CStr, "tooltip_style"); // Each list item has both a name (in 'list') and an associated data string (in 'list_data') AddSetting(GUIST_CGUIList, "list"); AddSetting(GUIST_CGUIList, "list_data"); // TODO: this should be a list of raw strings, not of CGUIStrings GUI<bool>::SetSetting(this, "scrollbar", false); // Nothing is selected as default. GUI<int>::SetSetting(this, "selected", -1); // Add scroll-bar CGUIScrollBarVertical* bar = new CGUIScrollBarVertical(); bar->SetRightAligned(true); AddScrollBar(bar); }
/** * * * @author FloSoft */ iwAddons::iwAddons(GlobalGameSettings* ggs, ChangePolicy policy) : IngameWindow(CGI_ADDONS, 0xFFFF, 0xFFFF, 700, 500, _("Addon Settings"), LOADER.GetImageN("resource", 41), true), ggs(ggs), policy(policy) { AddText(0, 20, 30, _("Additional features:"), COLOR_YELLOW, 0, NormalFont); if(policy != READONLY) AddTextButton(1, 20, height - 40, 200, 22, TC_GREY, _("Apply Changes"), NormalFont); AddTextButton(2, 250, height - 40, 200, 22, TC_RED1, _("Close Without Saving"), NormalFont); if(policy != READONLY) AddTextButton(3, 480, height - 40, 200, 22, TC_GREY, _("Use S2 Defaults"), NormalFont); // Kategorien ctrlOptionGroup* optiongroup = AddOptionGroup(5, ctrlOptionGroup::CHECK, scale); // "Alle" optiongroup->AddTextButton(ADDONGROUP_ALL, 20, 50, 120, 22, TC_GREEN2, _("All"), NormalFont); // "Militär" optiongroup->AddTextButton(ADDONGROUP_MILITARY, 150, 50, 120, 22, TC_GREEN2, _("Military"), NormalFont); // "Wirtschaft" optiongroup->AddTextButton(ADDONGROUP_ECONOMY, 290, 50, 120, 22, TC_GREEN2, _("Economy"), NormalFont); // "Spielverhalten" optiongroup->AddTextButton(ADDONGROUP_GAMEPLAY, 430, 50, 120, 22, TC_GREEN2, _("Gameplay"), NormalFont); // "Sonstiges" optiongroup->AddTextButton(ADDONGROUP_OTHER, 560, 50, 120, 22, TC_GREEN2, _("Other"), NormalFont); ctrlScrollBar* scrollbar = AddScrollBar(6, width - SCROLLBAR_WIDTH - 20, 90, SCROLLBAR_WIDTH, height - 140, SCROLLBAR_WIDTH, TC_GREEN2, (height - 140) / 30 - 1); scrollbar->SetRange(ggs->getCount()); optiongroup->SetSelection(ADDONGROUP_ALL, true); }
void C_ListBox::LocalFunction(short ID,long P[],_TCHAR *,C_Handler *Hndlr) { switch(ID) { case CLBP_SETUP: Setup(P[0],(short)P[1],Hndlr); break; case CLBP_ADDITEM: AddItem(P[0],(short)P[1],P[2]); break; case CLBP_ADDSCROLLBAR: AddScrollBar(P[0], P[1], P[2], P[3], P[4], P[5]); break; case CLBP_SETITEMFLAGS: SetItemFlags(P[0],P[1]); break; case CLBP_SETBGIMAGE: SetBgImage(P[0]); break; case CLBP_SETBGFILL: SetBgFill((short)P[0],(short)P[1],(short)P[2],(short)P[3]); break; case CLBP_SETBGCOLOR: SetBgColor(P[0] | (P[1] << 8) | (P[2] << 16)); break; case CLBP_SETNORMALCOLOR: SetNormColor(P[0] | (P[1] << 8) | (P[2] << 16)); break; case CLBP_SETSELCOLOR: SetSelColor(P[0] | (P[1] << 8) | (P[2] << 16)); break; case CLBP_SETBARCOLOR: SetBarColor(P[0] | (P[1] << 8) | (P[2] << 16)); break; case CLBP_SETLABELCOLOR: SetLabelColor(P[0] | (P[1] << 8) | (P[2] << 16)); break; case CLBP_SETVALUE: SetValue(P[0]); break; case CLBP_ITEMGROUP: SetItemGroup(P[0],P[1]); break; case CLBP_ITEMCLUSTER: SetItemCluster(P[0],P[1]); break; case CLBP_ITEMUSERDATA: SetItemUserData(P[0],(short)P[1],P[2]); break; case CLBP_SETDROPDOWN: SetDropDown(P[0]); break; } }
ctrlMultiline::ctrlMultiline(Window* parent, unsigned int id, unsigned short x, unsigned short y, unsigned short width, unsigned short height, TextureColor tc, glArchivItem_Font* font, unsigned int format) : Window(x, y, id, parent, width, height), tc(tc), font(font), format(format), lines_in_control((height - 4) / font->getHeight()), draw_box(true) { AddScrollBar(0, width - SCROLLBAR_WIDTH, 0, SCROLLBAR_WIDTH, height, SCROLLBAR_WIDTH, tc, lines_in_control); }
ctrlList::ctrlList(Window* parent, unsigned int id, unsigned short x, unsigned short y, unsigned short width, unsigned short height, TextureColor tc, glArchivItem_Font* font) : Window(x, y, id, parent, width, height), tc(tc), font(font), selection_(-1), mouseover(-1) { pagesize = (height - 4) / font->getHeight(); AddScrollBar(0, width - 20, 0, 20, height, 20, tc, pagesize); }
/** * Konstruktor von @p ctrlTable * * @author OLiver */ ctrlTable::ctrlTable(Window *parent, unsigned int id, unsigned short x, unsigned short y, unsigned short width, unsigned short height, TextureColor tc, glArchivItem_Font *font, unsigned short column_count, va_list liste) : Window(x, y, id, parent, width, height), tc(tc), font(font), row_l_selection(0xFFFF), row_r_selection(0xFFFF), sort_column(0xFFFF), sort_direction(true) { header_height = font->getHeight() + 10; line_count = (height - header_height - 2) / font->getHeight(); // Scrollbar hinzufügen AddScrollBar(0, width - 20, 0, 20, height, 20, tc, line_count); if(column_count > 0) { for(unsigned short i = 0; i < column_count; ++i) { COLUMN c; const char *title = va_arg(liste, const char*); if(title != NULL) c.title = title; c.width = (unsigned short)va_arg(liste, int); c.sortType = (SortType)va_arg(liste, int); // Button für die Spalte hinzufügen AddTextButton(i+1, 0, 0, 0, header_height, tc, c.title, font); columns.push_back(c); } ResetButtonWidths(); } }
iwAddons::iwAddons(GlobalGameSettings& ggs, Window* parent, ChangePolicy policy, std::vector<AddonId> addonIds) : IngameWindow(CGI_ADDONS, IngameWindow::posLastOrCenter, Extent(700, 500), _("Addon Settings"), LOADER.GetImageN("resource", 41), true, false, parent), ggs(ggs), policy(policy), addonIds(std::move(addonIds)) { AddText(0, DrawPoint(20, 30), _("Additional features:"), COLOR_YELLOW, FontStyle{}, NormalFont); Extent btSize(200, 22); if(policy != READONLY) AddTextButton(1, DrawPoint(20, GetSize().y - 40), btSize, TC_GREEN2, _("Apply"), NormalFont, _("Apply Changes")); AddTextButton(2, DrawPoint(250, GetSize().y - 40), btSize, TC_RED1, _("Abort"), NormalFont, _("Close Without Saving")); if(policy != READONLY) AddTextButton(3, DrawPoint(480, GetSize().y - 40), btSize, TC_GREY, _("Default"), NormalFont, _("Use S2 Defaults")); // Kategorien ctrlOptionGroup* optiongroup = AddOptionGroup(5, ctrlOptionGroup::CHECK); btSize = Extent(120, 22); // "Alle" optiongroup->AddTextButton(ADDONGROUP_ALL, DrawPoint(20, 50), btSize, TC_GREEN2, _("All"), NormalFont); // "Militär" optiongroup->AddTextButton(ADDONGROUP_MILITARY, DrawPoint(150, 50), btSize, TC_GREEN2, _("Military"), NormalFont); // "Wirtschaft" optiongroup->AddTextButton(ADDONGROUP_ECONOMY, DrawPoint(290, 50), btSize, TC_GREEN2, _("Economy"), NormalFont); // "Spielverhalten" optiongroup->AddTextButton(ADDONGROUP_GAMEPLAY, DrawPoint(430, 50), btSize, TC_GREEN2, _("Gameplay"), NormalFont); // "Sonstiges" optiongroup->AddTextButton(ADDONGROUP_OTHER, DrawPoint(560, 50), btSize, TC_GREEN2, _("Other"), NormalFont); ctrlScrollBar* scrollbar = AddScrollBar(6, DrawPoint(GetSize().x - SCROLLBAR_WIDTH - 20, 90), Extent(SCROLLBAR_WIDTH, GetSize().y - 140), SCROLLBAR_WIDTH, TC_GREEN2, (GetSize().y - 140) / 30 - 1); scrollbar->SetRange(ggs.getNumAddons()); optiongroup->SetSelection(ADDONGROUP_ALL, true); }
/** * Create an instance of class EditorWindow * * @param row the initial row * @param col the initial column * @param rows the number of rows * @param cols the number of columns */ EditorWindow::EditorWindow(int row, int col, int rows, int cols) : Window("Untitled", row, col, rows, cols, 4, 7) { editor = NULL; inactiveFrameColor = 6; // Add scroll bars AddScrollBar(true, 16, 3); AddScrollBar(false, 2, 2); HorizScrollBar()->SetBGColor(6); HorizScrollBar()->SetFGColor(4); VertScrollBar()->SetBGColor(6); VertScrollBar()->SetFGColor(4); // Add the split pane splitPane = new SplitPane(this, SPLITPANE_HORIZONTAL, 0, 0, ClientRows(), ClientColumns()); splitPane->SetSplit(ClientRows() - 3); splitPane->SetMainComponent(SPLITPANE_COMPONENT_FIRST); splitPane->SetOneComponentMode(SPLITPANE_COMPONENT_FIRST); // Add the editor editor = new Editor(splitPane, true, 0, 0, splitPane->Rows(), splitPane->Columns(), ANCHOR_ALL); editor->SetBGColor(BGColor()); editor->SetFGColor(FGColor()); editor->SetScrollBars(HorizScrollBar(), VertScrollBar()); // Add the tools pane toolContainer = new Container(splitPane); toolContainer->SetCapturesFocus(true); Label* findLabel = new Label(toolContainer, "Find:", 0, 1, 1, 8); findLabel->SetAlignment(ALIGN_RIGHT); int e = findLabel->Column() + findLabel->Columns() + 1; int r = findLabel->Row(); patternEditor = new Editor(toolContainer, false, r, e, 1, toolContainer->ClientColumns() - e - 1 - 3 * (3 + 1), ANCHOR_LEFT | ANCHOR_TOP | ANCHOR_RIGHT); patternEditor->RegisterEventHandler(this); /*ignoreCaseCheckBox = new CheckBox(toolContainer, "Ignore Case", false,1,1); regexCheckBox = new CheckBox(toolContainer, "Regular Expression", false, 1, ignoreCaseCheckBox->Column() + ignoreCaseCheckBox->Columns() + 2);*/ e = patternEditor->Column() + patternEditor->Columns() + 1; searchPrevButton = new Button(toolContainer, "<", r, e, -1, ANCHOR_TOP | ANCHOR_RIGHT); searchPrevButton->RegisterEventHandler(this); e += searchPrevButton->Columns() + 1; searchNextButton = new Button(toolContainer, ">", r, e, -1, ANCHOR_TOP | ANCHOR_RIGHT); searchNextButton->RegisterEventHandler(this); e += searchNextButton->Columns() + 1; searchCloseButton = new Button(toolContainer, "X", r, e, -1, ANCHOR_TOP | ANCHOR_RIGHT); searchCloseButton->RegisterEventHandler(this); e += searchCloseButton->Columns() + 1; toolContainer->SetMinSize(2, 60); }