| 1 |
/*************************************************************************** |
| 2 |
* Copyright (C) 2005-2019 by the FIFE team * |
| 3 |
* http://www.fifengine.net * |
| 4 |
* This file is part of FIFE. * |
| 5 |
* * |
| 6 |
* FIFE is free software; you can redistribute it and/or * |
| 7 |
* modify it under the terms of the GNU Lesser General Public * |
| 8 |
* License as published by the Free Software Foundation; either * |
| 9 |
* version 2.1 of the License, or (at your option) any later version. * |
| 10 |
* * |
| 11 |
* This library is distributed in the hope that it will be useful, * |
| 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * |
| 14 |
* Lesser General Public License for more details. * |
| 15 |
* * |
| 16 |
* You should have received a copy of the GNU Lesser General Public * |
| 17 |
* License along with this library; if not, write to the * |
| 18 |
* Free Software Foundation, Inc., * |
| 19 |
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * |
| 20 |
***************************************************************************/ |
| 21 |
|
| 22 |
#ifndef FIFE_GUI_WIDGETS_PANEL_H |
| 23 |
#define FIFE_GUI_WIDGETS_PANEL_H |
| 24 |
|
| 25 |
// Standard C++ library includes |
| 26 |
|
| 27 |
// 3rd party library includes |
| 28 |
#include <fifechan.hpp> |
| 29 |
|
| 30 |
// FIFE includes |
| 31 |
// These includes are split up in two parts, separated by one empty line |
| 32 |
// First block: files included from the FIFE root src directory |
| 33 |
// Second block: files included from the same folder |
| 34 |
#include "resizablewindow.h" |
| 35 |
|
| 36 |
namespace fcn { |
| 37 |
class DockArea; |
| 38 |
class Panel : public ResizableWindow { |
| 39 |
public: |
| 40 |
Panel(); |
| 41 |
Panel(bool dockable); |
| 42 |
|
| 43 |
virtual ~Panel(); |
| 44 |
|
| 45 |
/** Sets if the widget is dockable. |
| 46 |
* @param dockable True if the widget should be dockable, otherwise false. |
| 47 |
*/ |
| 48 |
void setDockable(bool dockable); |
| 49 |
|
| 50 |
/** Gets if the widget is dockable. |
| 51 |
* @return True if the widget should be dockable, otherwise false. |
| 52 |
*/ |
| 53 |
bool isDockable() const; |
| 54 |
|
| 55 |
/** Sets if the widget is docked. |
| 56 |
* @param docked True if the widget is docked, otherwise false. |
| 57 |
*/ |
| 58 |
void setDocked(bool docked); |
| 59 |
|
| 60 |
/** Gets if the widget is docked. |
| 61 |
* @return True if the widget is docked, otherwise false. |
| 62 |
*/ |
| 63 |
bool isDocked() const; |
| 64 |
|
| 65 |
virtual DockArea* findDockArea(); |
| 66 |
|
| 67 |
// Inherited from ResizableWindow |
| 68 |
|
| 69 |
virtual void resizeToContent(bool recursiv=true); |
| 70 |
virtual void expandContent(bool recursiv=true); |
| 71 |
|
| 72 |
|
| 73 |
// Inherited from ResizableWindow / MouseListener |
| 74 |
|
| 75 |
virtual void mouseEntered(MouseEvent& mouseEvent); |
| 76 |
|
| 77 |
virtual void mouseExited(MouseEvent& mouseEvent); |
| 78 |
|
| 79 |
virtual void mousePressed(MouseEvent& mouseEvent); |
| 80 |
|
| 81 |
virtual void mouseReleased(MouseEvent& mouseEvent); |
| 82 |
|
| 83 |
virtual void mouseMoved(MouseEvent& mouseEvent); |
| 84 |
|
| 85 |
virtual void mouseDragged(MouseEvent& mouseEvent); |
| 86 |
|
| 87 |
protected: |
| 88 |
DockArea* getDockedArea(); |
| 89 |
|
| 90 |
// is dockable |
| 91 |
bool m_dockable; |
| 92 |
// is docked |
| 93 |
bool m_docked; |
| 94 |
|
| 95 |
struct SavedState { |
| 96 |
Rectangle dimension; |
| 97 |
uint32_t innerBorder; |
| 98 |
bool resizable; |
| 99 |
bool movable; |
| 100 |
}; |
| 101 |
SavedState m_state; |
| 102 |
}; |
| 103 |
} |
| 104 |
|
| 105 |
#endif |