Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

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-1999  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 const int dbluedark = 248;
00036 
00037 // ASCString  selectFile( const ASCString& ext, bool load );
00038 
00039 extern void displaymessage2( const char* formatstring, ... );
00040    
00042 extern void  dispmessage2(int          id,
00043                           const char *       st = NULL );
00044    
00045   
00046   
00047 // extern void  statisticarmies(void);
00048    
00049 // extern void  statisticbuildings(void);
00050    
00051 
00052 
00053 extern char mix3colors ( int p1, int p2, int p3 );
00054 extern char mix2colors ( int a, int b );
00055 extern char mix4colors ( int a, int b, int c, int d );
00056 
00057 
00058   class   tviewanytext : public tdialogbox, public tviewtextwithscrolling {
00059                public:
00060                    const char                 *txt;
00061                    char              ok;
00062                     
00063                    char              scrollbarvisible;
00064                    char                 action;
00065                    
00066                    // int                  textsizey, textsizeycomplete;
00067                    int                  textstart;
00068                    int                  rightspace;
00069 
00070                    void                 init( const char* title, const char* text , int xx1 = 50, int yy1 = 50 , int xxsize = 360, int yysize = 360 );
00071                    virtual void         run ( void );
00072                    virtual void         buttonpressed( int id);
00073                    void                 redraw ( void );
00074                    int                  getcapabilities ( void ) { return 1; };
00075                    void                 repaintscrollbar ( void );
00076                 };
00077 
00079 extern void bi3preferences  ( void );
00080 
00081 
00083 extern void resizemap ( void );
00084 
00085 extern void choosezoomlevel ( void );
00086 
00087 extern void viewUnitSetinfo ( void );
00088 
00096 extern int   choice_dlg(const ASCString& title,
00097                         const ASCString& leftButton,
00098                         const ASCString& rightButton );
00099 
00100 
00101 
00102 typedef class tparagraph* pparagraph;
00103 class  tparagraph {
00104         public:
00105           tparagraph ( void );
00106           tparagraph ( pparagraph prv );   // f?gt einen neuen paragraph hinter prv an
00107 
00108           void join ( void );   // returnvalue : paragraph to delete;
00109           void changesize ( int newsize );
00110 
00111           void addchar ( char c );
00112           pparagraph erasechar ( int c );
00113           void checkcursor ( void );
00114           pparagraph movecursor ( int dx, int dy );
00115           pparagraph cut ( void );
00116 
00117           int  reflow( int all = 1 );
00118           void display ( void );
00119 
00120           void checkscrollup ( void );
00121           void checkscrolldown ( void );
00122           int  checkcursorpos ( void );
00123 
00124           void addtext ( const ASCString& txt );
00125           ~tparagraph ();
00126 
00127           void setpos ( int x1, int y1, int y2, int linepos, int linenum );
00128 
00129           void displaycursor ( void );
00130           int cursor;
00131           int cursorstat;
00132           int cursorx;
00133           int normcursorx;
00134           int cursory;
00135           int searchcursorpos;
00136           static int maxlinenum;
00137 
00138           int size;
00139           int allocated;
00140           char* text;
00141 
00142           static int winy1;
00143           static int winy2;
00144           static int winx1;
00145           struct {
00146              int line1num;
00147           } ps;
00148 
00149           dynamic_array<char*> linestart;
00150           dynamic_array<int>   linelength;
00151 
00152           int   linenum;
00153 
00154           pparagraph next;
00155           pparagraph prev;
00156       };
00157 
00158 
00159 class tmessagedlg : public tdialogbox {
00160            protected:
00161                int to[8];
00162 
00163                 pparagraph firstparagraph;
00164                 pparagraph actparagraph;
00165 
00166                 int tx1, ty1, tx2, ty2,ok;
00167                 int lastcursortick;
00168                 int blinkspeed;
00169 
00170             public:
00171                 tmessagedlg ( void );
00172                 virtual void setup ( void );
00173                 void inserttext ( const ASCString& txt );
00174                 void run ( void );
00175                 ASCString extracttext ();
00176                 ~tmessagedlg();
00177          };
00178 
00179 class MultilineEdit : public tmessagedlg  {
00180                ASCString& text;
00181                ASCString dlg_title;
00182                bool textchanged;
00183             public:
00184                MultilineEdit ( ASCString& txt, const ASCString& title ) : text ( txt ), dlg_title ( title ), textchanged ( false ) {};
00185                void init ( void );
00186                void setup ( void );
00187                void buttonpressed ( int id );
00188                void run ( void );
00189                bool changed ( ) { return textchanged; };
00190        };
00191 
00192 extern void selectgraphicset ( void );
00193 
00194 extern int editInt( const ASCString& title, int defaultValue, int minValue = 0, int maxValue = maxint );
00195 
00196 
00197 #endif

Generated on Tue Jun 24 01:27:39 2008 for Advanced Strategic Command by  doxygen 1.4.2