Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

NCDialog.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                                                                      |
00003 |                      __   __    ____ _____ ____                      |
00004 |                      \ \ / /_ _/ ___|_   _|___ \                     |
00005 |                       \ V / _` \___ \ | |   __) |                    |
00006 |                        | | (_| |___) || |  / __/                     |
00007 |                        |_|\__,_|____/ |_| |_____|                    |
00008 |                                                                      |
00009 |                               core system                            |
00010 |                                                        (C) SuSE GmbH |
00011 \----------------------------------------------------------------------/
00012 
00013    File:       NCDialog.h
00014 
00015    Author:     Michael Andres <ma@suse.de>
00016    Maintainer: Michael Andres <ma@suse.de>
00017 
00018 /-*/
00019 #ifndef NCDialog_h
00020 #define NCDialog_h
00021 
00022 #include <iosfwd>
00023 
00024 #include "YDialog.h"
00025 #include "NCWidget.h"
00026 
00027 
00028 class NCDialog;
00029 class NCPopupInfo;
00030 
00032 //
00033 //      CLASS NAME : NCDialog
00034 //
00035 //      DESCRIPTION :
00036 //
00037 class NCDialog : public YDialog, public NCWidget {
00038 
00039   friend std::ostream & operator<<( std::ostream & STREAM, const NCDialog & OBJ );
00040   friend std::ostream & operator<<( std::ostream & STREAM, const NCDialog * OBJ );
00041 
00042   NCDialog & operator=( const NCDialog & );
00043   NCDialog            ( const NCDialog & );
00044 
00045   private:
00046 
00047     typedef tnode<NCWidget *> * (tnode<NCWidget *>::* SeekDir)( const bool );
00048 
00049     NCWidget & GetNormal( NCWidget & startwith, SeekDir Direction );
00050     void       Activate( SeekDir Direction );
00051 
00052     void _init( const YWidgetOpt & opt );
00053 
00054     void _init_size();
00055 
00056   protected:
00057 
00058     virtual const char * location() const { return "NCDialog"; }
00059 
00060   private:
00061 
00062     NCursesUserPanel<NCDialog> * pan;
00063     NCstyle::StyleSet            mystyleset;
00064     const NCstyle::Style *       dlgstyle;
00065 
00066     unsigned inMultiDraw_i;
00067 
00068     bool            active;
00069     NCWidget *const wActive;
00070 
00071     NCursesEvent pendingEvent;
00072 
00073     NCPopupInfo *helpPopup;
00074 
00075     // wrapper for wHandle... calls in processInput()
00076     NCursesEvent getInputEvent( wint_t ch );
00077     NCursesEvent getHotkeyEvent( wint_t key );
00078 
00079   private:
00080 
00081     void grabActive( NCWidget * nactive );
00082     virtual void grabNotify( NCWidget * mgrab );
00083     virtual bool wantFocus( NCWidget & ngrab );
00084 
00085     virtual void wCreate( const wrect & newrect );
00086     virtual void wMoveTo( const wpos & newpos );
00087     virtual void wDelete();
00088     virtual void wRedraw();
00089     virtual void wRecoded();
00090     virtual void wUpdate( bool forced_br = false );
00091     void doUpdate() { wUpdate( true ); }
00092 
00093     NCWidget & GetNextNormal( NCWidget & startwith );
00094     NCWidget & GetPrevNormal( NCWidget & startwith );
00095 
00096     bool Activate( NCWidget & nactive );
00097     void Activate();
00098     void Deactivate();
00099     void ActivateNext();
00100     void ActivatePrev();
00101 
00102     bool ActivateByKey( int key );
00103 
00104     void processInput( int timeout_millisec );
00105 
00106     bool describeFunctionKeys( string & helpText );
00107 
00108     wint_t getinput();          // get the input (respect terminal encoding)
00109     
00110   protected:
00111 
00112     wint_t getch( int timeout_millisec = -1 );
00113 
00114     virtual NCursesEvent wHandleInput( wint_t ch );
00115     virtual NCursesEvent wHandleHotkey( wint_t key );
00116 
00117     virtual void startMultipleChanges();
00118     virtual void doneMultipleChanges();
00119 
00120   public:
00121 
00122     NCDialog( const YWidgetOpt & opt );
00123     virtual ~NCDialog();
00124 
00125     void showDialog();
00126     void closeDialog();
00127 
00128     void activate( const bool newactive );
00129     bool isActive() const { return active; }
00130 
00131     void idleInput();
00132 
00133     NCursesEvent userInput( int timeout_millisec = -1 );
00134     NCursesEvent pollInput();
00135 
00136     virtual long nicesize( YUIDimension dim );
00137     virtual void setSize( long newwidth, long newheight );
00138 
00139   protected:
00140 
00141     enum NCDopts {
00142       DEFAULT = 0x00,
00143       POPUP   = 0x01,
00144       NOBOX   = 0x10
00145     };
00146 
00147     typedef unsigned NCDoptflag;
00148 
00149     NCDoptflag ncdopts;
00150     wpos       popedpos;
00151     bool       hshaddow;
00152     bool       vshaddow;
00153 
00154     NCDialog( const YWidgetOpt & opt, const wpos at, const bool boxed = true );
00155 
00156     bool isPopup() const { return  (ncdopts & POPUP); }
00157     bool isBoxed() const { return !(ncdopts & NOBOX); }
00158 
00159     virtual void initDialog();
00160 
00161     virtual const NCstyle::Style & wStyle() const {
00162       return dlgstyle ? *dlgstyle : NCurses::style()[NCstyle::DefaultStyle];
00163     }
00164 
00165     virtual void setEnabling( bool do_bv ) { /*NOP*/ }
00166 
00167   private:
00168 
00169     friend class NCurses;
00170     bool getInvisible();
00171     bool getVisible();
00172     void resizeEvent();
00173 };
00174 
00176 
00177 #endif // NCDialog_h

Generated on Wed Sep 14 10:52:54 2005 for yast2-ncurses by  doxygen 1.4.4