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

rootwindow.h

00001 /* 00002 libwftk - Worldforge Toolkit - a widget library 00003 Copyright (C) 2002 Malcolm Walker <malcolm@worldforge.org> 00004 Based on code copyright (C) 1999-2002 Karsten Laux 00005 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Lesser General Public 00008 License as published by the Free Software Foundation; either 00009 version 2.1 of the License, or (at your option) any later version. 00010 00011 This library is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 Lesser General Public License for more details. 00015 00016 You should have received a copy of the GNU Lesser General Public 00017 License along with this library; if not, write to the 00018 Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00019 Boston, MA 02111-1307, SA. 00020 */ 00021 00022 #ifndef _ROOTWINDOW_H 00023 #define _ROOTWINDOW_H 00024 00025 #include <set> 00026 00027 #include <sigc++/object.h> 00028 #if SIGC_MAJOR_VERSION == 1 && SIGC_MINOR_VERSION == 0 00029 #include <sigc++/signal_system.h> 00030 #else 00031 #include <sigc++/signal.h> 00032 #endif 00033 00034 #include <wftk/singlecontainer.h> 00035 00036 namespace wftk { 00037 00038 class ScreenSurface; 00039 class SoftPointer; 00040 00042 class RootWindow : public SingleContainer 00043 { 00044 public: 00046 RootWindow( 00047 int resX, 00048 int resY, 00049 int bpp = 0, 00050 bool fullscreen = false, 00051 bool resizeable = true, 00052 const Surface& icon = Surface(), 00053 Uint32 extra_flags = 0, 00054 unsigned padding = 10); 00056 virtual ~RootWindow(); 00058 static RootWindow* instance() {return instance_;} 00059 00061 SigC::Signal0<void> iconified; 00063 SigC::Signal0<void> restored; 00065 SigC::Signal2<void,int,int> resized; 00066 00067 00075 static int modeAvailable(int resX, int resY, int bpp, bool fullscreen); 00077 void sync(); 00079 void setTitle(const std::string& title, const std::string& icon_name = ""); 00081 static bool handleEvent(const SDL_Event*); 00083 ScreenSurface* screen() {return screen_;} 00085 bool fullscreen() const; 00087 bool isIconified() { return iconified_; } 00088 00090 void resize(Uint16 w, Uint16 h); 00092 void resize(); 00093 00095 void updateMouse() {mouseBuffer_.changed();} 00097 void convertSurface(); 00098 void addSurface(Surface *); 00099 00100 protected: 00102 virtual void drawAfter(Surface& target, const Point& offset, const Region& r); 00106 virtual void packingUpdateParent() {if(!isHidden()) handleResize(width(), height());} 00107 private: 00108 00109 void destroy() {delete this;} // signal handler 00110 00112 std::set<Surface*> surfaces_; 00114 ScreenSurface* screen_; 00116 bool iconified_; 00118 bool updateMouse_; // WFTK_DISABLE_DEPRECATED 00120 Rect resize_; 00122 int resize_wait_; 00123 00125 class MouseBuffer { 00126 public: 00127 MouseBuffer() : ptr_(0), changed_(true) {} 00128 00130 void update(ScreenSurface& screen); 00132 Region update(ScreenSurface& screen, const Region& dirty); 00133 00135 void changed() {changed_ = true;} 00136 00137 private: 00138 void checkBufferSize(const Surface&, const Pixelformat&); 00139 00140 Surface buffer_; 00141 const SoftPointer* ptr_; 00142 Rect screen_loc_; 00143 bool changed_; 00144 00145 } mouseBuffer_; 00146 00148 static RootWindow* instance_; 00149 }; 00150 00151 } // namespace wftk 00152 00153 #endif // _ROOTWINDOW_H

Generated Wed Jul 28 17:28:43 2004.
Copyright © 1998-2003 by the respective authors.

This document is licensed under the terms of the GNU Free Documentation License and may be freely distributed under the conditions given by this license.