2
* Copyright 2010 Inalogic Inc.
4
* This program is free software: you can redistribute it and/or modify it
5
* under the terms of the GNU Lesser General Public License version 3, as
6
* published by the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful, but
9
* WITHOUT ANY WARRANTY; without even the implied warranties of
10
* MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
11
* PURPOSE. See the applicable version of the GNU Lesser General Public
12
* License for more details.
14
* You should have received a copy of both the GNU Lesser General Public
15
* License version 3 along with this program. If not, see
16
* <http://www.gnu.org/licenses/>
18
* Authored by: Jay Taoko <jay.taoko_AT_gmail_DOT_com>
23
#ifndef FLOATINGWINDOW_H
24
#define FLOATINGWINDOW_H
26
#include "ScrollView.h"
27
#include "BaseWindow.h"
29
#if defined(NUX_OS_WINDOWS)
30
#include "NuxGraphics/Events.h"
31
#elif defined(NUX_OS_LINUX)
32
#include "NuxGraphics/Events.h"
35
#include "InputArea.h"
36
#include "MouseHandler.h"
40
#include "Validator.h"
41
#include "StaticTextBox.h"
49
class FloatingWindow: public BaseWindow
51
NUX_DECLARE_OBJECT_TYPE (FloatingWindow, BaseWindow);
53
FloatingWindow (const TCHAR *WindowName = TEXT (""), NUX_FILE_LINE_PROTO);
57
virtual long ProcessEvent (IEvent &ievent, long TraverseInfo, long ProcessEventInfo);
58
virtual void Draw (GraphicsEngine &GfxContext, bool force_draw);
59
virtual void DrawContent (GraphicsEngine &GfxContext, bool force_draw);
60
virtual void PostDraw (GraphicsEngine &GfxContext, bool force_draw);
62
void SetVisibleSizeGrip (bool b)
64
if (b && (m_bSizeMatchLayout) )
65
m_bIsVisibleSizeGrip = false;
67
m_bIsVisibleSizeGrip = b;
70
bool IsVisibleSizeGrip()
72
return m_bIsVisibleSizeGrip;
76
void EnableTitleBar (bool b);
77
bool HasTitleBar() const;
78
void OnSizeGrigMouseDown (int x, int y, unsigned long button_flags, unsigned long key_flags);
79
void OnSizeGrigMouseDrag (int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags);
80
void RecvCloseButtonClick (int x, int y, unsigned long button_flags, unsigned long key_flags);
82
void RecvTitleBarMouseDown (int x, int y, unsigned long button_flags, unsigned long key_flags);
83
void RecvTitleBarMouseDrag (int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags);
85
void SetWindowTitle (const char *title);
86
const TCHAR *GetWindowTitle();
88
//! Return true if this object can break the layout.
90
Return true if this object can break the layout, meaning, the layout can be done on the composition layout only without
91
recomputing the whole window layout.
94
virtual bool CanBreakLayout()
96
if (IsSizeMatchContent() )
102
virtual void PreLayoutManagement();
103
virtual long PostLayoutManagement (long LayoutResult);
104
virtual void PositionChildLayout (float offsetX, float offsetY);
105
//! Layout the window elements.
107
Layout elements such as button on the title bar, and the resize widget according to the current
108
geometry of the window. Also initiate the computation of the child layout if there is one.
110
virtual void LayoutWindowElements();
112
int m_SizeGripDragPositionX;
113
int m_SizeGripDragPositionY;
116
CoreArea *m_SizeGrip;
117
CoreArea *m_TitleBar;
118
Point m_TitleBarMouseDown;
120
CoreArea *m_MinimizeButton;
121
CoreArea *m_CloseButton;
122
StaticTextBox *m_WindowTitleBar;
126
bool m_bIsVisibleSizeGrip;
128
//! If true then the FloatingWindow is resized to match the size of the layout.
129
bool m_bSizeMatchLayout;
132
BaseTexture* CloseIcon;
133
BaseTexture* MinimizeIcon;
135
std::list<View *> m_InterfaceObject;
136
HLayout *m_TitleBarLayout;
138
TCHAR *m_WindowTitle;
140
friend class PopUpWindow;
141
friend class ComboBox_Logic_WindowView;
142
friend class WindowCompositor;
146
#endif // FLOATINGWINDOW_H