OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
C4StartupScenSelDlg.h
Go to the documentation of this file.
1 /*
2  * OpenClonk, http://www.openclonk.org
3  *
4  * Copyright (c) 2005-2009, RedWolf Design GmbH, http://www.clonk.de/
5  * Copyright (c) 2009-2016, The OpenClonk Team and contributors
6  *
7  * Distributed under the terms of the ISC license; see accompanying file
8  * "COPYING" for details.
9  *
10  * "Clonk" is a registered trademark of Matthes Bender, used with permission.
11  * See accompanying file "TRADEMARK" for details.
12  *
13  * To redistribute this file separately, substitute the full license texts
14  * for the above references.
15  */
16 // Startup screen for non-parameterized engine start: Scenario selection dialog
17 
18 #ifndef INC_C4StartupScenSelDlg
19 #define INC_C4StartupScenSelDlg
20 
21 #include "gui/C4Folder.h"
22 #include "gui/C4Startup.h"
23 #include "landscape/C4Scenario.h"
25 #include "player/C4Achievement.h"
26 
28 
38  C4StartupScenSel_TitleOverlayMargin = 20, // number of pixels to each side of title overlay picture
39  C4StartupScenSel_MaxAchievements = 3; // maximum number of achievements shown next to entry
40 
41 // a list of loaded scenarios
43 {
44 public:
45  class Folder;
46  // either a scenario or scenario folder; manages singly linked tree
47  class Entry
48  {
49  protected:
52  class Folder *pParent;
53 
54  friend class Folder;
55 
56  protected:
63 
64  public:
65  Entry(class C4ScenarioListLoader *pLoader, class Folder *pParent);
66  virtual ~Entry(); // dtor: unlink from tree
67 
68  bool Load(C4Group *pFromGrp, const StdStrBuf *psFilename, bool fLoadEx); // load as child if pFromGrp, else directly from filename
69  virtual bool LoadCustom(C4Group &rGrp, bool fNameLoaded, bool fIconLoaded) { return true; } // load custom data for entry type (e.g. scenario title fallback in Scenario.txt)
70  virtual bool LoadCustomPre(C4Group &rGrp) { return true; } // preload stuff that's early in the group (Scenario.txt)
71  virtual bool Start() = 0; // start/open entry
72  virtual Folder *GetIsFolder() { return nullptr; } // return this if this is a folder
73 
74  const StdStrBuf &GetName() const { return sName; }
75  const StdStrBuf &GetEntryFilename() const { return sFilename; }
76  const StdStrBuf &GetVersion() const { return sVersion; }
77  const StdStrBuf &GetAuthor() const { return sAuthor; }
78  const C4Facet &GetIconFacet() const { return fctIcon; }
79  const C4Facet &GetTitlePicture() const { return fctTitle; }
80  const StdStrBuf &GetDesc() const { return sDesc; }
81  int GetIconIndex() { return iIconIndex; }
82  int GetDifficulty() { return iDifficulty; }
83  int GetFolderIndex() { return iFolderIndex; }
84  Entry *GetNext() const { return pNext; }
85  class Folder *GetParent() const { return pParent; }
86  virtual StdStrBuf GetTypeName() = 0;
87  virtual bool GetAchievement(int32_t idx, C4Facet *out_facet, const char **out_description) { return false; } // return true and fill output parameters if player got the indexed achievement
88 
89  static Entry *CreateEntryForFile(const StdStrBuf &sFilename, C4ScenarioListLoader *pLoader, Folder *pParent); // create correct entry type based on file extension
90 
91  virtual bool CanOpen(StdStrBuf &sError) { return true; } // whether item can be started/opened (e.g. mission access, unregistered)
92  virtual bool IsGrayed() { return false; } // additional condition for graying out - notice unreg folders are grayed but can still be opened
93  virtual bool IsHidden() { return false; } // condition for hiding element completely
94  virtual bool HasMissionAccess() const { return true; }
95  virtual bool HasUnregisteredAccess() const { return false; }
96  virtual StdStrBuf GetOpenText() = 0; // get open button text
97  virtual StdStrBuf GetOpenTooltip() = 0;
98 
99  virtual const char *GetDefaultExtension() { return nullptr; } // extension to be added when item is renamed
100  virtual bool SetTitleInGroup(C4Group &rGrp, const char *szNewTitle);
101  bool RenameTo(const char *szNewName); // change name+filename
102  virtual bool IsScenario() { return false; }
103 
104  virtual C4ScenarioParameterDefs *GetParameterDefs() { return nullptr; }
105  virtual C4ScenarioParameters *GetParameters() { return nullptr; }
106  };
107 
108  // a loaded scenario to be started
109  class Scenario : public Entry
110  {
111  private:
112  C4Scenario C4S;
113  C4ScenarioParameterDefs ParameterDefs;
114  C4ScenarioParameters Parameters; // each entry caches its parameters set by the user
116  StdCopyStrBuf sAchievementDescriptions[C4StartupScenSel_MaxAchievements];
117  int32_t nAchievements;
118  bool fNoMissionAccess;
119  int32_t iMinPlrCount;
120 
121  public:
122  Scenario(class C4ScenarioListLoader *pLoader, class Folder *pParent) : Entry(pLoader, pParent), fNoMissionAccess(false), nAchievements(0), iMinPlrCount(0) {}
123  ~Scenario() override = default;
124 
125  bool LoadCustom(C4Group &rGrp, bool fNameLoaded, bool fIconLoaded) override; // do fallbacks for title and icon; check whether scenario is valid
126  bool LoadCustomPre(C4Group &rGrp) override; // load scenario core
127  bool Start() override; // launch scenario!
128 
129  bool CanOpen(StdStrBuf &sError) override; // check mission access, player count, etc.
130  bool IsGrayed() override { return false; } // additional option for graying out
131  bool IsHidden() override { return C4S.Head.Secret && !HasMissionAccess(); } // condition for hiding element completely
132  bool HasMissionAccess() const override { return !fNoMissionAccess; }; // check mission access only
133  StdStrBuf GetOpenText() override; // get open button text
134  StdStrBuf GetOpenTooltip() override;
135  const C4Scenario &GetC4S() const { return C4S; } // get scenario core
136  bool GetAchievement(int32_t idx, C4Facet *out_facet, const char **out_description) override; // return true and fill output parameters if player got the indexed achievement
137 
138  StdStrBuf GetTypeName() override { return StdCopyStrBuf(LoadResStr("IDS_TYPE_SCENARIO"), true); }
139 
140  const char *GetDefaultExtension() override { return "ocs"; }
141 
142  C4ScenarioParameterDefs *GetParameterDefs() override { return &ParameterDefs; }
143  C4ScenarioParameters *GetParameters() override { return &Parameters; }
144 
145  bool IsScenario() override { return true; }
146  };
147 
148  // scenario folder
149  class Folder : public Entry
150  {
151  protected:
153  bool fContentsLoaded; // if set, directory contents are already loaded
154  Entry *pFirst; // tree structure
155  class C4MapFolderData *pMapData; // if set, contains gfx and data for special map-style folders
156  friend class Entry;
157 
158  public:
159  Folder(class C4ScenarioListLoader *pLoader, Folder *pParent) : Entry(pLoader, pParent), fContentsLoaded(false), pFirst(nullptr), pMapData(nullptr) {}
160  ~Folder() override;
161 
162  bool LoadCustomPre(C4Group &rGrp) override; // load folder core
163 
164  bool LoadContents(C4ScenarioListLoader *pLoader, C4Group *pFromGrp, const StdStrBuf *psFilename, bool fLoadEx, bool fReload); // load folder contents as child if pFromGrp, else directly from filename
165  uint32_t GetEntryCount() const;
166 
167  protected:
168  void ClearChildren();
169  void Sort();
170  virtual bool DoLoadContents(C4ScenarioListLoader *pLoader, C4Group *pFromGrp, const StdStrBuf &sFilename, bool fLoadEx) = 0; // load folder contents as child if pFromGrp, else directly from filename
171 
172  public:
173  bool Start() override; // open as subfolder
174  Folder *GetIsFolder() override { return this; } // this is a folder
175  Entry *GetFirstEntry() const { return pFirst; }
176  void Resort() { Sort(); }
177  Entry *FindEntryByName(const char *szFilename) const; // find entry by filename comparison
178 
179  bool CanOpen(StdStrBuf &sError) override { return true; } // can always open folders
180  bool IsGrayed() override; // unreg folders can be opened to view stuff but they are still grayed out for clarity
181  StdStrBuf GetOpenText() override; // get open button text
182  StdStrBuf GetOpenTooltip() override;
183  C4MapFolderData *GetMapData() const { return pMapData; }
184 
185  virtual const C4ScenarioParameterDefs *GetAchievementDefs() const { return nullptr; }
186  virtual const C4AchievementGraphics *GetAchievementGfx() const { return nullptr; }
187  };
188 
189  // .ocf subfolder: Read through by group
190  class SubFolder : public Folder
191  {
192  private:
193  C4ScenarioParameterDefs AchievementDefs;
194  C4AchievementGraphics AchievementGfx;
195 
196  public:
197  SubFolder(class C4ScenarioListLoader *pLoader, Folder *pParent) : Folder(pLoader, pParent) {}
198  ~SubFolder() override = default;
199 
200  const char *GetDefaultExtension() override { return "ocf"; }
201 
202  StdStrBuf GetTypeName() override { return StdCopyStrBuf(LoadResStr("IDS_TYPE_FOLDER"), true); }
203 
204  const C4ScenarioParameterDefs *GetAchievementDefs() const override { return &AchievementDefs; }
205  const C4AchievementGraphics *GetAchievementGfx() const override { return &AchievementGfx; }
206 
207  protected:
208  bool LoadCustom(C4Group &rGrp, bool fNameLoaded, bool fIconLoaded) override; // load custom data for entry type - icon fallback to folder icon
209  bool DoLoadContents(C4ScenarioListLoader *pLoader, C4Group *pFromGrp, const StdStrBuf &sFilename, bool fLoadEx) override; // load folder contents as child if pFromGrp, else directly from filename
210  };
211 
212  // regular, open folder: Read through by directory iterator
213  class RegularFolder : public Folder
214  {
215  public:
217  ~RegularFolder() override;
218 
219  StdStrBuf GetTypeName() override { return StdCopyStrBuf(LoadResStr("IDS_TYPE_DIRECTORY"), true); }
220 
221  void Merge(const char *szPath);
222 
223  protected:
224  bool LoadCustom(C4Group &rGrp, bool fNameLoaded, bool fIconLoaded) override; // load custom data for entry type - icon fallback to folder icon
225  bool DoLoadContents(C4ScenarioListLoader *pLoader, C4Group *pFromGrp, const StdStrBuf &sFilename, bool fLoadEx) override; // load folder contents as child if pFromGrp, else directly from filename
226 
227  typedef std::list<std::string> NameList;
228  NameList contents;
229  };
230 
231 private:
232  RegularFolder *pRootFolder;
233  Folder *pCurrFolder; // scenario list in working directory
234  int32_t iLoading, iProgress, iMaxProgress;
235  bool fAbortThis, fAbortPrevious; // activity state
236  const C4ScenarioParameters &Achievements;
237 
238 public:
239  C4ScenarioListLoader(const C4ScenarioParameters &Achievements);
241 
242 private:
243  // activity control (to be replaced by true multithreading)
244  bool BeginActivity(bool fAbortPrevious);
245  void EndActivity();
246 
247 public:
248  bool DoProcessCallback(int32_t iProgress, int32_t iMaxProgress); // returns false if the activity was aborted
249 
250 public:
251  bool Load(const StdStrBuf &sRootFolder); // (unthreaded) loading of all entries in root folder
252  bool Load(Folder *pSpecifiedFolder, bool fReload); // (unthreaded) loading of all entries in subfolder
253  bool LoadExtended(Entry *pEntry); // (unthreaded) loading of desc and title image of specified entry
254  bool FolderBack(); // go upwards by one folder
255  bool ReloadCurrent(); // reload file list
256  bool IsLoading() const { return !!iLoading; }
257  Entry *GetFirstEntry() const { return pCurrFolder ? pCurrFolder->GetFirstEntry() : nullptr; }
258 
259  Folder *GetCurrFolder() const { return pCurrFolder; }
260  Folder *GetRootFolder() const { return pRootFolder; }
261 
262  int32_t GetProgress() const { return iProgress; }
263  int32_t GetMaxProgress() const { return iMaxProgress; }
264  int32_t GetProgressPercent() const { return iProgress * 100 / std::max<int32_t>(iMaxProgress, 1); }
265 
266  const C4ScenarioParameters &GetAchievements() const { return Achievements; }
267 };
268 
269 
270 // -----------------------------------------------
271 
272 
273 
274 // for map-style folders: Data for map display
276 {
277 private:
278  struct Scenario
279  {
280  // compiled data
281  StdStrBuf sFilename;
282  StdStrBuf sBaseImage, sOverlayImage;
283 
284  // parameters for title as drawn on the map (if desired; otherwise sTitle empty)
285  StdStrBuf sTitle;
286  int32_t iTitleFontSize;
287  uint32_t dwTitleInactClr, dwTitleActClr;
288  int32_t iTitleOffX, iTitleOffY;
289  uint8_t byTitleAlign;
290  bool fTitleBookFont;
291  bool fImgDump; // developer help: Dump background image part
292 
293  C4Rect rcOverlayPos;
294  FLOAT_RECT rcfOverlayPos;
295 
296  // set during initialization
297  C4FacetSurface fctBase, fctOverlay;
298  C4ScenarioListLoader::Entry *pScenEntry;
299  C4GUI::Button *pBtn; // used to resolve button events to scenario
300 
301  void CompileFunc(StdCompiler *pComp);
302  };
303 
304  struct AccessGfx
305  {
306  // compiled data
307  StdStrBuf sPassword;
308  StdStrBuf sOverlayImage;
309  C4Rect rcOverlayPos;
310  FLOAT_RECT rcfOverlayPos;
311 
312  // set during initialization
313  C4FacetSurface fctOverlay;
314 
315  void CompileFunc(StdCompiler *pComp);
316  };
317 
318  // non-interactive map item
319  class MapPic : public C4GUI::Picture
320  {
321  private:
322  FLOAT_RECT rcfBounds; // drawing bounds
323  public:
324  MapPic(const FLOAT_RECT &rcfBounds, const C4Facet &rfct); // ctor
325 
326  void MouseInput(C4GUI::CMouse &rMouse, int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyParam) override; // input: mouse movement or buttons - deselect everything if clicked
327 
328  protected:
329  void DrawElement(C4TargetFacet &cgo) override; // draw the image
330  };
331 
332 private:
333  C4FacetSurface fctBackgroundPicture; FLOAT_RECT rcfBG;
334  bool fCoordinatesAdjusted{false};
335  C4Rect rcScenInfoArea; // area in which scenario info is displayed
336  class C4ScenarioListLoader::Folder *pScenarioFolder;
337  class C4ScenarioListLoader::Entry *pSelectedEntry;
338  C4GUI::TextWindow *pSelectionInfoBox;
339  int32_t MinResX, MinResY; // minimum resolution for display of the map
340  bool fUseFullscreenMap;
341  Scenario **ppScenList{nullptr}; int32_t iScenCount{0};
342  AccessGfx **ppAccessGfxList{nullptr}; int32_t iAccessGfxCount{0};
343  class C4StartupScenSelDlg *pMainDlg{nullptr};
344 
345 public:
346  C4MapFolderData() = default;
348 
349 private:
350  void ConvertFacet2ScreenCoord(const C4Rect &rc, FLOAT_RECT *pfrc, float fBGZoomX, float fBGZoomY, int iOffX, int iOffY);
351  void ConvertFacet2ScreenCoord(int32_t *piValue, float fBGZoom, int iOff);
352  void ConvertFacet2ScreenCoord(C4Rect &rcMapArea, bool fAspect); // adjust coordinates of loaded facets so they match given area
353 
354 protected:
355  void OnButtonScenario(C4GUI::Control *pEl);
356 
357  friend class C4StartupScenSelDlg;
358 
359 public:
360  void Clear();
361  bool Load(C4Group &hGroup, C4ScenarioListLoader::Folder *pScenLoaderFolder);
362  void CompileFunc(StdCompiler *pComp);
363  void CreateGUIElements(C4StartupScenSelDlg *pMainDlg, C4GUI::Window &rContainer);
364  void ResetSelection();
365 
366  C4GUI::TextWindow *GetSelectionInfoBox() const { return pSelectionInfoBox; }
367  C4ScenarioListLoader::Entry *GetSelectedEntry() const { return pSelectedEntry; }
368 };
369 
370 
371 
372 
373 // -----------------------------------------------
374 
375 // startup dialog: Scenario selection
377 {
378 public:
379  // one item in the scenario list
381  {
382  private:
383  typedef C4GUI::Window BaseClass;
384  // subcomponents
385  C4GUI::Picture *pIcon; // item icon
386  C4GUI::Label *pNameLabel; // item caption
387  C4GUI::Picture *ppAchievements[C4StartupScenSel_MaxAchievements]; // achievement icons
388  C4ScenarioListLoader::Entry *pScenListEntry; // associated, loaded item info
389 
390  public:
391  ScenListItem(C4GUI::ListBox *pForListBox, C4ScenarioListLoader::Entry *pForEntry, C4GUI::Element *pInsertBeforeElement=nullptr);
392 
393  protected:
394  struct RenameParams { };
395  void AbortRenaming(RenameParams par);
396  C4GUI::RenameEdit::RenameResult DoRenaming(RenameParams par, const char *szNewName);
397  public:
398  bool KeyRename();
399 
400  protected:
401  void UpdateOwnPos() override; // recalculate item positioning
402  void Update() {}
403 
404  public:
405  void MouseInput(C4GUI::CMouse &rMouse, int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyParam) override;
406  C4ScenarioListLoader::Entry *GetEntry() const { return pScenListEntry; }
407  ScenListItem *GetNext() { return static_cast<ScenListItem *>(BaseClass::GetNext()); }
408 
409  bool CheckNameHotkey(const char * c) override; // return whether this item can be selected by entering given char
410  };
411 
412 public:
413  C4StartupScenSelDlg(bool fNetwork); // ctor
414  ~C4StartupScenSelDlg() override; // dtor
415 
416 private:
417  enum { ShowStyle_Book=0, ShowStyle_Map=1 };
418  enum { IconLabelSpacing = 2 }; // space between an icon and its text
419 
420  // book style scenario selection
421  C4GUI::Label *pScenSelCaption; // caption label atop scenario list; indicating current folder
422  C4GUI::ListBox *pScenSelList; // left page of book: Scenario selection
423  C4GUI::Label *pScenSelProgressLabel; // progress label shown while scenario list is being generated
424  C4GUI::TextWindow *pSelectionInfo; // used to display the description of the current selection
425  class C4GameOptionsList *pSelectionOptions; // displays custom scenario options for selected item below description
426 
427  C4KeyBinding *pKeyRefresh, *pKeyBack, *pKeyForward, *pKeyRename, *pKeyDelete, *pKeyCheat;
428  class C4GameOptionButtons *pGameOptionButtons;
429  C4GUI::Button *pOpenBtn;
430  C4GUI::Tabular *pScenSelStyleTabular;
431 
432  C4ScenarioListLoader *pScenLoader;
433 
434  // map style scenario selection
435  C4MapFolderData *pMapData;
436  C4Facet *pfctBackground;
437 
438  bool fIsInitialLoading;
439  bool fStartNetworkGame;
440 
441  C4GUI::RenameEdit *pRenameEdit;
442 
443  // achievements of all activated players
444  C4ScenarioParameters Achievements;
445 
446 public:
447  static C4StartupScenSelDlg *pInstance; // singleton
448 
449 protected:
450  int32_t GetMarginTop() override { return (rcBounds.Hgt/7); }
451  bool HasBackground() override { return false; }
452  void DrawElement(C4TargetFacet &cgo) override;
453 
454  bool OnEnter() override { DoOK(); return true; }
455  bool OnEscape() override { DoBack(true); return true; }
456  bool KeyBack() { return DoBack(true); }
457  bool KeyRefresh() { DoRefresh(); return true; }
458  bool KeyForward() { DoOK(); return true; }
459  bool KeyRename();
460  bool KeyDelete();
461  bool KeyCheat();
462  void KeyCheat2(const StdStrBuf &rsCheatCode);
463 
464  void DeleteConfirm(ScenListItem *pSel);
465 
466  void OnShown() override; // callback when shown: Init file list
467  void OnClosed(bool fOK) override; // callback when dlg got closed: Return to main screen
468  void OnBackBtn(C4GUI::Control *btn) { DoBack(true); }
469  void OnNextBtn(C4GUI::Control *btn) { DoOK(); }
470  void OnSelChange(class C4GUI::Element *pEl) { UpdateSelection(); }
471  void OnSelDblClick(class C4GUI::Element *pEl) { DoOK(); }
472  void OnButtonScenario(C4GUI::Control *pEl);
473 
474  void OnLeagueOptionChanged() override;
475 
476  friend class C4MapFolderData;
477 
478 private:
479  void UpdateList();
480  void UpdateSelection();
481  void ResortFolder();
482  ScenListItem *GetSelectedItem();
484  void SetOpenButtonDefaultText();
485  void FocusScenList();
486  void UpdateAchievements();
487 
488 public:
490  bool OpenFolder(C4ScenarioListLoader::Folder *pNewFolder);
491  void ProcessCallback() { UpdateList(); } // process callback by loader
492  bool DoOK(); // open/start currently selected item
493  bool DoBack(bool fAllowClose); // back folder, or abort dialog
494  void DoRefresh(); // refresh file list
495  void DeselectAll(); // reset focus and update selection info
496 
497  void StartRenaming(C4GUI::RenameEdit *pNewRenameEdit);
498  void AbortRenaming();
499  bool IsRenaming() const { return !!pRenameEdit; }
500  void SetRenamingDone() { pRenameEdit=nullptr; }
501 
502  void SetBackground(C4Facet *pNewBG) { pfctBackground=pNewBG; }
503 
504  bool IsNetworkStart() const { return fStartNetworkGame; }
505 
506  friend class ScenListItem;
507 };
508 
509 
510 #endif // INC_C4StartupScenSelDlg
void MouseInput(C4GUI::CMouse &rMouse, int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyParam) override
const int32_t C4StartupScenSel_DefaultIcon_WinFolder
const int32_t C4StartupScenSel_TitlePictureWdt
int32_t GetProgressPercent() const
const char * GetDefaultExtension() override
void OnClosed(bool fOK) override
bool LoadExtended(Entry *pEntry)
const int32_t C4StartupScenSel_IconCount
void OnSelChange(class C4GUI::Element *pEl)
virtual bool DoLoadContents(C4ScenarioListLoader *pLoader, C4Group *pFromGrp, const StdStrBuf &sFilename, bool fLoadEx)=0
virtual const C4ScenarioParameterDefs * GetAchievementDefs() const
void StartRenaming(C4GUI::RenameEdit *pNewRenameEdit)
bool CanOpen(StdStrBuf &sError) override
const int32_t C4StartupScenSel_DefaultIcon_OldIconBG
StdCopyStrBuf sAuthor
C4GUI::TextWindow * GetSelectionInfoBox() const
virtual bool IsHidden()
bool StartScenario(C4ScenarioListLoader::Scenario *pStartScen)
virtual bool HasUnregisteredAccess() const
SubFolder(class C4ScenarioListLoader *pLoader, Folder *pParent)
C4GUI::RenameEdit::RenameResult DoRenaming(RenameParams par, const char *szNewName)
void OnSelDblClick(class C4GUI::Element *pEl)
C4MapFolderData()=default
C4ScenarioListLoader(const C4ScenarioParameters &Achievements)
virtual const C4AchievementGraphics * GetAchievementGfx() const
void SetBackground(C4Facet *pNewBG)
~Scenario() override=default
bool HasBackground() override
Definition: C4Rect.h:27
virtual const char * GetDefaultExtension()
Entry * pNext
RegularFolder(class C4ScenarioListLoader *pLoader, Folder *pParent)
void OnButtonScenario(C4GUI::Control *pEl)
int GetFolderIndex()
void DrawElement(C4TargetFacet &cgo) override
const C4Scenario & GetC4S() const
C4ScenarioParameters * GetParameters() override
StdCopyStrBuf sDesc
const StdStrBuf & GetAuthor() const
virtual bool IsScenario()
virtual StdStrBuf GetOpenText()=0
virtual ~Entry()
bool LoadCustom(C4Group &rGrp, bool fNameLoaded, bool fIconLoaded) override
StdCopyStrBuf sName
StdCopyStrBuf sFilename
bool fOK
Definition: C4Gui.h:2082
const StdStrBuf & GetVersion() const
void CreateGUIElements(C4StartupScenSelDlg *pMainDlg, C4GUI::Window &rContainer)
bool LoadCustomPre(C4Group &rGrp) override
const char * LoadResStr(const char *id)
Definition: C4Language.h:83
const StdStrBuf & GetDesc() const
C4StartupScenSelDlg(bool fNetwork)
int iDifficulty
void KeyCheat2(const StdStrBuf &rsCheatCode)
int32_t GetMarginTop() override
const int32_t C4StartupScenSel_TitlePictureHgt
bool DoLoadContents(C4ScenarioListLoader *pLoader, C4Group *pFromGrp, const StdStrBuf &sFilename, bool fLoadEx) override
StdCopyStrBuf sVersion
const C4AchievementGraphics * GetAchievementGfx() const override
const int32_t C4StartupScenSel_TitleOverlayMargin
void CompileFunc(StdCompiler *pComp)
bool DoProcessCallback(int32_t iProgress, int32_t iMaxProgress)
void OnButtonScenario(C4GUI::Control *pEl)
bool CanOpen(StdStrBuf &sError) override
virtual bool LoadCustom(C4Group &rGrp, bool fNameLoaded, bool fIconLoaded)
C4Rect rcBounds
Definition: C4Gui.h:385
bool GetAchievement(int32_t idx, C4Facet *out_facet, const char **out_description) override
int iIconIndex
virtual StdStrBuf GetTypeName()=0
const int32_t C4StartupScenSel_DefaultIcon_SavegamesFolder
virtual bool SetTitleInGroup(C4Group &rGrp, const char *szNewTitle)
const int32_t C4StartupScenSel_TitlePicturePadding
virtual bool HasMissionAccess() const
static Entry * CreateEntryForFile(const StdStrBuf &sFilename, C4ScenarioListLoader *pLoader, Folder *pParent)
bool DoLoadContents(C4ScenarioListLoader *pLoader, C4Group *pFromGrp, const StdStrBuf &sFilename, bool fLoadEx) override
Folder * GetRootFolder() const
virtual Folder * GetIsFolder()
Entry(class C4ScenarioListLoader *pLoader, class Folder *pParent)
bool DoBack(bool fAllowClose)
virtual StdStrBuf GetOpenTooltip()=0
bool HasMissionAccess() const override
void OnNextBtn(C4GUI::Control *btn)
bool OpenFolder(C4ScenarioListLoader::Folder *pNewFolder)
bool Load(const StdStrBuf &sRootFolder)
C4FacetSurface fctIcon
class C4MapFolderData * pMapData
bool fBaseLoaded
Element * GetNext() const
Definition: C4Gui.h:449
int32_t GetProgress() const
Entry * GetFirstEntry() const
virtual C4ScenarioParameters * GetParameters()
bool fExLoaded
int32_t GetMaxProgress() const
const int32_t C4StartupScenSel_DefaultIcon_Folder
virtual bool IsGrayed()
class C4ScenarioListLoader * pLoader
Scenario(class C4ScenarioListLoader *pLoader, class Folder *pParent)
class Folder * GetParent() const
bool LoadContents(C4ScenarioListLoader *pLoader, C4Group *pFromGrp, const StdStrBuf *psFilename, bool fLoadEx, bool fReload)
const C4Facet & GetTitlePicture() const
bool LoadCustomPre(C4Group &rGrp) override
bool Secret
Definition: C4Scenario.h:77
ScenListItem(C4GUI::ListBox *pForListBox, C4ScenarioListLoader::Entry *pForEntry, C4GUI::Element *pInsertBeforeElement=nullptr)
void OnBackBtn(C4GUI::Control *btn)
bool IsNetworkStart() const
const StdStrBuf & GetName() const
const int32_t C4StartupScenSel_DefaultIcon_Scenario
bool LoadCustom(C4Group &rGrp, bool fNameLoaded, bool fIconLoaded) override
bool Load(C4Group *pFromGrp, const StdStrBuf *psFilename, bool fLoadEx)
void DeleteConfirm(ScenListItem *pSel)
int32_t Hgt
Definition: C4Rect.h:30
C4ScenarioListLoader::Entry * GetSelectedEntry() const
C4SHead Head
Definition: C4Scenario.h:230
C4ScenarioListLoader::Entry * GetEntry() const
const int32_t C4StartupScenSel_MaxAchievements
Folder * GetCurrFolder() const
int GetDifficulty()
Folder(class C4ScenarioListLoader *pLoader, Folder *pParent)
uint32_t DWORD
bool CheckNameHotkey(const char *c) override
virtual bool Start()=0
Entry * FindEntryByName(const char *szFilename) const
bool LoadCustom(C4Group &rGrp, bool fNameLoaded, bool fIconLoaded) override
C4ScenarioParameterDefs * GetParameterDefs() override
~SubFolder() override=default
int iFolderIndex
const C4Facet & GetIconFacet() const
const StdStrBuf & GetEntryFilename() const
const C4ScenarioParameters & GetAchievements() const
void OnLeagueOptionChanged() override
class Folder * pParent
bool OnEscape() override
virtual bool LoadCustomPre(C4Group &rGrp)
C4MapFolderData * GetMapData() const
virtual bool GetAchievement(int32_t idx, C4Facet *out_facet, const char **out_description)
virtual bool CanOpen(StdStrBuf &sError)
int GetIconIndex()
bool Load(C4Group &hGroup, C4ScenarioListLoader::Folder *pScenLoaderFolder)
const char * GetDefaultExtension() override
const C4ScenarioParameterDefs * GetAchievementDefs() const override
C4FacetSurface fctTitle
bool RenameTo(const char *szNewName)
virtual C4ScenarioParameterDefs * GetParameterDefs()
static C4StartupScenSelDlg * pInstance
Entry * GetNext() const