libyui
 
Loading...
Searching...
No Matches
YUI.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: YUI.h
20
21 Author: Stefan Hundhammer <shundhammer@suse.de>
22
23/-*/
24
25#ifndef YUI_h
26#define YUI_h
27
28#include <pthread.h>
29#include <string>
30
31#include "YTypes.h"
32#include "YSettings.h"
33
34
35class YApplication;
36class YWidget;
37class YWidgetFactory;
39class YEvent;
40class YBuiltinCaller;
41class YDialog;
42class YMacroPlayer;
43class YMacroRecorder;
44
45
49class YUI
50{
51 friend class YUIFunction;
52 friend class YUILoader;
53
54protected:
58 YUI( bool withThreads );
59
60public:
61
65 virtual ~YUI();
66
72 void shutdownThreads();
73
77 static YUI * ui();
78
88
99
108 static YApplication * app();
109
113 static YApplication * application() { return app(); }
114 static YApplication * yApp() { return app(); }
115
122 static void ensureUICreated();
123
124
125protected:
126
134
143
150
151
152public:
153
162 virtual void blockEvents( bool block = true ) { _eventsBlocked = block; }
163
170 void unblockEvents() { blockEvents( false ); }
171
177 virtual bool eventsBlocked() const { return _eventsBlocked; }
178
186 virtual void deleteNotify( YWidget * widget ) {}
187
193
197 bool runningWithThreads() const { return _withThreads; }
198
207 void uiThreadMainLoop();
208
214
220 { _builtinCaller = caller; }
221
232 virtual YEvent * runPkgSelection( YWidget * packageSelector ) = 0;
233
241 YWidget * sendWidgetID( const std::string & id );
242
243
244protected:
245
260 virtual void idleLoop( int fd_ycp ) = 0;
261
266 void terminateUIThread();
267
271 void createUIThread();
272 friend void *start_ui_thread( void *ui_int );
273
281 virtual void uiThreadDestructor();
282
287 void signalUIThread();
288
293 bool waitForUIThread();
294
299 void signalYCPThread();
300
305 bool waitForYCPThread();
306
317
318
319 //
320 // Data members
321 //
322
327
331 pthread_t _uiThread;
332
341
348
355
363
369
370private:
371
372 static YUI * _ui;
373};
374
375
376
377#endif // YUI_h
Definition YApplication.h:46
Definition YBuiltinCaller.h:38
Definition YDialog.h:48
Definition YEvent.h:44
Definition YMacroPlayer.h:36
Definition YMacroRecorder.h:39
Definition YOptionalWidgetFactory.h:57
void topmostConstructorHasFinished()
Definition YUI.cc:190
YUI(bool withThreads)
Definition YUI.cc:76
virtual ~YUI()
Definition YUI.cc:90
YBuiltinCaller * builtinCaller() const
Definition YUI.h:213
bool runningWithThreads() const
Definition YUI.h:197
virtual void idleLoop(int fd_ycp)=0
virtual void blockEvents(bool block=true)
Definition YUI.h:162
void unblockEvents()
Definition YUI.h:170
static YUI * ui()
Definition YUI.cc:126
void uiThreadMainLoop()
Definition YUI.cc:361
YBuiltinCaller * _builtinCaller
Definition YUI.h:340
bool waitForYCPThread()
Definition YUI.cc:333
int pipe_to_ui[2]
Definition YUI.h:347
static YApplication * app()
Definition YUI.cc:164
virtual bool eventsBlocked() const
Definition YUI.h:177
bool _terminate_ui_thread
Definition YUI.h:362
virtual void deleteNotify(YWidget *widget)
Definition YUI.h:186
bool _withThreads
Definition YUI.h:326
bool waitForUIThread()
Definition YUI.cc:293
static YWidgetFactory * widgetFactory()
Definition YUI.cc:134
void signalUIThread()
Definition YUI.cc:281
void terminateUIThread()
Definition YUI.cc:254
virtual YWidgetFactory * createWidgetFactory()=0
static YOptionalWidgetFactory * optionalWidgetFactory()
Definition YUI.cc:149
virtual YEvent * runPkgSelection(YWidget *packageSelector)=0
bool _eventsBlocked
Definition YUI.h:368
void shutdownThreads()
Definition YUI.cc:267
void setButtonOrderFromEnvironment()
Definition YUI.cc:394
int pipe_from_ui[2]
Definition YUI.h:354
virtual YApplication * createApplication()=0
virtual void uiThreadDestructor()
Definition YUI.cc:119
static YApplication * application()
Definition YUI.h:113
static void ensureUICreated()
Definition YUI.cc:178
virtual YOptionalWidgetFactory * createOptionalWidgetFactory()=0
void setBuiltinCaller(YBuiltinCaller *caller)
Definition YUI.h:219
void createUIThread()
Definition YUI.cc:243
void signalYCPThread()
Definition YUI.cc:321
YWidget * sendWidgetID(const std::string &id)
Definition YUI.cc:489
pthread_t _uiThread
Definition YUI.h:331
Definition YWidgetFactory.h:80
Definition YWidget.h:55