Advanced Strategic Command
messagedialog.h
Go to the documentation of this file.
1 /*
2  This file is part of Advanced Strategic Command; http://www.asc-hq.de
3  Copyright (C) 1994-2010 Martin Bickel and Marc Schellenberger
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9 
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 
15  You should have received a copy of the GNU General Public License
16  along with this program; see the file COPYING. If not, write to the
17  Free Software Foundation, Inc., 59 Temple Place, Suite 330,
18  Boston, MA 02111-1307 USA
19 */
20 
21 
22 #ifndef messagedialogH
23 #define messagedialogH
24 
25 #include <map>
26 
27 #include "../paradialog.h"
28 class TextRenderer;
29 
30 class PG_RichEdit;
31 class PG_CheckButton;
32 
33 class MessageDialog : public ASC_PG_Dialog {
34  bool defaultKeysActive;
35  public:
49  MessageDialog(PG_Widget* parent, const PG_Rect& r, const std::string& windowtitle, const std::string& windowtext, const std::string& btn1text, const std::string& btn2text, PG_Label::TextAlign textalign = PG_Label::CENTER, const std::string& style="MessageBox", bool rememberCheckbox = false );
50 
51 
63  MessageDialog(PG_Widget* parent, const PG_Rect& r, const std::string& windowtitle, const std::string& windowtext, const std::string& btn1text, PG_Label::TextAlign textalign = PG_Label::CENTER, const std::string& style="MessageBox");
64 
75  MessageDialog(PG_Widget* parent, const PG_Rect& r, const std::string& windowtitle, const std::string& windowtext, PG_Label::TextAlign textalign = PG_Label::CENTER, const std::string& style="MessageBox");
76 
78 
79  void LoadThemeStyle(const std::string& widgettype);
80 
81  PG_Widget* getTextBox();
82 
83  void EnableDefaultKeys( bool enable );
84 
85  void SetText( const std::string& text ) ;
86 
87 
88  bool remberChoice();
89 
90  protected:
91 
97  virtual bool handleButton(PG_Button* button);
98 
99  PG_Button* my_btnok;
100  PG_Button* my_btncancel;
101 
102  PG_CheckButton* checkbox;
103 
104  bool eventKeyDown (const SDL_KeyboardEvent *key);
105 
106 
107  private:
108 
109  TextRenderer* my_textbox;
110  int my_msgalign;
111 
112  void Init(const std::string& windowtext, int textalign, const std::string& style) ;
113 };
114 
115 extern int new_choice_dlg(const ASCString& title, const ASCString& leftButton, const ASCString& rightButton );
116 extern int new_choice_dlg(const ASCString& title, const ASCString& shortTitle, const ASCString& leftButton, const ASCString& rightButton, bool& saveResult );
117 extern PG_Rect calcMessageBoxSize( const ASCString& message );
118 
119 #endif
120 
bool eventKeyDown(const SDL_KeyboardEvent *key)
int new_choice_dlg(const ASCString &title, const ASCString &leftButton, const ASCString &rightButton)
PG_CheckButton * checkbox
void SetText(const std::string &text)
The ASCString class provides an abstract way to manipulate strings.
Definition: ascstring.h:14
PG_Rect calcMessageBoxSize(const ASCString &message)
Adapter class for using Paragui Dialogs in ASC. This class transfers the event control from ASC to Pa...
Definition: paradialog.h:127
void LoadThemeStyle(const std::string &widgettype)
MessageDialog(PG_Widget *parent, const PG_Rect &r, const std::string &windowtitle, const std::string &windowtext, const std::string &btn1text, const std::string &btn2text, PG_Label::TextAlign textalign=PG_Label::CENTER, const std::string &style="MessageBox", bool rememberCheckbox=false)
Creates a PopUp with 2 Buttons.
void EnableDefaultKeys(bool enable)
PG_Button * my_btnok
Definition: messagedialog.h:99
PG_Button * my_btncancel
virtual bool handleButton(PG_Button *button)
Checks if button is pressed.
PG_Widget * getTextBox()