00001
00002
00003
00004
00005
00006
00007
00008
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef paradialogH
00023 #define paradialogH
00024
00025 #include "global.h"
00026
00027 #include <sigc++/sigc++.h>
00028
00029 #include <paragui.h>
00030 #include <pgapplication.h>
00031 #include <pgmessagebox.h>
00032 #include <pgdropdown.h>
00033 #include <pgcolor.h>
00034
00035 #include "pgbutton.h"
00036 #include "pgwidgetlist.h"
00037 #include "pglabel.h"
00038 #include "pgwindow.h"
00039 #include "pgscrollbar.h"
00040 #include "pgradiobutton.h"
00041 #include "pgthemewidget.h"
00042 #include "pgcheckbutton.h"
00043 #include "pgslider.h"
00044 #include "pglistbox.h"
00045
00046 #include "pgpropertyeditor.h"
00047
00048 #include "sdl/graphics.h"
00049 #include "ascstring.h"
00050 #include "textfile_evaluation.h"
00051 #include "graphics/drawing.h"
00052 #include "messaginghub.h"
00053
00054 class AutoProgressBar;
00055
00056 class StartupScreen: public SigC::Object {
00057 PG_Label* infoLabel;
00058 PG_Label* versionLabel;
00059 PG_ThemeWidget* background;
00060 AutoProgressBar* progressBar;
00061 Surface fullscreenImage;
00062 void disp( const ASCString& s );
00063 public:
00064 StartupScreen( const ASCString& filename, SigC::Signal0<void>& ticker );
00065 ~StartupScreen();
00066 };
00067
00068 class ASC_PG_App : public PG_Application {
00069 ASCString themeName;
00070 bool fullScreen;
00071 int bitsperpixel;
00072
00073 void messageDialog( const ASCString& message, MessagingHubBase::MessageType mt );
00074
00075 typedef list<PG_MessageObject*> DeletionQueue;
00076 DeletionQueue deletionQueue;
00077
00078 bool removeFromDeletionQueue( const PG_MessageObject* obj );
00079
00080 protected:
00081 bool eventQuit(int id, PG_MessageObject* widget, unsigned long data);
00082 void eventIdle();
00083
00084 public:
00085 static const int mapDisplayID = 2;
00086 static const int mainScreenID = 1;
00087
00088 ASC_PG_App ( const ASCString& themeName );
00089 bool InitScreen ( int w, int h, int depth = 0, Uint32 flags = SDL_SWSURFACE|SDL_HWPALETTE );
00090
00091 void reloadTheme();
00092 int Run ();
00093 void Quit ();
00094
00095 bool isFullscreen() { return fullScreen; };
00096 bool toggleFullscreen();
00097
00098 void setIcon( const ASCString& filename );
00099
00100 void processEvent();
00101 bool enableLegacyEventHandling( bool use );
00102
00103 bool queueWidgetForDeletion( PG_Widget* widget );
00104
00105 ~ASC_PG_App();
00106
00107 void SetNewScreenSurface( SDL_Surface* surface );
00108
00109
00110
00111 };
00112
00113 extern ASC_PG_App& getPGApplication();
00114
00115 class WindowCounter {
00116 static int windowNum;
00117 public:
00118 WindowCounter() { ++windowNum; };
00119 static int num() { return windowNum; };
00120 ~WindowCounter() { --windowNum; };
00121 };
00122
00123
00125 class ASC_PG_Dialog : public PG_Window {
00126 private:
00127 int stdButtonNum;
00128 protected:
00129 PG_MessageObject* caller;
00130 virtual bool closeWindow();
00131 bool quitModalLoop(int value );
00132 virtual bool eventKeyDown(const SDL_KeyboardEvent *key);
00133 public:
00134 ASC_PG_Dialog ( PG_Widget *parent, const PG_Rect &r, const ASCString& windowtext, WindowFlags flags=DEFAULT, const ASCString& style="Window", int heightTitlebar=25);
00135 PG_Button* AddStandardButton( const ASCString& name );
00136 enum StandardButtonDirectonType { Vertical, Horizontal };
00137 void StandardButtonDirection ( StandardButtonDirectonType dir );
00138 int RunModal();
00139
00140 static PG_Rect centerRectangle( const PG_Rect& rect );
00141
00142 private:
00143 StandardButtonDirectonType standardButtonDir;
00144 };
00145
00146 class ASC_PropertyEditor : public PG_PropertyEditor {
00147 public:
00148 ASC_PropertyEditor( PG_Widget *parent, const PG_Rect &r, const std::string &style="PropertyEditor", int labelWidthPercentage = 50 ) : PG_PropertyEditor( parent, r, style, labelWidthPercentage ) {};
00149 std::string GetStyleName( const std::string& widgetName ) {
00150 if ( widgetName == "DropDownSelectorProperty" )
00151 return "DropDown";
00152 else
00153 if ( widgetName == "BoolProperty" )
00154 return "CheckButton";
00155 else
00156 return PG_PropertyEditor::GetStyleName( widgetName );
00157 };
00158 };
00159
00160
00161
00162 class ColoredBar : public PG_ThemeWidget {
00163 public:
00164 ColoredBar( PG_Color col, PG_Widget *parent, const PG_Rect &r ) : PG_ThemeWidget( parent, r )
00165 {
00166 SetGradient ( PG_Gradient( col,col,col,col ));
00167 SetBorderSize(0);
00168 SetBackgroundBlend ( 255 );
00169 };
00170 };
00171
00172
00173
00174 class SpecialDisplayWidget : public PG_Widget {
00175 public:
00176
00177 typedef SigC::Signal3<void,const PG_Rect&, const ASCString&, const PG_Rect&> DisplayHook;
00178
00179 DisplayHook display;
00180
00181 SpecialDisplayWidget (PG_Widget *parent, const PG_Rect &rect ) : PG_Widget( parent, rect, false )
00182 {
00183 }
00184
00185
00186 void eventBlit (SDL_Surface *surface, const PG_Rect &src, const PG_Rect &dst) {
00187 display( src, GetName(), dst );
00188 };
00189
00190
00191
00192
00193
00194
00195
00196 };
00197
00198
00199 class SpecialInputWidget : public PG_Widget {
00200 public:
00201
00202 SpecialInputWidget (PG_Widget *parent, const PG_Rect &rect ) : PG_Widget( parent, rect, false ) { SetTransparency(255); };
00203 void eventBlit (SDL_Surface *surface, const PG_Rect &src, const PG_Rect &dst) { };
00204 };
00205
00206 class Emboss : public PG_Widget {
00207 bool inv;
00208 public:
00209
00210 Emboss (PG_Widget *parent, const PG_Rect &rect, bool inverted = false ) : PG_Widget( parent, rect, false ), inv(inverted)
00211 {
00212 }
00213
00214 void eventBlit (SDL_Surface *surface, const PG_Rect &src, const PG_Rect &dst);
00215 };
00216
00217
00218
00219
00220
00221 class MessageDialog;
00222
00223 class PG_StatusWindowData : public StatusMessageWindowHolder::UserData {
00224 MessageDialog* md;
00225 public:
00226 PG_StatusWindowData( const ASCString& msg );
00227 ~PG_StatusWindowData() ;
00228 };
00229
00230
00231 extern pair<int,int> new_chooseString ( const ASCString& title, const vector<ASCString>& entries, const vector<ASCString>& buttons, int defaultEntry = -1 );
00232
00233 extern bool MultiLineEditor( const ASCString& title, ASCString& textToEdit );
00234
00236 extern ASCString editString2( const ASCString& title, const ASCString& defaultValue = "" );
00237
00238
00239 class BulkGraphicUpdates {
00240 PG_Widget* parent;
00241 bool bulk;
00242 bool active;
00243 public:
00244 BulkGraphicUpdates( PG_Widget* parent = NULL );
00245 void release();
00246 ~BulkGraphicUpdates();
00247 };
00248
00249 #endif