dialog.h

Go to the documentation of this file.
00001 
00005 /*
00006     This file is part of Advanced Strategic Command; http://www.asc-hq.de
00007     Copyright (C) 1994-2010  Martin Bickel  and  Marc Schellenberger
00008 
00009     This program is free software; you can redistribute it and/or modify
00010     it under the terms of the GNU General Public License as published by
00011     the Free Software Foundation; either version 2 of the License, or
00012     (at your option) any later version.
00013 
00014     This program is distributed in the hope that it will be useful,
00015     but WITHOUT ANY WARRANTY; without even the implied warranty of
00016     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017     GNU General Public License for more details.
00018 
00019     You should have received a copy of the GNU General Public License
00020     along with this program; see the file COPYING. If not, write to the 
00021     Free Software Foundation, Inc., 59 Temple Place, Suite 330, 
00022     Boston, MA  02111-1307  USA
00023 */
00024 
00025 #ifndef dialogH
00026 #define dialogH
00027 
00028 
00029 #include <sigc++/sigc++.h>
00030 #include "ascstring.h"
00031 #include "dlg_box.h"
00032 #include "password.h"
00033 #include "typen.h"
00034 
00035 #include "actions/actionresult.h"
00036 
00037 const int dbluedark = 248;
00038 
00039 // ASCString  selectFile( const ASCString& ext, bool load );
00040 
00041 extern void displaymessage2( const char* formatstring, ... );
00042    
00044 extern void  dispmessage2(int id, const char * st = NULL );
00045 extern void  dispmessage2( const ActionResult& result );
00046    
00047   
00048   
00049 // extern void  statisticarmies(void);
00050    
00051 // extern void  statisticbuildings(void);
00052    
00053 
00054 
00055 extern char mix3colors ( int p1, int p2, int p3 );
00056 extern char mix2colors ( int a, int b );
00057 extern char mix4colors ( int a, int b, int c, int d );
00058 
00059 
00060   class   tviewanytext : public tdialogbox, public tviewtextwithscrolling {
00061                public:
00062                    const char                 *txt;
00063                    char              ok;
00064                     
00065                    char              scrollbarvisible;
00066                    char                 action;
00067                    
00068                    // int                  textsizey, textsizeycomplete;
00069                    int                  textstart;
00070                    int                  rightspace;
00071 
00072                    void                 init( const char* title, const char* text , int xx1 = 50, int yy1 = 50 , int xxsize = 360, int yysize = 360 );
00073                    virtual void         run ( void );
00074                    virtual void         buttonpressed( int id);
00075                    void                 redraw ( void );
00076                    int                  getcapabilities ( void ) { return 1; };
00077                    void                 repaintscrollbar ( void );
00078                 };
00079 
00081 extern void bi3preferences  ( void );
00082 
00083 
00085 extern void resizemap ( void );
00086 
00087 extern void choosezoomlevel ( void );
00088 
00089 extern void viewUnitSetinfo ( void );
00090 
00098 extern int   choice_dlg(const ASCString& title,
00099                         const ASCString& leftButton,
00100                         const ASCString& rightButton );
00101 
00102 
00103 
00104 typedef class tparagraph* pparagraph;
00105 class  tparagraph {
00106         public:
00107           tparagraph ( void );
00108           tparagraph ( pparagraph prv );   // f?gt einen neuen paragraph hinter prv an
00109 
00110           void join ( void );   // returnvalue : paragraph to delete;
00111           void changesize ( int newsize );
00112 
00113           void addchar ( char c );
00114           pparagraph erasechar ( int c );
00115           void checkcursor ( void );
00116           pparagraph movecursor ( int dx, int dy );
00117           pparagraph cut ( void );
00118 
00119           int  reflow( int all = 1 );
00120           void display ( void );
00121 
00122           void checkscrollup ( void );
00123           void checkscrolldown ( void );
00124           int  checkcursorpos ( void );
00125 
00126           void addtext ( const ASCString& txt );
00127           ~tparagraph ();
00128 
00129           void setpos ( int x1, int y1, int y2, int linepos, int linenum );
00130 
00131           void displaycursor ( void );
00132           int cursor;
00133           int cursorstat;
00134           int cursorx;
00135           int normcursorx;
00136           int cursory;
00137           int searchcursorpos;
00138           static int maxlinenum;
00139 
00140           int size;
00141           int allocated;
00142           char* text;
00143 
00144           static int winy1;
00145           static int winy2;
00146           static int winx1;
00147           struct {
00148              int line1num;
00149           } ps;
00150 
00151           dynamic_array<char*> linestart;
00152           dynamic_array<int>   linelength;
00153 
00154           int   linenum;
00155 
00156           pparagraph next;
00157           pparagraph prev;
00158       };
00159 
00160 
00161 class tmessagedlg : public tdialogbox {
00162            protected:
00163                int to[8];
00164 
00165                 pparagraph firstparagraph;
00166                 pparagraph actparagraph;
00167 
00168                 int tx1, ty1, tx2, ty2,ok;
00169                 int lastcursortick;
00170                 int blinkspeed;
00171 
00172             public:
00173                 tmessagedlg ( void );
00174                 virtual void setup ( void );
00175                 void inserttext ( const ASCString& txt );
00176                 void run ( void );
00177                 ASCString extracttext ();
00178                 ~tmessagedlg();
00179          };
00180 
00181 class MultilineEdit : public tmessagedlg  {
00182                ASCString& text;
00183                ASCString dlg_title;
00184                bool textchanged;
00185             public:
00186                MultilineEdit ( ASCString& txt, const ASCString& title ) : text ( txt ), dlg_title ( title ), textchanged ( false ) {};
00187                void init ( void );
00188                void setup ( void );
00189                void buttonpressed ( int id );
00190                void run ( void );
00191                bool changed ( ) { return textchanged; };
00192        };
00193 
00194 extern void selectgraphicset ( void );
00195 
00196 extern int editInt( const ASCString& title, int defaultValue, int minValue = 0, int maxValue = maxint );
00197 
00198 
00199 class ActionResult;
00200 extern void displayActionError( const ActionResult& result, const ASCString& additionalInfo = "" );
00201 
00202 #endif

Generated on Mon May 21 01:26:31 2012 for Advanced Strategic Command by  doxygen 1.5.1