libyui
|
00001 /************************************************************************** 00002 Copyright (C) 2000 - 2010 Novell, Inc. 00003 All Rights Reserved. 00004 00005 This program is free software; you can redistribute it and/or modify 00006 it under the terms of the GNU General Public License as published by 00007 the Free Software Foundation; either version 2 of the License, or 00008 (at your option) any later version. 00009 00010 This program is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 GNU General Public License for more details. 00014 00015 You should have received a copy of the GNU General Public License along 00016 with this program; if not, write to the Free Software Foundation, Inc., 00017 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00018 00019 **************************************************************************/ 00020 00021 /*---------------------------------------------------------------------\ 00022 | | 00023 | __ __ ____ _____ ____ | 00024 | \ \ / /_ _/ ___|_ _|___ \ | 00025 | \ V / _` \___ \ | | __) | | 00026 | | | (_| |___) || | / __/ | 00027 | |_|\__,_|____/ |_| |_____| | 00028 | | 00029 | core system | 00030 | (C) SuSE GmbH | 00031 \----------------------------------------------------------------------/ 00032 00033 File: YDialog.h 00034 00035 Author: Stefan Hundhammer <sh@suse.de> 00036 00037 /-*/ 00038 00039 00040 #ifndef YDialog_h 00041 #define YDialog_h 00042 00043 #include "YSingleChildContainerWidget.h" 00044 #include <stack> 00045 00046 class YShortcutManager; 00047 class YPushButton; 00048 class YDialogPrivate; 00049 class YEvent; 00050 class YEventFilter; 00051 00052 // See YTypes.h for enum YDialogType and enum YDialogColorMode 00053 00054 00055 class YDialog : public YSingleChildContainerWidget 00056 { 00057 protected: 00067 YDialog( YDialogType dialogType, 00068 YDialogColorMode colorMode = YDialogNormalColor ); 00069 00075 virtual ~YDialog(); 00076 00077 public: 00082 virtual const char * widgetClass() const { return "YDialog"; } 00083 00097 void open(); 00098 00102 bool isOpen() const; 00103 00130 YEvent * waitForEvent( int timeout_millisec = 0 ); 00131 00146 YEvent * pollEvent(); 00147 00151 bool isTopmostDialog() const; 00152 00166 bool destroy( bool doThrow = true ); 00167 00179 static bool deleteTopmostDialog( bool doThrow = true ); 00180 00184 static void deleteAllDialogs(); 00185 00189 static void deleteTo( YDialog * dialog ); 00190 00195 static int openDialogsCount(); 00196 00203 static YDialog * currentDialog( bool doThrow = true ); 00204 00208 static YDialog * topmostDialog( bool doThrow = true ) 00209 { return currentDialog( doThrow ); } 00210 00216 void setInitialSize(); 00217 00230 void recalcLayout(); 00231 00235 YDialogType dialogType() const; 00236 00241 bool isMainDialog(); 00242 00246 YDialogColorMode colorMode() const; 00247 00254 void checkShortcuts( bool force = false ); 00255 00261 void postponeShortcutCheck(); 00262 00266 bool shortcutCheckPostponed() const; 00267 00275 YPushButton * defaultButton() const; 00276 00280 void deleteEvent( YEvent * event ); 00281 00299 void addEventFilter( YEventFilter * eventFilter ); 00300 00307 void removeEventFilter( YEventFilter * eventFilter ); 00308 00320 virtual void highlight( YWidget * child ) {} 00321 00332 virtual void setDefaultButton( YPushButton * defaultButton ); 00333 00340 virtual void activate() = 0; 00341 00347 static void showText( const string & text, bool richText = false ); 00348 00359 static bool showHelpText( YWidget * widget ); 00360 00361 00362 protected: 00363 00371 virtual void openInternal() = 0; 00372 00378 virtual YEvent * waitForEventInternal( int timeout_millisec ) = 0; 00379 00386 virtual YEvent * pollEventInternal() = 0; 00387 00392 YEvent * filterInvalidEvents( YEvent * event ); 00393 00397 YEvent * callEventFilters( YEvent * event ); 00398 00402 void deleteEventFilters(); 00403 00407 static std::stack<YDialog *> _dialogStack; 00408 00409 private: 00410 00411 ImplPtr<YDialogPrivate> priv; 00412 }; 00413 00414 00415 #endif // YDialog_h