Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members  

cursive.h

Go to the documentation of this file.
00001 // Author:  Daniel Albuschat ( daniel@viming.de ) 
00002 // File:    cursive.h
00003 // Date:    Mon Apr 14 20:01:05 20030
00004 // Content:  
00005 
00006 #ifndef CRS_OOCURSES_H_1790165320
00007 #define CRS_OOCURSES_H_1790165320
00008 #include <ncurses.h>
00009 
00010 namespace crs {
00012   struct position {
00013     unsigned int x,y;
00014     position( unsigned int X=0, unsigned int Y=0 ): x(X), y(Y){
00015     }
00016   };
00017 
00019   struct bounds {
00020     unsigned int left, top, width, height;
00021     bounds( unsigned int Left=0, unsigned int Top=0, unsigned int Width=0, unsigned int Height=0 ):
00022       left(Left), top(Top), width(Width), height(Height){
00023       }
00024   };
00025   class base_control;
00026   class window_events;
00027   class drawing_area;
00028   class cursive;
00029   class debug_ctrl;
00031   namespace style {
00032     enum styles { rect=0, round=1, bubble=2, enzleet=3, custom=4 };
00033   }
00034   extern cursive crsv;
00035 
00037   namespace sc { // special characters
00038     extern chtype LowerLeftCorner;
00039     extern chtype LowerRightCorner;
00040     extern chtype UpperLeftCorner;
00041     extern chtype UpperRightCorner;
00042     extern chtype HorizontalLine;
00043     extern chtype VerticalLine;
00045 
00052     chtype getLeftBorder( unsigned char num, chtype custom );
00054 
00061     chtype getRightBorder( unsigned char num, chtype custom );
00062   }
00063 }
00064 
00065 #include "../prop.h" 
00066 #include "events.h"
00067 #include "drawing_area.h"
00068 #include "base_control.h"
00069 #include "debug_ctrl.h"
00070 #include <string>
00071 #include <list>
00072 
00073 namespace crs {
00074 
00075   /*  struct save_pos {
00076       private:
00077       int max_x, max_y, min_x, min_y;
00078       int x, y;
00079       public:
00080       save_pos( int X, int Y, int Max_x, int Max_y, int Min_x, Min_y ):
00081       max_x(Max_x), max_y(Max_y), min_x(Min_x), min_y(Min_y){
00082       if( X => Min_x && X <= Max_x )
00083       x = X;
00084       if( Y => Min_y && Y <= Max_y )
00085       y = Y;
00086       }
00087       };*/
00088 
00089   class cursive {
00090     private:
00092       focused_ctrl *focused;
00094       focused_ctrl::focuslist::iterator focused_it;
00096       focused_ctrl::focuslist focusable;
00097       friend class base_control;
00098       friend class focused_ctrl;
00099 
00100       class screen_ctrl: public base_control {
00101         private:
00103           cursive *crs;
00105           friend class cursive;
00107 
00108           void finalflush();
00110           void drawall();
00111         public:
00112 #ifdef DEBUG
00113           debug_ctrl *dbgctrl;
00114 #endif
00115           screen_ctrl( cursive *Crs );
00117 
00118           virtual void deregisterControl( base_control::controllist::iterator &i );
00119       };
00120 
00122       screen_ctrl *mScreen;
00124 
00125       focused_ctrl::focuslist::iterator registerFocusable( focused_ctrl *control );
00127       void deregisterFocusable( focused_ctrl::focuslist::iterator &i );
00128     public:
00129       cursive();
00130       ~cursive();
00131       int mainloop();
00133 
00138       screen_ctrl *getScreen() { return mScreen; };
00140       inline void setFocus( focused_ctrl *ctrl ) { focused = ctrl; focused_it = 0; for( focused_ctrl::focuslist::iterator i = focusable.begin(); i != focusable.end(); i++ )
00141         if( *i == focused ){ focused_it = i; break; } }
00142       inline base_control *getFocused() { return focused; }
00143   };
00144 
00145 }
00146 
00147 #endif
00148 

Generated on Mon May 19 20:36:03 2003 for cursive by doxygen1.2.18