Main Page   Class Hierarchy   Compound List   File List   Compound Members  

awswin.h

00001 #ifndef __AWS_WINDOW_H__
00002 #define __AWS_WINDOW_H__
00003 /**************************************************************************
00004     Copyright (C) 2000-2001 by Christopher Nelson
00005     
00006     This library is free software; you can redistribute it and/or
00007     modify it under the terms of the GNU Library General Public
00008     License as published by the Free Software Foundation; either
00009     version 2 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     Library General Public License for more details.
00015   
00016     You should have received a copy of the GNU Library General Public
00017     License along with this library; if not, write to the Free
00018     Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00019 *****************************************************************************/
00020 #include "aws/iaws.h"
00021 #include "iutil/eventh.h"
00022 #include "iutil/comp.h"
00023 #include "csgeom/csrect.h"
00024 #include "aws/awscomp.h"
00025 
00026 /***************************************************************************************************************************
00027 *   This file details the interface of awsWindow components.  Windows, while they are just normal components, have some    *
00028 * special properties that most other components will not have.  For example, windows are moveable, hideable, maximizeable, *
00029 * windows can be minimized, closed, and they can sit on top of or below other windows.  Windows, while being peers, also   *
00030 * have a depth ordering that is implicit in their hierarchy.                                                               *
00031 *                                                                                                                          *
00032 ***************************************************************************************************************************/
00033 
00034 class awsWindow : public iAwsWindow
00035 {
00036 private:
00038     iAwsWindow *above;
00039 
00041     iAwsWindow *below;
00042 
00044     void Unlink();
00045 
00047     void LinkAbove(iAwsWindow *win);
00048 
00050     void LinkBelow(iAwsWindow *win);
00051 
00053     iTextureHandle *min_button, *max_button, *close_button, *btxt;
00054 
00055 private:
00059     unsigned int redraw_tag;
00060 
00062     int frame_style;
00063 
00065     int frame_options;
00066 
00068     int  title_bar_height;
00069 
00071     iString *title;
00072 
00074     int  last_x, last_y;
00075 
00077     bool resizing_mode;
00078 
00080     bool moving_mode;
00081 
00083     csRect minp, maxp, closep;
00084 
00086     bool min_down, max_down, close_down;
00087 
00089     bool is_zoomed, is_minimized;
00090 
00092     csRect unzoomed_frame;
00093 
00095     awsComponent comp;
00096 
00097 private:
00098     void Draw3DRect(iGraphics2D *g2d, csRect &f, int hi, int lo);
00099     
00101     iAws *WindowManager()
00102     { return comp.WindowManager(); }
00103 
00105 
00107     virtual void Invalidate();
00108 
00110     virtual void Invalidate(csRect area);
00111 
00113     virtual csRect& Frame();
00114 
00116     virtual bool Overlaps(csRect &r);
00117 
00119     virtual bool isHidden();
00120     
00122     virtual void Hide();
00123 
00125     virtual void Show();
00126 
00128     virtual unsigned long GetID();
00129     
00131     virtual void SetID(unsigned long _id);
00132 
00134     virtual void MoveChildren(int delta_x, int delta_y);
00135   
00137     virtual void AddChild(iAwsComponent* child, bool owner);
00138 
00140     virtual void RemoveChild(iAwsComponent *child);
00141 
00143     virtual int GetChildCount();
00144 
00146     virtual iAwsComponent *GetChildAt(int i);
00147     
00149     virtual bool HasChildren();
00150 
00152     virtual bool HandleEvent(iEvent& Event);
00153     
00154 public:
00155    static const unsigned long sWindowRaised;
00156    static const unsigned long sWindowLowered;
00157    static const unsigned long sWindowHidden;
00158    static const unsigned long sWindowShown;
00159    static const unsigned long sWindowClosed;
00160 
00161    /******* Frame Styles **********************/
00162 
00164    static const int fsNormal;
00165 
00167    static const int fsToolbar;
00168 
00170    static const int fsBitmap;
00171 
00172    /******* Frame Options **********************/
00173 
00175    static const int foControl;
00176 
00178    static const int foZoom;
00179 
00181    static const int foMin;
00182 
00184    static const int foClose;
00185 
00187    static const int foTitle;
00188 
00190    static const int foGrip;
00191 
00193    static const int foRoundBorder;
00194    
00196    static const int foBeveledBorder;
00197    
00198    SCF_DECLARE_IBASE;
00199    
00201    virtual char *Type()
00202    {
00203       return "Window";
00204    }
00205 
00207    virtual void SetRedrawTag(unsigned int tag);
00208 
00210    virtual unsigned int RedrawTag()
00211    { return redraw_tag; }
00212 
00213 public:
00215     awsWindow();
00216 
00218     virtual ~awsWindow();
00219 
00220 public:
00222     virtual bool RegisterSlot(iAwsSlot *slot, unsigned long signal);
00223 
00225     virtual bool UnregisterSlot(iAwsSlot *slot, unsigned long signal);
00226 
00228     virtual void Broadcast(unsigned long signal);
00229 
00231     iAwsComponent *GetComponent();
00232 
00233 public:
00235     virtual void Raise();
00236 
00238     virtual void Lower();
00239 
00241     virtual iAwsWindow *WindowAbove()
00242     { return above; }
00243 
00245     virtual iAwsWindow *WindowBelow()
00246     { return below; }
00247 
00249     virtual void SetWindowAbove(iAwsWindow *win);
00250     
00252     virtual void SetWindowBelow(iAwsWindow *win);
00253     
00255     virtual bool Setup(iAws *_wmgr, awsComponentNode *settings);
00256 
00258     bool GetProperty(char *name, void **parm);
00259 
00261     bool SetProperty(char *name, void *parm);
00262 
00263 public:
00265     virtual void OnRaise();
00266 
00268     virtual void OnLower();
00269 
00271     virtual void OnDraw(csRect clip);
00272 
00274     virtual bool OnMouseDown(int button, int x, int y);
00275     
00277     virtual bool OnMouseUp(int button, int x, int y);
00278     
00280     virtual bool OnMouseMove(int button, int x, int y);
00281 
00283     virtual bool OnMouseClick(int button, int x, int y);
00284 
00286     virtual bool OnMouseDoubleClick(int button, int x, int y);
00287 
00289     virtual bool OnMouseExit();
00290 
00292     virtual bool OnMouseEnter();
00293 
00295     virtual bool OnKeypress(int key, int modifiers);
00296     
00298     virtual bool OnLostFocus();
00299 
00301     virtual bool OnGainFocus();
00302 };
00303 
00304 #endif
00305 

Generated for Crystal Space by doxygen 1.2.5 written by Dimitri van Heesch, ©1997-2000