Moving static attributes from FApplication to FWidget

This commit is contained in:
Markus Gans 2018-10-21 21:06:52 +02:00
parent 689199efe2
commit 540291b410
8 changed files with 167 additions and 202 deletions

View File

@ -1,3 +1,6 @@
2018-10-21 Markus Gans <guru.mail@muenster.de>
* Moving static attributes from FApplication to FWidget
2018-10-17 Markus Gans <guru.mail@muenster.de> 2018-10-17 Markus Gans <guru.mail@muenster.de>
* Changed more variables from int to std::size_t * Changed more variables from int to std::size_t

View File

@ -31,25 +31,25 @@
namespace finalcut namespace finalcut
{ {
// global application object // Global application object
static FApplication* rootObj = 0; static FApplication* app_object = 0;
// flag to exit local loop // Flag to exit the local event loop
static bool app_exit_loop = false; static bool app_exit_loop = false;
// static attributes // Static attributes
int FApplication::loop_level = 0; // event loop level FWidget* FWidget::main_widget = 0; // main application widget
FWidget* FApplication::main_widget = 0; // main application widget FWidget* FWidget::active_window = 0; // the active window
FWidget* FApplication::active_window = 0; // the active window FWidget* FWidget::focus_widget = 0; // has keyboard input focus
FWidget* FApplication::focus_widget = 0; // has keyboard input focus FWidget* FWidget::clicked_widget = 0; // is focused by click
FWidget* FApplication::clicked_widget = 0; // is focused by click FWidget* FWidget::open_menu = 0; // currently open menu
FWidget* FApplication::open_menu = 0; // currently open menu FWidget* FWidget::move_size_widget = 0; // move/size by keyboard
FWidget* FApplication::move_size_widget = 0; // move/size by keyboard FWidget* FApplication::keyboard_widget = 0; // has the keyboard focus
FWidget* FApplication::keyboard_widget = 0; // has the keyboard focus FKeyboard* FApplication::keyboard = 0; // keyboard access
FKeyboard* FApplication::keyboard = 0; // keyboard access FMouseControl* FApplication::mouse = 0; // mouse control
FMouseControl* FApplication::mouse = 0; // mouse control int FApplication::loop_level = 0; // event loop level
int FApplication::quit_code = 0; int FApplication::quit_code = 0;
bool FApplication::quit_now = false; bool FApplication::quit_now = false;
FApplication::eventQueue* FApplication::event_queue = 0; FApplication::eventQueue* FApplication::event_queue = 0;
@ -69,9 +69,9 @@ FApplication::FApplication ( const int& _argc
, key_timeout(100000) // 100 ms , key_timeout(100000) // 100 ms
, dblclick_interval(500000) // 500 ms , dblclick_interval(500000) // 500 ms
{ {
assert ( ! rootObj assert ( ! app_object
&& "FApplication: There should be only one application object" ); && "FApplication: There should be only one application object" );
rootObj = this; app_object = this;
if ( ! (_argc && _argv) ) if ( ! (_argc && _argv) )
{ {
@ -89,27 +89,21 @@ FApplication::~FApplication() // destructor
if ( event_queue ) if ( event_queue )
delete event_queue; delete event_queue;
rootObj = 0; app_object = 0;
} }
// public methods of FApplication // public methods of FApplication
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FApplication::setMainWidget (FWidget* widget) FWidget* FApplication::getApplicationObject()
{ {
main_widget = widget; return static_cast<FWidget*>(app_object);
if ( widget && ! getFocusWidget() )
rootObj->focusFirstChild();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FApplication::isQuit() bool FApplication::isQuit()
{ {
if ( rootObj ) return ( app_object ) ? quit_now : true;
return quit_now;
else
return true;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -152,7 +146,7 @@ void FApplication::exit_loop()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FApplication::exit (int retcode) void FApplication::exit (int retcode)
{ {
if ( ! rootObj ) // no global app object if ( ! app_object ) // no global app object
return; return;
if ( quit_now ) // don't overwrite quit code if ( quit_now ) // don't overwrite quit code
@ -264,7 +258,7 @@ void FApplication::sendQueuedEvents()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FApplication::eventInQueue() bool FApplication::eventInQueue()
{ {
if ( rootObj ) if ( app_object )
return ( ! event_queue->empty() ); return ( ! event_queue->empty() );
else else
return false; return false;
@ -507,6 +501,8 @@ inline void FApplication::findKeyboardWidget()
// Find the widget that has the keyboard focus // Find the widget that has the keyboard focus
FWidget* widget = 0; FWidget* widget = 0;
FWidget* focus_widget = getFocusWidget();
FWidget* move_size_widget = getMoveSizeWidget();
if ( focus_widget ) if ( focus_widget )
{ {
@ -517,7 +513,7 @@ inline void FApplication::findKeyboardWidget()
} }
else else
{ {
widget = main_widget; widget = getMainWidget();
if ( widget && widget->numOfChildren() >= 1 ) if ( widget && widget->numOfChildren() >= 1 )
widget->focusFirstChild(); widget->focusFirstChild();
@ -641,7 +637,7 @@ inline bool FApplication::sendKeyUpEvent (FWidget* widget)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FApplication::sendKeyboardAccelerator() inline void FApplication::sendKeyboardAccelerator()
{ {
if ( open_menu ) if ( getOpenMenu() )
return; return;
// Switch to a specific dialog with Meta + 1..9 // Switch to a specific dialog with Meta + 1..9
@ -650,7 +646,7 @@ inline void FApplication::sendKeyboardAccelerator()
// Windows keyboard accelerator // Windows keyboard accelerator
if ( ! accpt ) if ( ! accpt )
{ {
const FWidget* window = active_window; const FWidget* window = getActiveWindow();
if ( window ) if ( window )
accpt = processAccelerator (window); accpt = processAccelerator (window);
@ -696,14 +692,16 @@ bool FApplication::processDialogSwitchAccelerator()
if ( s > 0 && s >= n ) if ( s > 0 && s >= n )
{ {
// unset the move/size mode // unset the move/size mode
FWidget* move_size_widget = getMoveSizeWidget();
if ( move_size_widget ) if ( move_size_widget )
{ {
FWidget* w = move_size_widget; FWidget* w = move_size_widget;
move_size_widget = 0; setMoveSizeWidget(0);
w->redraw(); w->redraw();
} }
FAccelEvent a_ev (fc::Accelerator_Event, focus_widget); FAccelEvent a_ev (fc::Accelerator_Event, getFocusWidget());
sendEvent (dialog_list->at(n - 1), &a_ev); sendEvent (dialog_list->at(n - 1), &a_ev);
return true; return true;
} }
@ -733,14 +731,16 @@ bool FApplication::processAccelerator (const FWidget*& widget)
if ( iter->key == keyboard->getKey() ) if ( iter->key == keyboard->getKey() )
{ {
// unset the move/size mode // unset the move/size mode
FWidget* move_size_widget = getMoveSizeWidget();
if ( move_size_widget ) if ( move_size_widget )
{ {
FWidget* w = move_size_widget; FWidget* w = move_size_widget;
move_size_widget = 0; setMoveSizeWidget(0);
w->redraw(); w->redraw();
} }
FAccelEvent a_ev (fc::Accelerator_Event, focus_widget); FAccelEvent a_ev (fc::Accelerator_Event, getFocusWidget());
sendEvent (iter->object, &a_ev); sendEvent (iter->object, &a_ev);
accpt = a_ev.isAccepted(); accpt = a_ev.isAccepted();
break; break;
@ -772,6 +772,8 @@ bool FApplication::getMouseEvent()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FWidget*& FApplication::determineClickedWidget() FWidget*& FApplication::determineClickedWidget()
{ {
FWidget*& clicked_widget = getClickedWidget();
if ( clicked_widget ) if ( clicked_widget )
return clicked_widget; return clicked_widget;
@ -796,6 +798,7 @@ FWidget*& FApplication::determineClickedWidget()
// Determine the widget at the current click position // Determine the widget at the current click position
FWidget* child = childWidgetAt (window, mouse_position); FWidget* child = childWidgetAt (window, mouse_position);
clicked_widget = ( child != 0 ) ? child : window; clicked_widget = ( child != 0 ) ? child : window;
setClickedWidget (clicked_widget);
} }
return clicked_widget; return clicked_widget;
@ -805,10 +808,13 @@ FWidget*& FApplication::determineClickedWidget()
void FApplication::unsetMoveSizeMode() void FApplication::unsetMoveSizeMode()
{ {
// Unset the move/size mode // Unset the move/size mode
FWidget* move_size_widget = getMoveSizeWidget();
if ( move_size_widget ) if ( move_size_widget )
{ {
FWidget* w = move_size_widget; FWidget* w = move_size_widget;
move_size_widget = 0; setMoveSizeWidget(0);
w->redraw(); w->redraw();
} }
} }
@ -818,11 +824,12 @@ void FApplication::closeOpenMenu()
{ {
// Close the open menu // Close the open menu
FWidget* open_menu = getOpenMenu();
FMenu* menu = static_cast<FMenu*>(open_menu);
if ( ! open_menu || ( mouse && mouse->isMoved()) ) if ( ! open_menu || ( mouse && mouse->isMoved()) )
return; return;
FMenu* menu = static_cast<FMenu*>(open_menu);
if ( mouse ) if ( mouse )
{ {
const FPoint& mouse_position = mouse->getPos(); const FPoint& mouse_position = mouse->getPos();
@ -845,7 +852,7 @@ void FApplication::closeOpenMenu()
menu->hideSuperMenus(); menu->hideSuperMenus();
// No widget was been clicked and the menu is no dialog menu // No widget was been clicked and the menu is no dialog menu
if ( ! (clicked_widget || is_window_menu) ) if ( ! (getClickedWidget() || is_window_menu) )
FWindow::switchToPrevWindow(); FWindow::switchToPrevWindow();
if ( getStatusBar() ) if ( getStatusBar() )
@ -860,11 +867,12 @@ void FApplication::unselectMenubarItems()
{ {
// Unselect the menu bar items // Unselect the menu bar items
FWidget* open_menu = getOpenMenu();
FMenuBar* menu_bar = getMenuBar();
if ( open_menu || (mouse && mouse->isMoved()) ) if ( open_menu || (mouse && mouse->isMoved()) )
return; return;
FMenuBar* menu_bar = getMenuBar();
if ( ! menu_bar ) if ( ! menu_bar )
return; return;
@ -885,7 +893,7 @@ void FApplication::unselectMenubarItems()
getMenuBar()->redraw(); getMenuBar()->redraw();
// No widget was been clicked // No widget was been clicked
if ( ! clicked_widget ) if ( ! getClickedWidget() )
FWindow::switchToPrevWindow(); FWindow::switchToPrevWindow();
if ( getStatusBar() ) if ( getStatusBar() )
@ -899,6 +907,8 @@ void FApplication::unselectMenubarItems()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FApplication::sendMouseEvent() void FApplication::sendMouseEvent()
{ {
FWidget* clicked_widget = getClickedWidget();
if ( ! clicked_widget ) if ( ! clicked_widget )
return; return;
@ -943,6 +953,8 @@ void FApplication::sendMouseMoveEvent ( const FPoint& widgetMousePos
if ( ! mouse ) if ( ! mouse )
return; return;
FWidget* clicked_widget = getClickedWidget();
if ( mouse->isLeftButtonPressed() ) if ( mouse->isLeftButtonPressed() )
{ {
FMouseEvent m_down_ev ( fc::MouseMove_Event FMouseEvent m_down_ev ( fc::MouseMove_Event
@ -979,6 +991,8 @@ void FApplication::sendMouseLeftClickEvent ( const FPoint& widgetMousePos
if ( ! mouse ) if ( ! mouse )
return; return;
FWidget* clicked_widget = getClickedWidget();
if ( mouse->isLeftButtonDoubleClick() ) if ( mouse->isLeftButtonDoubleClick() )
{ {
FMouseEvent m_dblclick_ev ( fc::MouseDoubleClick_Event FMouseEvent m_dblclick_ev ( fc::MouseDoubleClick_Event
@ -1005,7 +1019,7 @@ void FApplication::sendMouseLeftClickEvent ( const FPoint& widgetMousePos
if ( ! mouse->isRightButtonPressed() if ( ! mouse->isRightButtonPressed()
&& ! mouse->isMiddleButtonPressed() ) && ! mouse->isMiddleButtonPressed() )
clicked_widget = 0; setClickedWidget(0);
sendEvent (released_widget, &m_up_ev); sendEvent (released_widget, &m_up_ev);
} }
@ -1019,6 +1033,8 @@ void FApplication::sendMouseRightClickEvent ( const FPoint& widgetMousePos
if ( ! mouse ) if ( ! mouse )
return; return;
FWidget* clicked_widget = getClickedWidget();
if ( mouse->isRightButtonPressed() ) if ( mouse->isRightButtonPressed() )
{ {
FMouseEvent m_down_ev ( fc::MouseDown_Event FMouseEvent m_down_ev ( fc::MouseDown_Event
@ -1037,7 +1053,7 @@ void FApplication::sendMouseRightClickEvent ( const FPoint& widgetMousePos
if ( ! mouse->isLeftButtonPressed() if ( ! mouse->isLeftButtonPressed()
&& ! mouse->isMiddleButtonPressed() ) && ! mouse->isMiddleButtonPressed() )
clicked_widget = 0; setClickedWidget(0);
sendEvent (released_widget, &m_up_ev); sendEvent (released_widget, &m_up_ev);
} }
@ -1051,6 +1067,8 @@ void FApplication::sendMouseMiddleClickEvent ( const FPoint& widgetMousePos
if ( ! mouse ) if ( ! mouse )
return; return;
FWidget* clicked_widget = getClickedWidget();
if ( mouse->isMiddleButtonPressed() ) if ( mouse->isMiddleButtonPressed() )
{ {
FMouseEvent m_down_ev ( fc::MouseDown_Event FMouseEvent m_down_ev ( fc::MouseDown_Event
@ -1061,7 +1079,7 @@ void FApplication::sendMouseMiddleClickEvent ( const FPoint& widgetMousePos
// gnome-terminal sends no released on middle click // gnome-terminal sends no released on middle click
if ( isGnomeTerminal() ) if ( isGnomeTerminal() )
clicked_widget = 0; setClickedWidget(0);
} }
else if ( mouse->isMiddleButtonReleased() ) else if ( mouse->isMiddleButtonReleased() )
{ {
@ -1074,7 +1092,7 @@ void FApplication::sendMouseMiddleClickEvent ( const FPoint& widgetMousePos
if ( ! mouse->isLeftButtonPressed() if ( ! mouse->isLeftButtonPressed()
&& ! mouse->isRightButtonPressed() ) && ! mouse->isRightButtonPressed() )
{ {
clicked_widget = 0; setClickedWidget(0);
} }
sendEvent (released_widget, &m_up_ev); sendEvent (released_widget, &m_up_ev);
@ -1088,6 +1106,8 @@ void FApplication::sendWheelEvent ( const FPoint& widgetMousePos
if ( ! mouse ) if ( ! mouse )
return; return;
FWidget* clicked_widget = getClickedWidget();
if ( mouse->isWheelUp() ) if ( mouse->isWheelUp() )
{ {
FWheelEvent wheel_ev ( fc::MouseWheel_Event FWheelEvent wheel_ev ( fc::MouseWheel_Event
@ -1095,7 +1115,7 @@ void FApplication::sendWheelEvent ( const FPoint& widgetMousePos
, mouse_position , mouse_position
, fc::WheelUp ); , fc::WheelUp );
FWidget* scroll_over_widget = clicked_widget; FWidget* scroll_over_widget = clicked_widget;
clicked_widget = 0; setClickedWidget(0);
sendEvent(scroll_over_widget, &wheel_ev); sendEvent(scroll_over_widget, &wheel_ev);
} }
@ -1106,7 +1126,7 @@ void FApplication::sendWheelEvent ( const FPoint& widgetMousePos
, mouse_position , mouse_position
, fc::WheelDown ); , fc::WheelDown );
FWidget* scroll_over_widget = clicked_widget; FWidget* scroll_over_widget = clicked_widget;
clicked_widget = 0; setClickedWidget(0);
sendEvent (scroll_over_widget, &wheel_ev); sendEvent (scroll_over_widget, &wheel_ev);
} }
} }
@ -1133,7 +1153,7 @@ void FApplication::processResizeEvent()
if ( hasChangedTermSize() ) if ( hasChangedTermSize() )
{ {
FResizeEvent r_ev(fc::Resize_Event); FResizeEvent r_ev(fc::Resize_Event);
sendEvent(rootObj, &r_ev); sendEvent(app_object, &r_ev);
if ( r_ev.isAccepted() ) if ( r_ev.isAccepted() )
changeTermSizeFinished(); changeTermSizeFinished();

View File

@ -243,7 +243,7 @@ void FTextView::insert (const FString& str, int pos)
FString s; FString s;
std::size_t num; std::size_t num;
if ( pos >= int(getRows()) ) if ( pos < 0 || pos >= int(getRows()) )
pos = int(getRows()); pos = int(getRows());
if ( str.isEmpty() ) if ( str.isEmpty() )

View File

@ -34,19 +34,18 @@ namespace finalcut
static FWidget* rootObject = 0; static FWidget* rootObject = 0;
// static class attributes // static class attributes
uInt FWidget::modal_dialogs; FStatusBar* FWidget::statusbar = 0;
FMenuBar* FWidget::menubar = 0;
FStatusBar* FWidget::statusbar = 0; FWidget* FWidget::show_root_widget = 0;
FMenuBar* FWidget::menubar = 0; FWidget* FWidget::redraw_root_widget = 0;
FWidget* FWidget::show_root_widget = 0; FWidget::widgetList* FWidget::window_list = 0;
FWidget* FWidget::redraw_root_widget = 0; FWidget::widgetList* FWidget::dialog_list = 0;
FWidget::widgetList* FWidget::window_list = 0; FWidget::widgetList* FWidget::always_on_top_list = 0;
FWidget::widgetList* FWidget::dialog_list = 0; FWidget::widgetList* FWidget::close_widget = 0;
FWidget::widgetList* FWidget::always_on_top_list = 0; FWidgetColors FWidget::wc;
FWidget::widgetList* FWidget::close_widget = 0; bool FWidget::init_desktop;
FWidgetColors FWidget::wc; bool FWidget::hideable;
bool FWidget::init_desktop; uInt FWidget::modal_dialogs;
bool FWidget::hideable;
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -175,20 +174,6 @@ FWidget* FWidget::getParentWidget() const
return 0; return 0;
} }
//----------------------------------------------------------------------
FWidget* FWidget::getMainWidget()
{
FWidget* main_widget = static_cast<FWidget*>(FApplication::main_widget);
return main_widget;
}
//----------------------------------------------------------------------
FWidget* FWidget::getFocusWidget() const
{
FWidget* focus_widget = static_cast<FWidget*>(FApplication::focus_widget);
return focus_widget;
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FWidget* FWidget::getFirstFocusableWidget (FObjectList list) FWidget* FWidget::getFirstFocusableWidget (FObjectList list)
{ {
@ -242,44 +227,6 @@ FWidget* FWidget::getLastFocusableWidget (FObjectList list)
return 0; return 0;
} }
//----------------------------------------------------------------------
FWidget* FWidget::getClickedWidget()
{
FWidget* clicked_widget = static_cast<FWidget*>(FApplication::clicked_widget);
return clicked_widget;
}
//----------------------------------------------------------------------
FWidget* FWidget::getMoveSizeWidget()
{
return FApplication::move_size_widget;
}
//----------------------------------------------------------------------
FWidget* FWidget::getOpenMenu()
{
FWidget* open_menu = static_cast<FWidget*>(FApplication::open_menu);
return open_menu;
}
//----------------------------------------------------------------------
FMenuBar* FWidget::getMenuBar()
{
if ( menubar )
return menubar;
else
return 0;
}
//----------------------------------------------------------------------
FStatusBar* FWidget::getStatusBar()
{
if ( statusbar )
return statusbar;
else
return 0;
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FPoint FWidget::getPrintPos() FPoint FWidget::getPrintPos()
{ {
@ -319,38 +266,11 @@ std::vector<bool>& FWidget::doubleFlatLine_ref (fc::sides side)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FWidget::setMainWidget (FWidget* obj) void FWidget::setMainWidget (FWidget* obj)
{ {
FApplication* fapp = static_cast<FApplication*>(rootObject); main_widget = obj;
fapp->setMainWidget(obj); FWidget* app_object = FApplication::getApplicationObject();
}
//---------------------------------------------------------------------- if ( obj && app_object && ! getFocusWidget() )
void FWidget::setFocusWidget (FWidget* obj) app_object->focusFirstChild();
{
FApplication::focus_widget = obj;
}
//----------------------------------------------------------------------
void FWidget::setClickedWidget (FWidget* obj)
{
FApplication::clicked_widget = obj;
}
//----------------------------------------------------------------------
void FWidget::setMoveSizeWidget (FWidget* obj)
{
FApplication::move_size_widget = obj;
}
//----------------------------------------------------------------------
void FWidget::setOpenMenu (FWidget* obj)
{
FApplication::open_menu = obj;
}
//----------------------------------------------------------------------
void FWidget::setStatusbarMessage (const FString& msg)
{
statusbar_message = msg;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -1569,7 +1489,8 @@ void FWidget::drawBorder (int x1, int y1, int x2, int y2)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FWidget::quit() void FWidget::quit()
{ {
FApplication* fapp = static_cast<FApplication*>(rootObject); FWidget* app_object = FApplication::getApplicationObject();
FApplication* fapp = static_cast<FApplication*>(app_object);
fapp->exit(0); fapp->exit(0);
} }

View File

@ -80,14 +80,6 @@ FWindow::~FWindow() // destructor
// public methods of FWindow // public methods of FWindow
//----------------------------------------------------------------------
FWindow* FWindow::getActiveWindow()
{
// returns the active FWindow object
FWindow* active_window = static_cast<FWindow*>(FApplication::active_window);
return active_window;
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FWidget* FWindow::getWindowFocusWidget() const FWidget* FWindow::getWindowFocusWidget() const
{ {
@ -170,7 +162,7 @@ bool FWindow::activateWindow (bool on)
// activate/deactivate this window // activate/deactivate this window
if ( on ) if ( on )
{ {
FApplication::active_window = this; FWidget::setActiveWindow (this);
active_area = getVWin(); active_area = getVWin();
} }
@ -181,7 +173,7 @@ bool FWindow::activateWindow (bool on)
void FWindow::unsetActiveWindow() void FWindow::unsetActiveWindow()
{ {
// unset the active FWindow object // unset the active FWindow object
FApplication::active_window = 0; FWidget::setActiveWindow (0);
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -728,7 +720,7 @@ void FWindow::switchToPrevWindow()
updateTerminal (FVTerm::stop_refresh); updateTerminal (FVTerm::stop_refresh);
bool is_activated = activatePrevWindow(); bool is_activated = activatePrevWindow();
FWindow* active_window = getActiveWindow(); FWindow* active_window = static_cast<FWindow*>(getActiveWindow());
if ( ! is_activated ) if ( ! is_activated )
{ {

View File

@ -92,11 +92,7 @@ class FApplication : public FWidget
const char* getClassName() const; const char* getClassName() const;
int getArgc() const; int getArgc() const;
char** getArgv() const; char** getArgv() const;
FWidget* getMainWidget() const; static FWidget* getApplicationObject();
virtual FWidget* getFocusWidget() const;
// Mutator
void setMainWidget (FWidget*);
// Inquiry // Inquiry
static bool isQuit(); static bool isQuit();
@ -193,28 +189,6 @@ class FApplication : public FWidget
static bool process_timer_event; static bool process_timer_event;
static FKeyboard* keyboard; static FKeyboard* keyboard;
static FWidget* keyboard_widget; static FWidget* keyboard_widget;
static FWidget* move_size_widget;
static FWidget* main_widget;
static FWidget* active_window;
static FWidget* focus_widget;
static FWidget* clicked_widget;
static FWidget* open_menu;
// Friend functions from FWidget
friend FWidget* FWidget::getMainWidget();
friend FWidget* FWidget::getFocusWidget() const;
friend void FWidget::setFocusWidget (FWidget*);
friend FWidget* FWidget::getClickedWidget();
friend void FWidget::setClickedWidget (FWidget*);
friend FWidget* FWidget::getMoveSizeWidget();
friend void FWidget::setMoveSizeWidget (FWidget*);
friend FWidget* FWidget::getOpenMenu();
friend void FWidget::setOpenMenu (FWidget*);
// Friend functions from FWindow
friend bool FWindow::activateWindow (bool);
friend FWindow* FWindow::getActiveWindow();
friend void FWindow::unsetActiveWindow();
}; };
#pragma pack(pop) #pragma pack(pop)
@ -232,14 +206,6 @@ inline int FApplication::getArgc() const
inline char** FApplication::getArgv() const inline char** FApplication::getArgv() const
{ return app_argv; } { return app_argv; }
//----------------------------------------------------------------------
inline FWidget* FApplication::getMainWidget() const
{ return main_widget; }
//----------------------------------------------------------------------
inline FWidget* FApplication::getFocusWidget() const
{ return focus_widget; }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FApplication::cb_exitApp (FWidget*, data_ptr) inline void FApplication::cb_exitApp (FWidget*, data_ptr)
{ close(); } { close(); }

View File

@ -152,13 +152,14 @@ class FWidget : public FVTerm, public FObject
const char* getClassName() const; const char* getClassName() const;
FWidget* getRootWidget() const; FWidget* getRootWidget() const;
FWidget* getParentWidget() const; FWidget* getParentWidget() const;
static FWidget* getMainWidget(); static FWidget*& getMainWidget();
virtual FWidget* getFocusWidget() const; static FWidget*& getActiveWindow();
static FWidget*& getFocusWidget();
static FWidget*& getClickedWidget();
static FWidget*& getOpenMenu();
static FWidget*& getMoveSizeWidget();
virtual FWidget* getFirstFocusableWidget (FObjectList); virtual FWidget* getFirstFocusableWidget (FObjectList);
virtual FWidget* getLastFocusableWidget (FObjectList); virtual FWidget* getLastFocusableWidget (FObjectList);
static FWidget* getClickedWidget();
static FWidget* getMoveSizeWidget();
static FWidget* getOpenMenu();
static FMenuBar* getMenuBar(); static FMenuBar* getMenuBar();
static FStatusBar* getStatusBar(); static FStatusBar* getStatusBar();
FString getStatusbarMessage() const; FString getStatusbarMessage() const;
@ -194,9 +195,10 @@ class FWidget : public FVTerm, public FObject
// Mutators // Mutators
static void setMainWidget (FWidget*); static void setMainWidget (FWidget*);
virtual void setFocusWidget (FWidget*); static void setFocusWidget (FWidget*);
static void setClickedWidget (FWidget*); static void setClickedWidget (FWidget*);
static void setMoveSizeWidget (FWidget*); static void setMoveSizeWidget (FWidget*);
static void setActiveWindow (FWidget*);
static void setOpenMenu (FWidget*); static void setOpenMenu (FWidget*);
virtual void setStatusbarMessage (const FString&); virtual void setStatusbarMessage (const FString&);
bool setVisible(); bool setVisible();
@ -491,6 +493,12 @@ class FWidget : public FVTerm, public FObject
FString statusbar_message; FString statusbar_message;
static FStatusBar* statusbar; static FStatusBar* statusbar;
static FMenuBar* menubar; static FMenuBar* menubar;
static FWidget* main_widget;
static FWidget* active_window;
static FWidget* focus_widget;
static FWidget* clicked_widget;
static FWidget* open_menu;
static FWidget* move_size_widget;
static FWidget* show_root_widget; static FWidget* show_root_widget;
static FWidget* redraw_root_widget; static FWidget* redraw_root_widget;
static bool init_desktop; static bool init_desktop;
@ -508,6 +516,38 @@ class FWidget : public FVTerm, public FObject
inline const char* FWidget::getClassName() const inline const char* FWidget::getClassName() const
{ return "FWidget"; } { return "FWidget"; }
//----------------------------------------------------------------------
inline FWidget*& FWidget::getMainWidget()
{ return main_widget; }
//----------------------------------------------------------------------
inline FWidget*& FWidget::getActiveWindow() // returns active FWindow object
{ return active_window; }
//----------------------------------------------------------------------
inline FWidget*& FWidget::getFocusWidget()
{ return focus_widget; }
//----------------------------------------------------------------------
inline FWidget*& FWidget::getClickedWidget()
{ return clicked_widget; }
//----------------------------------------------------------------------
inline FWidget*& FWidget::getOpenMenu()
{ return open_menu; }
//----------------------------------------------------------------------
inline FWidget*& FWidget::getMoveSizeWidget()
{ return move_size_widget; }
//----------------------------------------------------------------------
inline FMenuBar* FWidget::getMenuBar()
{ return menubar; }
//----------------------------------------------------------------------
inline FStatusBar* FWidget::getStatusBar()
{ return statusbar; }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline FString FWidget::getStatusbarMessage() const inline FString FWidget::getStatusbarMessage() const
{ return statusbar_message; } { return statusbar_message; }
@ -650,6 +690,30 @@ inline int FWidget::getFlags() const
inline FPoint FWidget::getCursorPos() inline FPoint FWidget::getCursorPos()
{ return widget_cursor_position; } { return widget_cursor_position; }
//----------------------------------------------------------------------
inline void FWidget::setActiveWindow (FWidget* obj)
{ active_window = obj; }
//----------------------------------------------------------------------
inline void FWidget::setFocusWidget (FWidget* obj)
{ focus_widget = obj; }
//----------------------------------------------------------------------
inline void FWidget::setClickedWidget (FWidget* obj)
{ clicked_widget = obj; }
//----------------------------------------------------------------------
inline void FWidget::setOpenMenu (FWidget* obj)
{ open_menu = obj; }
//----------------------------------------------------------------------
inline void FWidget::setMoveSizeWidget (FWidget* obj)
{ move_size_widget = obj; }
//----------------------------------------------------------------------
inline void FWidget::setStatusbarMessage (const FString& msg)
{ statusbar_message = msg; }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FWidget::setVisible() inline bool FWidget::setVisible()
{ return visible = true; } { return visible = true; }

View File

@ -91,7 +91,6 @@ class FWindow : public FWidget
const char* getClassName() const; const char* getClassName() const;
static FWindow* getWindowWidget (const FWidget*); static FWindow* getWindowWidget (const FWidget*);
static int getWindowLayer (const FWidget*); static int getWindowLayer (const FWidget*);
static FWindow* getActiveWindow();
FWidget* getWindowFocusWidget() const; FWidget* getWindowFocusWidget() const;
// Mutators // Mutators