2017-10-02 07:32:33 +02:00
|
|
|
/************************************************************************
|
|
|
|
* fwindow.h - Intermediate base class for all window objects *
|
|
|
|
* *
|
|
|
|
* This file is part of the Final Cut widget toolkit *
|
|
|
|
* *
|
|
|
|
* Copyright 2015-2017 Markus Gans *
|
|
|
|
* *
|
|
|
|
* The Final Cut is free software; you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU General Public License as published by *
|
|
|
|
* the Free Software Foundation; either version 3 of the License, or *
|
|
|
|
* (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* The Final Cut is distributed in the hope that it will be useful, *
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
* GNU General Public License for more details. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU General Public License *
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
/* Inheritance diagram
|
|
|
|
* ═══════════════════
|
|
|
|
*
|
2017-10-29 14:27:50 +01:00
|
|
|
* ▕▔▔▔▔▔▔▔▔▔▏
|
|
|
|
* ▕ FTerm ▏
|
|
|
|
* ▕▁▁▁▁▁▁▁▁▁▏
|
|
|
|
* ▲
|
|
|
|
* │
|
2017-10-02 07:32:33 +02:00
|
|
|
* ▕▔▔▔▔▔▔▔▔▔▏ ▕▔▔▔▔▔▔▔▔▔▏
|
2017-10-29 14:27:50 +01:00
|
|
|
* ▕ FVTerm ▏ ▕ FObject ▏
|
2017-10-02 07:32:33 +02:00
|
|
|
* ▕▁▁▁▁▁▁▁▁▁▏ ▕▁▁▁▁▁▁▁▁▁▏
|
|
|
|
* ▲ ▲
|
|
|
|
* │ │
|
|
|
|
* └─────┬─────┘
|
|
|
|
* │
|
|
|
|
* ▕▔▔▔▔▔▔▔▔▔▏
|
|
|
|
* ▕ FWidget ▏
|
|
|
|
* ▕▁▁▁▁▁▁▁▁▁▏
|
|
|
|
* ▲
|
|
|
|
* │
|
|
|
|
* ▕▔▔▔▔▔▔▔▔▔▏1 *▕▔▔▔▔▔▔▔▔▏
|
|
|
|
* ▕ FWindow ▏-┬- - - -▕ FEvent ▏
|
|
|
|
* ▕▁▁▁▁▁▁▁▁▁▏ : ▕▁▁▁▁▁▁▁▁▏
|
|
|
|
* :
|
|
|
|
* : *▕▔▔▔▔▔▔▔▔▏
|
|
|
|
* :- - - -▕ FPoint ▏
|
|
|
|
* : ▕▁▁▁▁▁▁▁▁▏
|
|
|
|
* :
|
|
|
|
* : *▕▔▔▔▔▔▔▔▔▔▏
|
|
|
|
* └- - - -▕ FWidget ▏
|
|
|
|
* ▕▁▁▁▁▁▁▁▁▁▏
|
|
|
|
*/
|
2015-05-23 13:35:12 +02:00
|
|
|
|
2017-04-09 20:08:53 +02:00
|
|
|
#ifndef FWINDOW_H
|
|
|
|
#define FWINDOW_H
|
2015-05-23 13:35:12 +02:00
|
|
|
|
2017-10-31 00:41:59 +01:00
|
|
|
#if !defined (USE_FINAL_H) && !defined (COMPILE_FINAL_CUT)
|
|
|
|
#error "Only <final/final.h> can be included directly."
|
|
|
|
#endif
|
|
|
|
|
2017-09-17 21:32:46 +02:00
|
|
|
#include "final/fwidget.h"
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// class FWindow
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
#pragma pack(push)
|
|
|
|
#pragma pack(1)
|
|
|
|
|
|
|
|
class FWindow : public FWidget
|
|
|
|
{
|
|
|
|
public:
|
2016-11-02 00:37:58 +01:00
|
|
|
// Using-declaration
|
|
|
|
using FWidget::drawBorder;
|
|
|
|
using FWidget::setPos;
|
|
|
|
using FWidget::setGeometry;
|
|
|
|
using FWidget::move;
|
|
|
|
|
2016-09-30 04:55:28 +02:00
|
|
|
// Constructor
|
|
|
|
explicit FWindow (FWidget* = 0);
|
2016-11-02 00:37:58 +01:00
|
|
|
|
2016-09-30 04:55:28 +02:00
|
|
|
// Destructor
|
|
|
|
~FWindow ();
|
2015-05-23 13:35:12 +02:00
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
// Accessors
|
2015-05-23 13:35:12 +02:00
|
|
|
const char* getClassName() const;
|
2017-08-12 20:10:27 +02:00
|
|
|
static FWindow* getWindowWidget (const FWidget*);
|
|
|
|
static int getWindowLayer (const FWidget*);
|
2016-11-02 00:37:58 +01:00
|
|
|
static FWindow* getActiveWindow();
|
|
|
|
FWidget* getWindowFocusWidget() const;
|
|
|
|
|
|
|
|
// Mutators
|
|
|
|
bool setWindowWidget (bool);
|
|
|
|
bool setWindowWidget();
|
|
|
|
bool unsetWindowWidget();
|
|
|
|
static void setActiveWindow (FWindow*);
|
2017-08-12 20:10:27 +02:00
|
|
|
void setWindowFocusWidget (const FWidget*);
|
2016-11-02 00:37:58 +01:00
|
|
|
bool activateWindow (bool);
|
|
|
|
bool activateWindow();
|
2017-03-12 00:29:56 +01:00
|
|
|
void unsetActiveWindow();
|
2016-11-02 00:37:58 +01:00
|
|
|
bool deactivateWindow();
|
|
|
|
virtual bool setResizeable (bool);
|
|
|
|
virtual bool setResizeable();
|
|
|
|
bool unsetResizeable();
|
|
|
|
bool setTransparentShadow (bool);
|
|
|
|
bool setTransparentShadow();
|
|
|
|
bool unsetTransparentShadow();
|
|
|
|
bool setShadow (bool);
|
|
|
|
bool setShadow();
|
|
|
|
bool unsetShadow();
|
|
|
|
bool setAlwaysOnTop (bool);
|
|
|
|
bool setAlwaysOnTop();
|
|
|
|
bool unsetAlwaysOnTop();
|
|
|
|
|
|
|
|
// Inquiries
|
|
|
|
bool isZoomed() const;
|
|
|
|
bool isWindowActive() const;
|
|
|
|
bool isWindowHidden() const;
|
|
|
|
bool isResizeable() const;
|
|
|
|
bool isAlwaysOnTop() const;
|
|
|
|
bool hasTransparentShadow() const;
|
|
|
|
bool hasShadow() const;
|
|
|
|
|
|
|
|
// Methods
|
2016-10-06 23:15:09 +02:00
|
|
|
virtual void drawBorder();
|
2015-09-22 22:12:31 +02:00
|
|
|
virtual void show();
|
|
|
|
virtual void hide();
|
2016-10-14 13:02:35 +02:00
|
|
|
virtual void setX (int, bool = true);
|
|
|
|
virtual void setY (int, bool = true);
|
|
|
|
virtual void setPos (int, int, bool = true);
|
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
|
|
|
void setGeometry (int, int, int, int, bool = true);
|
2016-10-14 13:02:35 +02:00
|
|
|
virtual void move (int, int);
|
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 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 ();
|
2016-06-19 20:32:03 +02:00
|
|
|
static void switchToPrevWindow();
|
2015-05-23 13:35:12 +02:00
|
|
|
static bool activatePrevWindow();
|
2016-10-09 02:06:06 +02:00
|
|
|
virtual void setShadowSize (int, int);
|
2016-11-02 00:37:58 +01:00
|
|
|
|
|
|
|
protected:
|
|
|
|
// Method
|
|
|
|
virtual void adjustSize();
|
|
|
|
|
|
|
|
// Event handlers
|
|
|
|
bool event (FEvent*);
|
|
|
|
virtual void onWindowActive (FEvent*);
|
|
|
|
virtual void onWindowInactive (FEvent*);
|
|
|
|
virtual void onWindowRaised (FEvent*);
|
|
|
|
virtual void onWindowLowered (FEvent*);
|
|
|
|
|
|
|
|
// Data Members
|
|
|
|
static FWindow* previous_window;
|
|
|
|
|
|
|
|
private:
|
|
|
|
// Disable copy constructor
|
|
|
|
FWindow (const FWindow&);
|
|
|
|
|
|
|
|
// Disable assignment operator (=)
|
|
|
|
FWindow& operator = (const FWindow&);
|
|
|
|
|
|
|
|
// Methods
|
|
|
|
static void deleteFromAlwaysOnTopList (FWidget*);
|
|
|
|
static void processAlwaysOnTop();
|
|
|
|
|
|
|
|
// Data Members
|
|
|
|
bool window_active;
|
|
|
|
bool zoomed;
|
|
|
|
FWidget* win_focus_widget;
|
|
|
|
FRect normalGeometry;
|
2015-05-23 13:35:12 +02:00
|
|
|
};
|
|
|
|
#pragma pack(pop)
|
|
|
|
|
|
|
|
|
|
|
|
// FWindow inline functions
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline const char* FWindow::getClassName() const
|
|
|
|
{ return "FWindow"; }
|
|
|
|
|
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-09 02:06:06 +02:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWindow::setResizeable()
|
|
|
|
{ return setResizeable(true); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWindow::unsetResizeable()
|
|
|
|
{ return setResizeable(false); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWindow::setTransparentShadow()
|
|
|
|
{ return setTransparentShadow(true); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWindow::unsetTransparentShadow()
|
|
|
|
{ return setTransparentShadow(false); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWindow::setShadow()
|
|
|
|
{ return setShadow(true); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWindow::unsetShadow()
|
|
|
|
{ return setShadow(false); }
|
|
|
|
|
2016-10-01 23:18:49 +02:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWindow::setAlwaysOnTop()
|
|
|
|
{ return setAlwaysOnTop(true); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWindow::unsetAlwaysOnTop()
|
|
|
|
{ return setAlwaysOnTop(false); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2016-11-02 00:37:58 +01:00
|
|
|
inline bool FWindow::isZoomed() const
|
|
|
|
{ return zoomed; }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWindow::isWindowActive() const
|
|
|
|
{ return window_active; }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWindow::isResizeable() const
|
|
|
|
{ return ((flags & fc::resizeable) != 0); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWindow::isAlwaysOnTop() const
|
2016-10-01 23:18:49 +02:00
|
|
|
{ return ((flags & fc::always_on_top) != 0); }
|
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWindow::hasTransparentShadow() const
|
|
|
|
{ return ((flags & fc::trans_shadow) != 0); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWindow::hasShadow() const
|
|
|
|
{ return ((flags & fc::shadow) != 0); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline FWindow* FWindow::getWindowWidgetAt (const FPoint& pos)
|
|
|
|
{ return getWindowWidgetAt (pos.getX(), pos.getY()); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWindow::raiseWindow()
|
|
|
|
{ return raiseWindow(this); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWindow::lowerWindow()
|
|
|
|
{ return lowerWindow(this); }
|
2015-05-23 13:35:12 +02:00
|
|
|
|
2017-04-09 20:08:53 +02:00
|
|
|
#endif // FWINDOW_H
|