Planeshift
pawslauncherwindow.h
Go to the documentation of this file.
1 /*
2 * pawslauncherwindow.h - Author: Mike Gist
3 *
4 * Copyright (C) 2007 Atomic Blue (info@planeshift.it, http://www.atomicblue.org)
5 *
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation (version 2 of the License)
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 *
18 */
19 
20 #ifndef __PAWS_LAUNCHER_WINDOW_H__
21 #define __PAWS_LAUNCHER_WINDOW_H__
22 
23 #include "paws/pawswidget.h"
24 
25 #include "pslaunch.h"
26 
27 class pawsComboBox;
28 class pawsOkBox;
29 class pawsYesNoBox;
30 
32 {
33 public:
35  bool OnButtonPressed(int mouseButton, int keyModifier, pawsWidget* widget );
36  bool PostSetup();
37  void EnablePlay();
38 
39 private:
40  pawsWidget* launcherMain;
41  pawsWidget* launcherUpdater;
42  pawsWidget* launcherSettings;
43  pawsComboBox* resolution;
44  pawsYesNoBox* updateAvailable;
45  pawsOkBox* notify;
46  csRef<iConfigFile> configFile;
47  csRef<iConfigFile> configUser;
48  csRef<CS::Threading::Thread> newsUpdater;
49  csString mountedPath;
50  csString currentSkin;
51 
52  static void HandleUpdateButton(bool choice, void *thisptr);
53  static void HandleCacheButton(bool choice, void* thisptr);
54  void HandleAspectRatio(csString ratio);
55  void UpdateNews();
56  void LoadSettings();
57  void SaveSettings();
58  bool DeleteShaderCache();
59  void LoadSkin(const char* name);
60  bool LoadResource(const char* resource,const char* resname, const char* mountPath);
61  void OnListAction(pawsListBox* widget, int status);
62 
63  class NewsUpdater : public CS::Threading::Runnable
64  {
65  public:
66  NewsUpdater(pawsLauncherWindow* plw)
67  {
68  lw = plw;
69  }
70 
71  void Run()
72  {
73  lw->UpdateNews();
74  }
75  private:
77  };
78 
79  enum WidgetID
80  {
81  LAUNCHER = 1,
82  LAUNCHER_MAIN = 11,
83  LAUNCHER_UPDATER,
84  LAUNCHER_SETTINGS,
85  UPDATE_AVAILABLE,
86  SERVER_NEWS = 111,
87  QUIT_BUTTON,
88  REPAIR_BUTTON,
89  SETTINGS_BUTTON,
90  PLAY_BUTTON,
91  UPDATER_OUTPUT = 121,
92  UPDATER_YES_BUTTON,
93  UPDATER_NO_BUTTON,
94  UPDATER_OK_BUTTON,
95  UPDATER_CANCEL_BUTTON,
96  SETTINGS_OK_BUTTON = 131,
97  SETTINGS_CANCEL_BUTTON,
98  SETTINGS_AUDIO_BUTTON,
99  SETTINGS_CONTROLS_BUTTON,
100  SETTINGS_GENERAL_BUTTON,
101  SETTINGS_GRAPHICS_BUTTON,
102  ASPECT_RATIO = 1394,
103  SKINS = 1399,
104  DELETE_CACHE = 1402,
105  UPDATE_MESSAGE_BOX = 141,
106  UPDATE_YES_BUTTON,
107  UPDATE_NO_BUTTON,
108  NOTIFY_MESSAGE_BOX = 151,
109  NOTIFY_OK_BUTTON
110  };
111 
112  enum GraphicsPresets
113  {
114  HIGHEST = 0,
115  HIGH,
116  MEDIUM,
117  LOW,
118  LOWEST,
119  CUSTOM
120  };
121 
122  pawsButton* FindButton(WidgetID id);
123 };
124 
126 
127 #endif // __PAWS_LAUNCHER_WINDOW_H__
bool OnButtonPressed(int mouseButton, int keyModifier, pawsWidget *widget)
Called whenever a button is pressed.
The main base widget that all other widgets should inherit from.
Definition: pawswidget.h:116
This is an ok button window box.
Definition: pawsokbox.h:39
csString name
The name of this widget.
Definition: pawswidget.h:217
bool PostSetup()
This is called after the widget and all of it&#39;s children have been created.
A simple list box widget.
Definition: pawslistbox.h:202
This is a yes/no box used to do confirms.
Definition: pawsyesnobox.h:41
A simple button widget.
Definition: pawsbutton.h:43
A basic combo box widget.
Definition: pawscombo.h:53
CREATE_PAWS_FACTORY(pawsLauncherWindow)