2015-09-25 21:37:19 +02:00
|
|
|
// File: fwindow.h
|
2016-10-01 23:18:49 +02:00
|
|
|
// Provides: class FWindow
|
2015-09-25 21:37:19 +02:00
|
|
|
//
|
|
|
|
// Inheritance diagram
|
|
|
|
// ═══════════════════
|
|
|
|
//
|
|
|
|
// ▕▔▔▔▔▔▔▔▔▔▏ ▕▔▔▔▔▔▔▔▔▔▏
|
|
|
|
// ▕ FObject ▏ ▕ FTerm ▏
|
|
|
|
// ▕▁▁▁▁▁▁▁▁▁▏ ▕▁▁▁▁▁▁▁▁▁▏
|
|
|
|
// ▲ ▲
|
|
|
|
// │ │
|
|
|
|
// └─────┬─────┘
|
|
|
|
// │
|
2016-10-11 04:57:36 +02:00
|
|
|
// ▕▔▔▔▔▔▔▔▔▏
|
|
|
|
// ▕ FVTerm ▏
|
|
|
|
// ▕▁▁▁▁▁▁▁▁▏
|
|
|
|
// ▲
|
|
|
|
// │
|
2015-09-25 21:37:19 +02:00
|
|
|
// ▕▔▔▔▔▔▔▔▔▔▏
|
|
|
|
// ▕ FWidget ▏
|
|
|
|
// ▕▁▁▁▁▁▁▁▁▁▏
|
|
|
|
// ▲
|
|
|
|
// │
|
|
|
|
// ▕▔▔▔▔▔▔▔▔▔▏ 1 *▕▔▔▔▔▔▔▔▔▏
|
|
|
|
// ▕ FWindow ▏-┬- - - -▕ FEvent ▏
|
|
|
|
// ▕▁▁▁▁▁▁▁▁▁▏ : ▕▁▁▁▁▁▁▁▁▏
|
|
|
|
// :
|
|
|
|
// : *▕▔▔▔▔▔▔▔▔▏
|
|
|
|
// :- - - -▕ FPoint ▏
|
|
|
|
// : ▕▁▁▁▁▁▁▁▁▏
|
|
|
|
// :
|
|
|
|
// : *▕▔▔▔▔▔▔▔▔▔▏
|
|
|
|
// └- - - -▕ FWidget ▏
|
|
|
|
// ▕▁▁▁▁▁▁▁▁▁▏
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
#ifndef _FWINDOW_H
|
|
|
|
#define _FWINDOW_H
|
|
|
|
|
|
|
|
#include "fwidget.h"
|
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// class FWindow
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
#pragma pack(push)
|
|
|
|
#pragma pack(1)
|
|
|
|
|
|
|
|
class FWindow : public FWidget
|
|
|
|
{
|
|
|
|
private:
|
2016-07-27 04:55:10 +02:00
|
|
|
bool window_active;
|
2016-09-11 16:48:39 +02:00
|
|
|
bool zoomed;
|
2016-07-27 04:55:10 +02:00
|
|
|
FWidget* win_focus_widget;
|
2016-09-11 16:48:39 +02:00
|
|
|
FRect normalGeometry;
|
2015-05-23 13:35:12 +02:00
|
|
|
|
2016-06-26 16:08:03 +02:00
|
|
|
protected:
|
2016-10-13 02:16:51 +02:00
|
|
|
static FWindow* previous_window;
|
2016-06-26 16:08:03 +02:00
|
|
|
|
2015-05-23 13:35:12 +02:00
|
|
|
private:
|
2016-09-30 04:55:28 +02:00
|
|
|
// Disable copy constructor
|
2015-05-23 13:35:12 +02:00
|
|
|
FWindow (const FWindow&);
|
2016-09-30 04:55:28 +02:00
|
|
|
// Disable assignment operator (=)
|
2015-05-23 13:35:12 +02:00
|
|
|
FWindow& operator = (const FWindow&);
|
|
|
|
|
2016-10-02 21:26:25 +02:00
|
|
|
static void deleteFromAlwaysOnTopList (FWidget*);
|
|
|
|
static void processAlwaysOnTop();
|
2016-10-01 23:18:49 +02:00
|
|
|
|
2015-05-23 13:35:12 +02:00
|
|
|
protected:
|
2016-09-30 04:55:28 +02:00
|
|
|
// Event handlers
|
2015-05-23 13:35:12 +02:00
|
|
|
bool event (FEvent*);
|
|
|
|
virtual void onWindowActive (FEvent*);
|
|
|
|
virtual void onWindowInactive (FEvent*);
|
|
|
|
virtual void onWindowRaised (FEvent*);
|
|
|
|
virtual void onWindowLowered (FEvent*);
|
2016-09-30 04:55:28 +02:00
|
|
|
|
2016-09-25 23:53:48 +02:00
|
|
|
virtual void adjustSize();
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
public:
|
2016-09-30 04:55:28 +02:00
|
|
|
// Constructor
|
|
|
|
explicit FWindow (FWidget* = 0);
|
|
|
|
// Destructor
|
|
|
|
~FWindow ();
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
const char* getClassName() const;
|
2016-10-06 23:15:09 +02:00
|
|
|
// make every drawBorder from FWidget available
|
|
|
|
using FWidget::drawBorder;
|
|
|
|
virtual void drawBorder();
|
2015-09-22 22:12:31 +02:00
|
|
|
virtual void show();
|
|
|
|
virtual void hide();
|
2016-09-29 04:29:12 +02:00
|
|
|
virtual void setWidth (int, bool = true);
|
|
|
|
virtual void setHeight (int, bool = true);
|
|
|
|
virtual void setSize (int, int, bool = true);
|
2016-09-11 16:48:39 +02:00
|
|
|
// make every setGeometry from FWidget available
|
|
|
|
using FWidget::setGeometry;
|
|
|
|
void setGeometry (int, int, int, int, bool = true);
|
2015-10-19 00:07:07 +02:00
|
|
|
static FWindow* getWindowWidgetAt (const FPoint&);
|
|
|
|
static FWindow* getWindowWidgetAt (int, int);
|
2015-05-23 13:35:12 +02:00
|
|
|
static void addWindow (FWidget*);
|
|
|
|
static void delWindow (FWidget*);
|
|
|
|
static FWindow* getWindowWidget (FWidget*);
|
|
|
|
static int getWindowLayer (FWidget*);
|
|
|
|
static void swapWindow (FWidget*, FWidget*);
|
|
|
|
static bool raiseWindow (FWidget*);
|
|
|
|
bool raiseWindow ();
|
|
|
|
static bool lowerWindow (FWidget*);
|
|
|
|
bool lowerWindow ();
|
2016-09-11 16:48:39 +02:00
|
|
|
bool zoomWindow ();
|
|
|
|
bool isZoomed() const;
|
2016-09-25 23:53:48 +02:00
|
|
|
bool setWindowWidget (bool);
|
|
|
|
bool setWindowWidget();
|
|
|
|
bool unsetWindowWidget();
|
2015-05-23 13:35:12 +02:00
|
|
|
static FWindow* getActiveWindow();
|
2016-07-27 04:55:10 +02:00
|
|
|
static void setActiveWindow (FWindow*);
|
|
|
|
FWidget* getWindowFocusWidget() const;
|
|
|
|
void setWindowFocusWidget (FWidget*);
|
2016-06-19 20:32:03 +02:00
|
|
|
static void switchToPrevWindow();
|
2015-05-23 13:35:12 +02:00
|
|
|
static bool activatePrevWindow();
|
2016-06-19 20:32:03 +02:00
|
|
|
bool activateWindow (bool);
|
2015-05-23 13:35:12 +02:00
|
|
|
bool activateWindow();
|
|
|
|
bool deactivateWindow();
|
2016-10-11 04:57:36 +02:00
|
|
|
bool isWindowActive() const;
|
|
|
|
bool isWindowHidden() const;
|
|
|
|
virtual bool setResizeable (bool);
|
|
|
|
virtual bool setResizeable();
|
2016-10-09 02:06:06 +02:00
|
|
|
bool unsetResizeable();
|
|
|
|
bool isResizeable();
|
|
|
|
bool setTransparentShadow (bool);
|
|
|
|
bool setTransparentShadow();
|
|
|
|
bool unsetTransparentShadow();
|
|
|
|
bool hasTransparentShadow();
|
|
|
|
bool setShadow (bool);
|
|
|
|
bool setShadow();
|
|
|
|
bool unsetShadow();
|
|
|
|
bool hasShadow();
|
|
|
|
virtual void setShadowSize (int, int);
|
2016-10-01 23:18:49 +02:00
|
|
|
bool setAlwaysOnTop (bool);
|
|
|
|
bool setAlwaysOnTop();
|
|
|
|
bool unsetAlwaysOnTop();
|
|
|
|
bool isAlwaysOnTop();
|
2015-05-23 13:35:12 +02:00
|
|
|
};
|
|
|
|
#pragma pack(pop)
|
|
|
|
|
|
|
|
|
|
|
|
// FWindow inline functions
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline const char* FWindow::getClassName() const
|
|
|
|
{ return "FWindow"; }
|
|
|
|
|
2015-10-17 19:40:43 +02:00
|
|
|
//----------------------------------------------------------------------
|
2015-10-19 00:07:07 +02:00
|
|
|
inline FWindow* FWindow::getWindowWidgetAt (const FPoint& pos)
|
|
|
|
{ return getWindowWidgetAt (pos.getX(), pos.getY()); }
|
2015-10-17 19:40:43 +02:00
|
|
|
|
2015-05-23 13:35:12 +02:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWindow::raiseWindow()
|
|
|
|
{ return raiseWindow(this); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWindow::lowerWindow()
|
|
|
|
{ return lowerWindow(this); }
|
|
|
|
|
2016-09-11 16:48:39 +02:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWindow::isZoomed() const
|
|
|
|
{ return zoomed; }
|
|
|
|
|
2016-09-25 23:53:48 +02:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWindow::setWindowWidget()
|
|
|
|
{ return setWindowWidget(true); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWindow::unsetWindowWidget()
|
|
|
|
{ return setWindowWidget(false); }
|
|
|
|
|
2015-05-23 13:35:12 +02:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWindow::activateWindow()
|
|
|
|
{ return activateWindow(true); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWindow::deactivateWindow()
|
|
|
|
{ return activateWindow(false); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2016-10-11 04:57:36 +02:00
|
|
|
inline bool FWindow::isWindowActive() const
|
2015-05-23 13:35:12 +02:00
|
|
|
{ return window_active; }
|
|
|
|
|
2016-10-09 02:06:06 +02:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWindow::setResizeable()
|
|
|
|
{ return setResizeable(true); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWindow::unsetResizeable()
|
|
|
|
{ return setResizeable(false); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWindow::isResizeable()
|
|
|
|
{ return ((flags & fc::resizeable) != 0); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWindow::setTransparentShadow()
|
|
|
|
{ return setTransparentShadow(true); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWindow::unsetTransparentShadow()
|
|
|
|
{ return setTransparentShadow(false); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWindow::hasTransparentShadow()
|
|
|
|
{ return ((flags & fc::trans_shadow) != 0); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWindow::setShadow()
|
|
|
|
{ return setShadow(true); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWindow::unsetShadow()
|
|
|
|
{ return setShadow(false); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWindow::hasShadow()
|
|
|
|
{ return ((flags & fc::shadow) != 0); }
|
|
|
|
|
2016-10-01 23:18:49 +02:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWindow::setAlwaysOnTop()
|
|
|
|
{ return setAlwaysOnTop(true); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWindow::unsetAlwaysOnTop()
|
|
|
|
{ return setAlwaysOnTop(false); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWindow::isAlwaysOnTop()
|
|
|
|
{ return ((flags & fc::always_on_top) != 0); }
|
|
|
|
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
#endif // _FWINDOW_H
|