libyui
 
Loading...
Searching...
No Matches
YDialog.h
1/*
2 Copyright (C) 2000-2012 Novell, Inc
3 This library is free software; you can redistribute it and/or modify
4 it under the terms of the GNU Lesser General Public License as
5 published by the Free Software Foundation; either version 2.1 of the
6 License, or (at your option) version 3.0 of the License. This library
7 is distributed in the hope that it will be useful, but WITHOUT ANY
8 WARRANTY; without even the implied warranty of MERCHANTABILITY or
9 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
10 License for more details. You should have received a copy of the GNU
11 Lesser General Public License along with this library; if not, write
12 to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
13 Floor, Boston, MA 02110-1301 USA
14*/
15
16
17/*-/
18
19 File: YDialog.h
20
21 Author: Stefan Hundhammer <shundhammer@suse.de>
22
23/-*/
24
25
26#ifndef YDialog_h
27#define YDialog_h
28
29#include "YSingleChildContainerWidget.h"
30#include <stack>
31#include <map>
32
34class YPushButton;
35class YDialogPrivate;
36class YEvent;
37class YEventFilter;
38
39// See YTypes.h for enum YDialogType and enum YDialogColorMode
40
41
48{
49protected:
60 YDialogColorMode colorMode = YDialogNormalColor );
61
67 virtual ~YDialog();
68
69public:
74 virtual const char * widgetClass() const { return "YDialog"; }
75
89 void open();
90
94 bool isOpen() const;
95
122 YEvent * waitForEvent( int timeout_millisec = 0 );
123
138 YEvent * pollEvent();
139
143 bool isTopmostDialog() const;
144
158
165 int layoutPass() const;
166
180 bool destroy( bool doThrow = true );
181
193 static bool deleteTopmostDialog( bool doThrow = true );
194
198 static void deleteAllDialogs();
199
203 static void deleteTo( YDialog * dialog );
204
209 static int openDialogsCount();
210
217 static YDialog * currentDialog( bool doThrow = true );
218
222 static YDialog * topmostDialog( bool doThrow = true )
223 { return currentDialog( doThrow ); }
224
230 void setInitialSize();
231
244 void recalcLayout();
245
249 YDialogType dialogType() const;
250
255 bool isMainDialog();
256
260 YDialogColorMode colorMode() const;
261
268 void checkShortcuts( bool force = false );
269
276
280 bool shortcutCheckPostponed() const;
281
289 YPushButton * defaultButton() const;
290
294 void deleteEvent( YEvent * event );
295
313 void addEventFilter( YEventFilter * eventFilter );
314
321 void removeEventFilter( YEventFilter * eventFilter );
322
334 virtual void highlight( YWidget * child ) {}
335
347
354 virtual void activate() = 0;
355
356
357 //
358 // Dialog helpers - see source file YDialogHelpers.cc
359 //
360
366 static void showText( const std::string & text, bool richText = false );
367
377 static bool showHelpText( YWidget * widget );
378
388 static bool showRelNotesText();
389
390
391protected:
392
400 virtual void openInternal() = 0;
401
405 void doLayout();
406
412 virtual YEvent * waitForEventInternal( int timeout_millisec ) = 0;
413
420 virtual YEvent * pollEventInternal() = 0;
421
426 YEvent * filterInvalidEvents( YEvent * event );
427
431 YEvent * callEventFilters( YEvent * event );
432
436 void deleteEventFilters();
437
441 static std::stack<YDialog *> _dialogStack;
442
443private:
444
446};
447
448
449#endif // YDialog_h
YDialogType
Definition YTypes.h:67
Definition ImplPtr.h:43
Definition YDialog.h:48
void open()
Definition YDialog.cc:189
virtual const char * widgetClass() const
Definition YDialog.h:74
virtual void setDefaultButton(YPushButton *defaultButton)
Definition YDialog.cc:330
void checkShortcuts(bool force=false)
Definition YDialog.cc:305
static bool showRelNotesText()
Definition YDialogHelpers.cc:135
virtual YEvent * waitForEventInternal(int timeout_millisec)=0
virtual void activate()=0
static YDialog * currentDialog(bool doThrow=true)
Definition YDialog.cc:539
static std::stack< YDialog * > _dialogStack
Definition YDialog.h:441
void deleteEventFilters()
Definition YDialog.cc:223
static int openDialogsCount()
Definition YDialog.cc:601
bool destroy(bool doThrow=true)
Definition YDialog.cc:238
YEvent * filterInvalidEvents(YEvent *event)
Definition YDialog.cc:452
YDialogType dialogType() const
Definition YDialog.cc:259
void deleteEvent(YEvent *event)
Definition YDialog.cc:516
virtual void highlight(YWidget *child)
Definition YDialog.h:334
YEvent * waitForEvent(int timeout_millisec=0)
Definition YDialog.cc:387
bool isOpen() const
Definition YDialog.cc:203
int layoutPass() const
Definition YDialog.cc:380
static void deleteAllDialogs()
Definition YDialog.cc:570
static bool showHelpText(YWidget *widget)
Definition YDialogHelpers.cc:102
YEvent * pollEvent()
Definition YDialog.cc:427
virtual ~YDialog()
Definition YDialog.cc:153
void postponeShortcutCheck()
Definition YDialog.cc:291
void setInitialSize()
Definition YDialog.cc:344
static bool deleteTopmostDialog(bool doThrow=true)
Definition YDialog.cc:553
static void deleteTo(YDialog *dialog)
Definition YDialog.cc:580
void addEventFilter(YEventFilter *eventFilter)
Definition YDialog.cc:608
bool shortcutCheckPostponed() const
Definition YDialog.cc:298
YEvent * callEventFilters(YEvent *event)
Definition YDialog.cc:642
bool isTopmostDialog() const
Definition YDialog.cc:210
void doLayout()
Definition YDialog.cc:364
void removeEventFilter(YEventFilter *eventFilter)
Definition YDialog.cc:630
virtual void openInternal()=0
virtual YEvent * pollEventInternal()=0
bool isMainDialog()
Definition YDialog.cc:266
YPushButton * defaultButton() const
Definition YDialog.cc:323
void recalcLayout()
Definition YDialog.cc:356
void requestMultiPassLayout()
Definition YDialog.cc:662
YDialogColorMode colorMode() const
Definition YDialog.cc:284
static YDialog * topmostDialog(bool doThrow=true)
Definition YDialog.h:222
static void showText(const std::string &text, bool richText=false)
Definition YDialogHelpers.cc:56
YDialog(YDialogType dialogType, YDialogColorMode colorMode=YDialogNormalColor)
Definition YDialog.cc:136
Definition YEventFilter.h:63
Definition YEvent.h:44
Definition YPushButton.h:38
Definition YShortcutManager.h:39
YSingleChildContainerWidget(YWidget *parent)
Definition YSingleChildContainerWidget.cc:29
YWidget(YWidget *parent)
Definition YWidget.cc:106
Definition YDialog.cc:46