00001 /*---------------------------------------------------------------------\ 00002 | | 00003 | __ __ ____ _____ ____ | 00004 | \ \ / /_ _/ ___|_ _|___ \ | 00005 | \ V / _` \___ \ | | __) | | 00006 | | | (_| |___) || | / __/ | 00007 | |_|\__,_|____/ |_| |_____| | 00008 | | 00009 | core system | 00010 | (C) SuSE GmbH | 00011 \----------------------------------------------------------------------/ 00012 00013 File: NCPopup.h 00014 00015 Author: Michael Andres <ma@suse.de> 00016 Maintainer: Michael Andres <ma@suse.de> 00017 00018 /-*/ 00019 #ifndef NCPopup_h 00020 #define NCPopup_h 00021 00022 #include <iosfwd> 00023 00024 #include "NCDialog.h" 00025 00027 // 00028 // CLASS NAME : NCPopup 00029 // 00030 // DESCRIPTION : 00031 // 00032 class NCPopup : protected NCDialog { 00033 00034 NCPopup & operator=( const NCPopup & ); 00035 NCPopup ( const NCPopup & ); 00036 00037 private: 00038 00039 static YWidgetOpt wopt; 00040 00041 protected: 00042 00043 NCursesEvent postevent; 00044 00045 void popupDialog(); 00046 void popdownDialog(); 00047 00048 virtual NCursesEvent wHandleInput( wint_t ch ); 00049 00050 protected: 00051 00052 NCPopup( const wpos at, const bool boxed = true ); 00053 virtual ~NCPopup(); 00054 00055 virtual bool postAgain() { 00056 if ( postevent != NCursesEvent::cancel ) 00057 postevent.detail = 0; 00058 return false; 00059 } 00060 00061 public: 00062 00063 int post( NCursesEvent * returnevent = 0 ) { 00064 postevent = NCursesEvent(); 00065 do { 00066 popupDialog(); 00067 } while ( postAgain() ); 00068 popdownDialog(); 00069 if ( returnevent ) 00070 *returnevent = postevent; 00071 return postevent.detail; 00072 } 00073 00074 }; 00075 00076 #endif // NCPopup_h 00077 00078