libyui  3.3.2
YUI Class Referenceabstract

Abstract base class of a libYUI user interface. More...

#include <YUI.h>

Collaboration diagram for YUI:

Public Member Functions

virtual ~YUI ()
 Destructor.
 
void shutdownThreads ()
 Shut down multithreading. More...
 
virtual void blockEvents (bool block=true)
 Block (or unblock) events. More...
 
void unblockEvents ()
 Unblock events previously blocked. More...
 
virtual bool eventsBlocked () const
 Returns 'true' if events are currently blocked. More...
 
virtual void deleteNotify (YWidget *widget)
 Notification that a widget is being deleted. More...
 
void topmostConstructorHasFinished ()
 Must be called after the constructor of the Qt/NCurses ui is ready. More...
 
bool runningWithThreads () const
 Running with threads?
 
void uiThreadMainLoop ()
 This method implements the UI thread in case it is existing. More...
 
YBuiltinCallerbuiltinCaller () const
 Return the transparent inter-thread communication. More...
 
void setBuiltinCaller (YBuiltinCaller *caller)
 Set the transparent inter-thread communication. More...
 
virtual YEventrunPkgSelection (YWidget *packageSelector)=0
 UI-specific runPkgSelection method. More...
 

Static Public Member Functions

static YUIui ()
 Access the global UI.
 
