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

pgwindow.h

Go to the documentation of this file.
00001 /*
00002     ParaGUI - crossplatform widgetset
00003     Copyright (C) 2000,2001,2002  Alexander Pipelka
00004  
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Library General Public
00007     License as published by the Free Software Foundation; either
00008     version 2 of the License, or (at your option) any later version.
00009  
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Library General Public License for more details.
00014  
00015     You should have received a copy of the GNU Library General Public
00016     License along with this library; if not, write to the Free
00017     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018  
00019     Alexander Pipelka
00020     pipelka@teleweb.at
00021  
00022     Last Update:      $Author: mbickel $
00023     Update Date:      $Date: 2007-04-13 16:15:57 $
00024     Source File:      $Source: /home/cvspsrv/cvsroot/games/asc/source/libs/paragui/include/pgwindow.h,v $
00025     CVS/RCS Revision: $Revision: 1.2 $
00026     Status:           $State: Exp $
00027 */
00028 
00033 #ifndef PG_WINDOW_H
00034 #define PG_WINDOW_H
00035 
00036 #include "pgthemewidget.h"
00037 #include "pglabel.h"
00038 #include <string>
00039 
00040 class PG_Button;
00041 
00051 class DECLSPEC PG_Window : public PG_ThemeWidget  {
00052 public:
00053 
00054 
00055         typedef enum {
00056             MODAL = 0x01,
00057             SHOW_CLOSE = 0x02,
00058             SHOW_MINIMIZE = 0x04,
00059             DEFAULT = SHOW_CLOSE
00060         } WindowFlags;
00061 
00062         enum {
00063             IDWINDOW_CLOSE       = PG_WIDGETID_INTERNAL + 14,
00064             IDWINDOW_MINIMIZE = PG_WIDGETID_INTERNAL + 15,
00065             IDWINDOW_RESTORE = PG_WIDGETID_INTERNAL + 15
00066         };
00067 
00071         typedef PG_Signal1<PG_Window*> SignalWindowClose;
00072         typedef PG_Signal1<PG_Window*> SignalWindowMinimize;
00073         typedef PG_Signal1<PG_Window*> SignalWindowRestore;
00074 
00084         PG_Window(PG_Widget* parent, const PG_Rect& r = PG_Rect::null, const std::string& windowtext = PG_NULLSTR, WindowFlags flags = DEFAULT, const std::string& style="Window", int heightTitlebar = 25);
00085 
00087         ~PG_Window();
00088 
00089         void LoadThemeStyle(const std::string& widgettype);
00090 
00095         void SetTitlebarColor(const PG_Color& c);
00096 
00101         PG_Color GetTitlebarColor();
00102 
00107         void SetTitlebarHeight(Uint8 height);
00108 
00113         Uint8 GetTitlebarHeight();
00114 
00120         void SetTitle(const std::string& title, PG_Label::TextAlign alignment = PG_Label::CENTER);
00121 
00122         void SetText(const std::string& text);
00123 
00128         const PG_String& GetTitle();
00129 
00130         const PG_String& GetText();
00131 
00136         SDL_Surface* GetIcon();
00137 
00142         void SetIcon(const std::string& filename);
00143 
00148         void SetIcon(SDL_Surface* icon);
00149 
00153         void SetMoveable(bool moveable = true);
00154 
00155         SignalWindowClose sigClose;
00156         SignalWindowMinimize sigMinimize;
00157         SignalWindowRestore sigRestore;
00158 
00159 protected:
00160 
00161         void RecalcPositions();
00162 
00164         void eventBlit(SDL_Surface* surface, const PG_Rect& src, const PG_Rect& dst);
00165 
00167         void eventSizeWidget(Uint16 w, Uint16 h);
00168 
00170         virtual bool handleButtonClick(PG_Button* button);
00171 
00173         bool eventMouseButtonDown(const SDL_MouseButtonEvent* button);
00174 
00176         bool eventMouseButtonUp(const SDL_MouseButtonEvent* button);
00177 
00179         bool eventMouseMotion(const SDL_MouseMotionEvent* motion);
00180 
00181 private:
00182 
00183         Uint8 my_heightTitlebar;
00184 
00185         PG_Button* my_buttonClose;
00186 
00187         PG_Button* my_buttonMinimize;
00188 
00189         PG_Button* my_buttonIcon;
00190 
00191         PG_ThemeWidget* my_titlebar;
00192 
00193         PG_Label* my_labelTitle;
00194 
00195         bool my_moveMode;
00196 
00197         Uint8 my_moveTransparency;
00198 
00199         PG_Point my_moveDelta;
00200 
00201         bool my_showCloseButton;
00202 
00203         bool my_showMinimizeButton;
00204 
00205         bool my_moveable;
00206 
00207 private: // disable the copy operators
00208 
00209         PG_Window(const PG_Window&);
00210         PG_Window& operator=(const PG_Window&);
00211 
00212 };
00213 
00214 #endif // PG_WINDOW_H

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