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" 24 #include "player/C4ScenarioParameters.h" 25 #include "player/C4Achievement.h" 26 27 class C4StartupScenSelDlg; 28 29 const int32_t C4StartupScenSel_DefaultIcon_Scenario = 14, 30 C4StartupScenSel_DefaultIcon_Folder = 0, 31 C4StartupScenSel_DefaultIcon_SavegamesFolder = 29, 32 C4StartupScenSel_DefaultIcon_WinFolder = 44, 33 C4StartupScenSel_DefaultIcon_OldIconBG = 18, 34 C4StartupScenSel_IconCount = 45, 35 C4StartupScenSel_TitlePictureWdt = 640, 36 C4StartupScenSel_TitlePictureHgt = 480, 37 C4StartupScenSel_TitlePicturePadding = 10, 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 42 class C4ScenarioListLoader 43 { 44 public: 45 class Folder; 46 // either a scenario or scenario folder; manages singly linked tree 47 class Entry 48 { 49 protected: 50 class C4ScenarioListLoader *pLoader; 51 Entry *pNext; 52 class Folder *pParent; 53 54 friend class Folder; 55 56 protected: 57 StdCopyStrBuf sName, sFilename, sDesc, sVersion, sAuthor; 58 C4FacetSurface fctIcon, fctTitle; 59 bool fBaseLoaded, fExLoaded; 60 int iIconIndex; 61 int iDifficulty; 62 int iFolderIndex; 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 LoadCustom(C4Group & rGrp,bool fNameLoaded,bool fIconLoaded)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) LoadCustomPre(C4Group & rGrp)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 GetIsFolder()72 virtual Folder *GetIsFolder() { return nullptr; } // return this if this is a folder 73 GetName()74 const StdStrBuf &GetName() const { return sName; } GetEntryFilename()75 const StdStrBuf &GetEntryFilename() const { return sFilename; } GetVersion()76 const StdStrBuf &GetVersion() const { return sVersion; } GetAuthor()77 const StdStrBuf &GetAuthor() const { return sAuthor; } GetIconFacet()78 const C4Facet &GetIconFacet() const { return fctIcon; } GetTitlePicture()79 const C4Facet &GetTitlePicture() const { return fctTitle; } GetDesc()80 const StdStrBuf &GetDesc() const { return sDesc; } GetIconIndex()81 int GetIconIndex() { return iIconIndex; } GetDifficulty()82 int GetDifficulty() { return iDifficulty; } GetFolderIndex()83 int GetFolderIndex() { return iFolderIndex; } GetNext()84 Entry *GetNext() const { return pNext; } GetParent()85 class Folder *GetParent() const { return pParent; } 86 virtual StdStrBuf GetTypeName() = 0; GetAchievement(int32_t idx,C4Facet * out_facet,const char ** out_description)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 CanOpen(StdStrBuf & sError,bool & CanHide)91 virtual bool CanOpen(StdStrBuf &sError, bool &CanHide) { return true; } // whether item can be started/opened (e.g. mission access, unregistered) IsGrayed()92 virtual bool IsGrayed() { return false; } // additional condition for graying out - notice unreg folders are grayed but can still be opened IsHidden()93 virtual bool IsHidden() { return false; } // condition for hiding element completely HasMissionAccess()94 virtual bool HasMissionAccess() const { return true; } HasUnregisteredAccess()95 virtual bool HasUnregisteredAccess() const { return false; } 96 virtual StdStrBuf GetOpenText() = 0; // get open button text 97 virtual StdStrBuf GetOpenTooltip() = 0; 98 GetDefaultExtension()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 IsScenario()102 virtual bool IsScenario() { return false; } 103 GetParameterDefs()104 virtual C4ScenarioParameterDefs *GetParameterDefs() { return nullptr; } GetParameters()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 115 C4FacetSurface fctAchievements[C4StartupScenSel_MaxAchievements]; 116 StdCopyStrBuf sAchievementDescriptions[C4StartupScenSel_MaxAchievements]; 117 int32_t nAchievements; 118 bool fNoMissionAccess; 119 int32_t iMinPlrCount; 120 121 public: Scenario(class C4ScenarioListLoader * pLoader,class Folder * pParent)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, bool &CanHide) override; // check mission access, player count, etc. IsGrayed()130 bool IsGrayed() override { return false; } // additional option for graying out IsHidden()131 bool IsHidden() override { return C4S.Head.Secret && !HasMissionAccess(); } // condition for hiding element completely HasMissionAccess()132 bool HasMissionAccess() const override { return !fNoMissionAccess; }; // check mission access only 133 StdStrBuf GetOpenText() override; // get open button text 134 StdStrBuf GetOpenTooltip() override; GetC4S()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 GetTypeName()138 StdStrBuf GetTypeName() override { return StdCopyStrBuf(LoadResStr("IDS_TYPE_SCENARIO"), true); } 139 GetDefaultExtension()140 const char *GetDefaultExtension() override { return "ocs"; } 141 GetParameterDefs()142 C4ScenarioParameterDefs *GetParameterDefs() override { return &ParameterDefs; } GetParameters()143 C4ScenarioParameters *GetParameters() override { return &Parameters; } 144 IsScenario()145 bool IsScenario() override { return true; } 146 }; 147 148 // scenario folder 149 class Folder : public Entry 150 { 151 protected: 152 C4Folder C4F; 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: Folder(class C4ScenarioListLoader * pLoader,Folder * pParent)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 GetIsFolder()174 Folder *GetIsFolder() override { return this; } // this is a folder GetFirstEntry()175 Entry *GetFirstEntry() const { return pFirst; } Resort()176 void Resort() { Sort(); } 177 Entry *FindEntryByName(const char *szFilename) const; // find entry by filename comparison 178 CanOpen(StdStrBuf & sError,bool & CanHide)179 bool CanOpen(StdStrBuf &sError, bool &CanHide) 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; GetMapData()183 C4MapFolderData *GetMapData() const { return pMapData; } 184 GetAchievementDefs()185 virtual const C4ScenarioParameterDefs *GetAchievementDefs() const { return nullptr; } GetAchievementGfx()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: SubFolder(class C4ScenarioListLoader * pLoader,Folder * pParent)197 SubFolder(class C4ScenarioListLoader *pLoader, Folder *pParent) : Folder(pLoader, pParent) {} 198 ~SubFolder() override = default; 199 GetDefaultExtension()200 const char *GetDefaultExtension() override { return "ocf"; } 201 GetTypeName()202 StdStrBuf GetTypeName() override { return StdCopyStrBuf(LoadResStr("IDS_TYPE_FOLDER"), true); } 203 GetAchievementDefs()204 const C4ScenarioParameterDefs *GetAchievementDefs() const override { return &AchievementDefs; } GetAchievementGfx()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: RegularFolder(class C4ScenarioListLoader * pLoader,Folder * pParent)216 RegularFolder(class C4ScenarioListLoader *pLoader, Folder *pParent) : Folder(pLoader, pParent) {} 217 ~RegularFolder() override; 218 GetTypeName()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 StdCopyStrBuf current_load_info; // extra string for currently loaded item 236 bool fAbortThis, fAbortPrevious; // activity state 237 const C4ScenarioParameters &Achievements; 238 239 public: 240 C4ScenarioListLoader(const C4ScenarioParameters &Achievements); 241 ~C4ScenarioListLoader(); 242 243 private: 244 // activity control (to be replaced by true multithreading) 245 bool BeginActivity(bool fAbortPrevious); 246 void EndActivity(); 247 248 public: 249 bool DoProcessCallback(int32_t iProgress, int32_t iMaxProgress, const char *current_load_info); // returns false if the activity was aborted 250 251 public: 252 bool Load(const StdStrBuf &sRootFolder); // (unthreaded) loading of all entries in root folder 253 bool Load(Folder *pSpecifiedFolder, bool fReload); // (unthreaded) loading of all entries in subfolder 254 bool LoadExtended(Entry *pEntry); // (unthreaded) loading of desc and title image of specified entry 255 bool FolderBack(); // go upwards by one folder 256 bool ReloadCurrent(); // reload file list IsLoading()257 bool IsLoading() const { return !!iLoading; } GetFirstEntry()258 Entry *GetFirstEntry() const { return pCurrFolder ? pCurrFolder->GetFirstEntry() : nullptr; } 259 GetCurrFolder()260 Folder *GetCurrFolder() const { return pCurrFolder; } GetRootFolder()261 Folder *GetRootFolder() const { return pRootFolder; } 262 GetProgress()263 int32_t GetProgress() const { return iProgress; } GetMaxProgress()264 int32_t GetMaxProgress() const { return iMaxProgress; } GetProgressPercent()265 int32_t GetProgressPercent() const { return iProgress * 100 / std::max<int32_t>(iMaxProgress, 1); } GetProgressInfo()266 const char *GetProgressInfo() const { return current_load_info.getData(); } 267 GetAchievements()268 const C4ScenarioParameters &GetAchievements() const { return Achievements; } 269 }; 270 271 272 // ----------------------------------------------- 273 274 275 276 // for map-style folders: Data for map display 277 class C4MapFolderData 278 { 279 private: 280 struct Scenario 281 { 282 // compiled data 283 StdStrBuf sFilename; 284 StdStrBuf sBaseImage, sOverlayImage; 285 286 // parameters for title as drawn on the map (if desired; otherwise sTitle empty) 287 StdStrBuf sTitle; 288 int32_t iTitleFontSize; 289 uint32_t dwTitleInactClr, dwTitleActClr; 290 int32_t iTitleOffX, iTitleOffY; 291 uint8_t byTitleAlign; 292 bool fTitleBookFont; 293 bool fImgDump; // developer help: Dump background image part 294 295 C4Rect rcOverlayPos; 296 FLOAT_RECT rcfOverlayPos; 297 298 // set during initialization 299 C4FacetSurface fctBase, fctOverlay; 300 C4ScenarioListLoader::Entry *pScenEntry; 301 C4GUI::Button *pBtn; // used to resolve button events to scenario 302 303 void CompileFunc(StdCompiler *pComp); 304 }; 305 306 struct AccessGfx 307 { 308 // compiled data 309 StdStrBuf sPassword; 310 StdStrBuf sOverlayImage; 311 C4Rect rcOverlayPos; 312 FLOAT_RECT rcfOverlayPos; 313 314 // set during initialization 315 C4FacetSurface fctOverlay; 316 317 void CompileFunc(StdCompiler *pComp); 318 }; 319 320 // non-interactive map item 321 class MapPic : public C4GUI::Picture 322 { 323 private: 324 FLOAT_RECT rcfBounds; // drawing bounds 325 public: 326 MapPic(const FLOAT_RECT &rcfBounds, const C4Facet &rfct); // ctor 327 328 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 329 330 protected: 331 void DrawElement(C4TargetFacet &cgo) override; // draw the image 332 }; 333 334 private: 335 C4FacetSurface fctBackgroundPicture; FLOAT_RECT rcfBG; 336 bool fCoordinatesAdjusted{false}; 337 C4Rect rcScenInfoArea; // area in which scenario info is displayed 338 class C4ScenarioListLoader::Folder *pScenarioFolder; 339 class C4ScenarioListLoader::Entry *pSelectedEntry; 340 C4GUI::TextWindow *pSelectionInfoBox; 341 int32_t MinResX, MinResY; // minimum resolution for display of the map 342 bool fUseFullscreenMap; 343 Scenario **ppScenList{nullptr}; int32_t iScenCount{0}; 344 AccessGfx **ppAccessGfxList{nullptr}; int32_t iAccessGfxCount{0}; 345 class C4StartupScenSelDlg *pMainDlg{nullptr}; 346 347 public: 348 C4MapFolderData() = default; ~C4MapFolderData()349 ~C4MapFolderData() { Clear(); } 350 351 private: 352 void ConvertFacet2ScreenCoord(const C4Rect &rc, FLOAT_RECT *pfrc, float fBGZoomX, float fBGZoomY, int iOffX, int iOffY); 353 void ConvertFacet2ScreenCoord(int32_t *piValue, float fBGZoom, int iOff); 354 void ConvertFacet2ScreenCoord(C4Rect &rcMapArea, bool fAspect); // adjust coordinates of loaded facets so they match given area 355 356 protected: 357 void OnButtonScenario(C4GUI::Control *pEl); 358 359 friend class C4StartupScenSelDlg; 360 361 public: 362 void Clear(); 363 bool Load(C4Group &hGroup, C4ScenarioListLoader::Folder *pScenLoaderFolder); 364 void CompileFunc(StdCompiler *pComp); 365 void CreateGUIElements(C4StartupScenSelDlg *pMainDlg, C4GUI::Window &rContainer); 366 void ResetSelection(); 367 GetSelectionInfoBox()368 C4GUI::TextWindow *GetSelectionInfoBox() const { return pSelectionInfoBox; } GetSelectedEntry()369 C4ScenarioListLoader::Entry *GetSelectedEntry() const { return pSelectedEntry; } 370 }; 371 372 373 374 375 // ----------------------------------------------- 376 377 // startup dialog: Scenario selection 378 class C4StartupScenSelDlg : public C4StartupDlg 379 { 380 public: 381 // one item in the scenario list 382 class ScenListItem : public C4GUI::Window 383 { 384 private: 385 typedef C4GUI::Window BaseClass; 386 // subcomponents 387 C4GUI::Picture *pIcon; // item icon 388 C4GUI::Label *pNameLabel; // item caption 389 C4GUI::Picture *ppAchievements[C4StartupScenSel_MaxAchievements]; // achievement icons 390 C4ScenarioListLoader::Entry *pScenListEntry; // associated, loaded item info 391 392 public: 393 ScenListItem(C4GUI::ListBox *pForListBox, C4ScenarioListLoader::Entry *pForEntry, C4GUI::Element *pInsertBeforeElement=nullptr); 394 395 protected: 396 struct RenameParams { }; 397 void AbortRenaming(RenameParams par); 398 C4GUI::RenameEdit::RenameResult DoRenaming(RenameParams par, const char *szNewName); 399 public: 400 bool KeyRename(); 401 402 protected: 403 void UpdateOwnPos() override; // recalculate item positioning Update()404 void Update() {} 405 406 public: 407 void MouseInput(C4GUI::CMouse &rMouse, int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyParam) override; GetEntry()408 C4ScenarioListLoader::Entry *GetEntry() const { return pScenListEntry; } GetNext()409 ScenListItem *GetNext() { return static_cast<ScenListItem *>(BaseClass::GetNext()); } 410 411 bool CheckNameHotkey(const char * c) override; // return whether this item can be selected by entering given char 412 }; 413 414 public: 415 C4StartupScenSelDlg(bool fNetwork); // ctor 416 ~C4StartupScenSelDlg() override; // dtor 417 418 private: 419 enum { ShowStyle_Book=0, ShowStyle_Map=1 }; 420 enum { IconLabelSpacing = 2 }; // space between an icon and its text 421 422 // book style scenario selection 423 C4GUI::Label *pScenSelCaption; // caption label atop scenario list; indicating current folder 424 C4GUI::ListBox *pScenSelList; // left page of book: Scenario selection 425 C4GUI::Label *pScenSelProgressLabel; // progress label shown while scenario list is being generated 426 C4GUI::Label *pScenSelProgressInfoLabel; // extra progress label showing currently processed item 427 C4GUI::TextWindow *pSelectionInfo; // used to display the description of the current selection 428 class C4GameOptionsList *pSelectionOptions; // displays custom scenario options for selected item below description 429 430 C4KeyBinding *pKeyRefresh, *pKeyBack, *pKeyForward, *pKeyRename, *pKeyDelete, *pKeyCheat; 431 class C4GameOptionButtons *pGameOptionButtons; 432 C4GUI::Button *pOpenBtn; 433 C4GUI::Tabular *pScenSelStyleTabular; 434 435 C4ScenarioListLoader *pScenLoader; 436 437 // map style scenario selection 438 C4MapFolderData *pMapData; 439 C4Facet *pfctBackground; 440 441 bool fIsInitialLoading; 442 bool fStartNetworkGame; 443 444 C4GUI::RenameEdit *pRenameEdit; 445 446 // achievements of all activated players 447 C4ScenarioParameters Achievements; 448 449 public: 450 static C4StartupScenSelDlg *pInstance; // singleton 451 452 protected: GetMarginTop()453 int32_t GetMarginTop() override { return (rcBounds.Hgt/7); } HasBackground()454 bool HasBackground() override { return false; } 455 void DrawElement(C4TargetFacet &cgo) override; 456 OnEnter()457 bool OnEnter() override { DoOK(); return true; } OnEscape()458 bool OnEscape() override { DoBack(true); return true; } KeyBack()459 bool KeyBack() { return DoBack(true); } KeyRefresh()460 bool KeyRefresh() { DoRefresh(); return true; } KeyForward()461 bool KeyForward() { DoOK(); return true; } 462 bool KeyRename(); 463 bool KeyDelete(); 464 bool KeyCheat(); 465 void KeyCheat2(const StdStrBuf &rsCheatCode); 466 467 void DeleteConfirm(ScenListItem *pSel); 468 469 void OnShown() override; // callback when shown: Init file list 470 void OnClosed(bool fOK) override; // callback when dlg got closed: Return to main screen OnBackBtn(C4GUI::Control * btn)471 void OnBackBtn(C4GUI::Control *btn) { DoBack(true); } OnNextBtn(C4GUI::Control * btn)472 void OnNextBtn(C4GUI::Control *btn) { DoOK(); } OnSelChange(class C4GUI::Element * pEl)473 void OnSelChange(class C4GUI::Element *pEl) { UpdateSelection(); } OnSelDblClick(class C4GUI::Element * pEl)474 void OnSelDblClick(class C4GUI::Element *pEl) { DoOK(); } 475 void OnButtonScenario(C4GUI::Control *pEl); 476 477 void OnLeagueOptionChanged() override; 478 479 friend class C4MapFolderData; 480 481 private: 482 void UpdateList(); 483 void UpdateSelection(); 484 void ResortFolder(); 485 ScenListItem *GetSelectedItem(); 486 C4ScenarioListLoader::Entry *GetSelectedEntry(); 487 void SetOpenButtonDefaultText(); 488 void FocusScenList(); 489 void UpdateAchievements(); 490 491 public: 492 bool StartScenario(C4ScenarioListLoader::Scenario *pStartScen); 493 bool OpenFolder(C4ScenarioListLoader::Folder *pNewFolder); ProcessCallback()494 void ProcessCallback() { UpdateList(); } // process callback by loader 495 bool DoOK(); // open/start currently selected item 496 bool DoBack(bool fAllowClose); // back folder, or abort dialog 497 void DoRefresh(); // refresh file list 498 void DeselectAll(); // reset focus and update selection info 499 500 void StartRenaming(C4GUI::RenameEdit *pNewRenameEdit); 501 void AbortRenaming(); IsRenaming()502 bool IsRenaming() const { return !!pRenameEdit; } SetRenamingDone()503 void SetRenamingDone() { pRenameEdit=nullptr; } 504 SetBackground(C4Facet * pNewBG)505 void SetBackground(C4Facet *pNewBG) { pfctBackground=pNewBG; } 506 IsNetworkStart()507 bool IsNetworkStart() const { return fStartNetworkGame; } 508 509 friend class ScenListItem; 510 }; 511 512 513 #endif // INC_C4StartupScenSelDlg 514