static YWidgetFactorywidgetFactory ()
 Return the widget factory that provides all the createXY() methods for standard (mandatory, i.e. More...
 
static YOptionalWidgetFactoryoptionalWidgetFactory ()
 Return the widget factory that provides all the createXY() methods for optional ("special") widgets and the corresponding hasXYWidget() methods. More...
 
static YApplicationapp ()
 Return the global YApplication object. More...
 
static YApplicationapplication ()
 Aliases for YUI::app()
 
static YApplicationyApp ()
 
static void ensureUICreated ()
 Make sure there is a UI (with a UI plug-in) created. More...
 

Protected Member Functions

 YUI (bool withThreads)
 Constructor.
 
virtual YWidgetFactorycreateWidgetFactory ()=0
 Create the widget factory that provides all the createXY() methods for standard (mandatory, i.e. More...
 
virtual YOptionalWidgetFactorycreateOptionalWidgetFactory ()=0
 Create the widget factory that provides all the createXY() methods for optional ("special") widgets and the corresponding hasXYWidget() methods. More...
 
virtual YApplicationcreateApplication ()=0
 Create the YApplication object that provides global methods. More...
 
virtual void idleLoop (int fd_ycp)=0
 This virtual method is called when threads are activated in case the execution control is currently on the side of the module. More...
 
void terminateUIThread ()
 Tells the ui thread that it should terminate and waits until it does so.
 
void createUIThread ()
 Creates and launches the ui thread.
 
virtual void uiThreadDestructor ()
 Destructor for the UI thread. More...
 
void signalUIThread ()
 Signals the ui thread by sending one byte through the pipe to it.
 
bool waitForUIThread ()
 Waits for the ui thread to send one byte through the pipe to the ycp thread and reads this byte from the pipe.
 
void signalYCPThread ()
 Signals the ycp thread by sending one byte through the pipe to it.
 
bool waitForYCPThread ()
 Waits for the ycp thread to send one byte through the pipe to the ycp thread and reads this byte from the pipe.
 
void setButtonOrderFromEnvironment ()
 Set the button order (in YButtonBox widgets) from environment variables: More...
 

Protected Attributes

bool _withThreads
 true if a seperate UI thread is created
 
pthread_t _uiThread
 Handle to the ui thread.
 
YBuiltinCaller_builtinCaller
 Inter-thread communication between the YCP thread and the UI thread: The YCP thread supplies data here and signals the UI thread, the UI thread picks up the data, executes the function, puts the result here and signals the YCP thread that waits until the result is available.
 
int pipe_to_ui [2]
 Used to synchronize data transfer with the ui thread. More...
 
int pipe_from_ui [2]
 Used to synchronize data transfer with the ui thread. More...
 
bool _terminate_ui_thread
 This is a flag that signals the ui thread that it should terminate. More...
 
bool _eventsBlocked
 Flag that keeps track of blocked events. More...
 

Friends

class YUIFunction
 
class YUILoader
 
void * start_ui_thread (void *ui_int)
 

Detailed Description

Abstract base class of a libYUI user interface.

Definition at line 48 of file YUI.h.

Member Function Documentation

◆ app()

YApplication * YUI::app ( )
static

Return the global YApplication object.

This will create the YApplication upon the first call and return a pointer to the one and only (singleton) YApplication upon each subsequent call. This may throw exceptions if the YApplication cannot be created.

Definition at line 156 of file YUI.cc.

Here is the call graph for this function:

◆ blockEvents()

virtual void YUI::blockEvents ( bool  block = true)
inlinevirtual

Block (or unblock) events.

If events are blocked, any event sent should be ignored until events are unblocked again.

This default implementation keeps track of a simple internal flag that can be queried with eventsBlocked(), so if you reimplement blockEvents(), be sure to reimplement eventsBlocked() as well.

Definition at line 161 of file YUI.h.

◆ builtinCaller()

YBuiltinCaller* YUI::builtinCaller ( ) const
inline

Return the transparent inter-thread communication.

This will return 0 until set from the outside.

Definition at line 212 of file YUI.h.

◆ createApplication()

virtual YApplication* YUI::createApplication ( )
protectedpure virtual

Create the YApplication object that provides global methods.

Derived classes are required to implement this.

◆ createOptionalWidgetFactory()

virtual YOptionalWidgetFactory* YUI::createOptionalWidgetFactory ( )
protectedpure virtual

Create the widget factory that provides all the createXY() methods for optional ("special") widgets and the corresponding hasXYWidget() methods.

Derived classes are required to implement this.

◆ createWidgetFactory()

virtual YWidgetFactory* YUI::createWidgetFactory ( )
protectedpure virtual

Create the widget factory that provides all the createXY() methods for standard (mandatory, i.e.

non-optional) widgets.

Derived classes are required to implement this.

◆ deleteNotify()

virtual void YUI::deleteNotify ( YWidget widget)
inlinevirtual

Notification that a widget is being deleted.

This is called from the YWidget destructor.

Derived classes can implement this for any clean-up actions such as deleting any events that might be pending for that widget.

Definition at line 185 of file YUI.h.

Here is the call graph for this function:

◆ ensureUICreated()

void YUI::ensureUICreated ( )
static

Make sure there is a UI (with a UI plug-in) created.

If there is none yet, this will use all-default parameters to load a UI plug-in and create a UI (without threads).

Definition at line 170 of file YUI.cc.

Here is the call graph for this function:

◆ eventsBlocked()

virtual bool YUI::eventsBlocked ( ) const
inlinevirtual

Returns 'true' if events are currently blocked.

Reimplement this if you reimplement blockEvents().

Definition at line 176 of file YUI.h.

◆ idleLoop()

virtual void YUI::idleLoop ( int  fd_ycp)
protectedpure virtual

This virtual method is called when threads are activated in case the execution control is currently on the side of the module.

This means that no UserInput() or PollInput() is pending. The module just does some work. The UI <-> module protocol is in the "UI waits for the next command" state. The UI can override this method when it wants to react to user input or other external events such as repaint requests from the X server.

'fd_ycp' file descriptor that should be used to determine when to leave the idle loop. As soon as it is readable, the loop must be left. In order to avoid polling you can combine it with other ui-specific fds and do a common select() call.

◆ optionalWidgetFactory()

YOptionalWidgetFactory * YUI::optionalWidgetFactory ( )
static

Return the widget factory that provides all the createXY() methods for optional ("special") widgets and the corresponding hasXYWidget() methods.

This will create the factory upon the first call and return a pointer to the one and only (singleton) factory upon each subsequent call. This may throw exceptions if the factory cannot be created.

Definition at line 141 of file YUI.cc.

Here is the call graph for this function:

◆ runPkgSelection()

virtual YEvent* YUI::runPkgSelection ( YWidget packageSelector)
pure virtual

UI-specific runPkgSelection method.

Derived classes are required to implement this.

The packageSelector's dialog will take care of the event and delete it when appropriate. The returned pointer is valid until the next call to YDialog::userInput(), YDialog::pollInput(), or YUI::runPkgSelection() or until the dialog with the packageSelector is destroyed.

◆ setBuiltinCaller()

void YUI::setBuiltinCaller ( YBuiltinCaller caller)
inline

Set the transparent inter-thread communication.

Built-ins are only really called if there is a valid YBuiltinCaller set.

Definition at line 218 of file YUI.h.

Here is the call graph for this function:

◆ setButtonOrderFromEnvironment()

void YUI::setButtonOrderFromEnvironment ( )
protected

Set the button order (in YButtonBox widgets) from environment variables:

$Y2_BUTTON_ORDER="KDE" $Y2_BUTTON_ORDER="Gnome"

(all case insensitive)

Definition at line 386 of file YUI.cc.

Here is the call graph for this function:

◆ shutdownThreads()

void YUI::shutdownThreads ( )

Shut down multithreading.

This needs to be called before the destructor if the UI was created with threads. If the UI was created without threads, this does nothing.

Definition at line 259 of file YUI.cc.

Here is the call graph for this function:

◆ topmostConstructorHasFinished()

void YUI::topmostConstructorHasFinished ( )

Must be called after the constructor of the Qt/NCurses ui is ready.

Starts the ui thread.

Definition at line 182 of file YUI.cc.

Here is the call graph for this function:

◆ uiThreadDestructor()

void YUI::uiThreadDestructor ( )
protectedvirtual

Destructor for the UI thread.

This will be called as the last thing the UI thread does.

Derived classes can overwrite this. In most cases it makes sense to call this base class method in the new implementation.

Definition at line 111 of file YUI.cc.

Here is the call graph for this function:

◆ uiThreadMainLoop()

void YUI::uiThreadMainLoop ( )

This method implements the UI thread in case it is existing.

The loop consists of calling idleLoop, getting the next command from the YCPUIComponent, evaluating it, which possibly invovles calling userInput() or pollInput() and writes the answer back to the other thread where the request came from.

Definition at line 353 of file YUI.cc.

Here is the call graph for this function:

◆ unblockEvents()

void YUI::unblockEvents ( )
inline

Unblock events previously blocked.

This is just an alias for blockEvents( false) for better readability.

Note: This method is intentionally not virtual.

Definition at line 169 of file YUI.h.

Here is the call graph for this function:

◆ widgetFactory()

YWidgetFactory * YUI::widgetFactory ( )
static

Return the widget factory that provides all the createXY() methods for standard (mandatory, i.e.

non-optional) widgets.

This will create the factory upon the first call and return a pointer to the one and only (singleton) factory upon each subsequent call. This may throw exceptions if the factory cannot be created.

Definition at line 126 of file YUI.cc.

Here is the call graph for this function:

Member Data Documentation

◆ _eventsBlocked

bool YUI::_eventsBlocked
protected

Flag that keeps track of blocked events.

Never query this directly, use eventsBlocked() instead.

Definition at line 358 of file YUI.h.

◆ _terminate_ui_thread

bool YUI::_terminate_ui_thread
protected

This is a flag that signals the ui thread that it should terminate.

This is done by setting the flag to true. The ui thread replies by setting the flag back to false directly after terminating itself.

Definition at line 352 of file YUI.h.

◆ pipe_from_ui

int YUI::pipe_from_ui[2]
protected

Used to synchronize data transfer with the ui thread.

It stores a pair of file descriptors of a pipe. For each YCP value we get from the ui thread, we read one aribrary byte from here.

Definition at line 344 of file YUI.h.

◆ pipe_to_ui

int YUI::pipe_to_ui[2]
protected

Used to synchronize data transfer with the ui thread.

It stores a pair of file descriptors of a pipe. For each YCP value we send to the ui thread, we write one aribrary byte here.

Definition at line 337 of file YUI.h.


The documentation for this class was generated from the following files: