1
// Copyright 2006-2011 Asger Feldthaus
2
// This file is part of the "Irrlicht Engine".
3
// For conditions of distribution and use, see copyright notice in irrlicht.h
5
#ifndef _C_GUI_PANEL_H_
6
#define _C_GUI_PANEL_H_
8
#include "IGUIElement.h"
9
#include "EGUIEditTypes.h"
19
enum E_SCROLL_BAR_MODE
21
//! The scrollbar will only show up when needed.
24
//! The scrollbar will never be visible.
25
ESBM_ALWAYS_INVISIBLE,
27
//! The scrollbar will always the visible.
30
//! just a count of how many are in this enum
34
const c8* const GUIScrollBarModeNames[] =
42
class CGUIPanel : public IGUIElement
45
CGUIPanel( IGUIEnvironment* environment, IGUIElement* parent, s32 id=-1,
46
const core::rect<s32>& rectangle = core::rect<s32>(0,0,100,100),
48
E_SCROLL_BAR_MODE vMode=ESBM_AUTOMATIC,
49
E_SCROLL_BAR_MODE hMode=ESBM_ALWAYS_INVISIBLE );
53
//! draws the panel and its children
56
//! returns true if it has a border, false if not
57
bool hasBorder() const;
59
//! sets whether the element draws a border
60
void setBorder(bool enabled);
62
//! returns a pointer to the vertical scrollbar
63
IGUIScrollBar* getVScrollBar() const;
65
//! returns a pointer to the horizontal scrollbar
66
IGUIScrollBar* getHScrollBar() const;
68
//! returns the vertical scrollbar visibility rule
69
E_SCROLL_BAR_MODE getVScrollBarMode() const;
71
//! sets the vertical scrollbar visibility rule
72
void setVScrollBarMode(E_SCROLL_BAR_MODE mode);
74
//! returns the horizontal scrollbar visibility rule
75
E_SCROLL_BAR_MODE getHScrollBarMode() const;
77
//! sets the horizontal scrollbar visibility rule
78
void setHScrollBarMode(E_SCROLL_BAR_MODE mode);
80
//! returns the visible area inside the panel, excluding scrollbar and border
81
core::rect<s32> getClientArea() const;
83
virtual bool OnEvent(const SEvent &event);
85
//! adds a child to the panel
86
virtual void addChild(IGUIElement* child);
88
//! removes a child from the panel
89
virtual void removeChild(IGUIElement* child);
91
//! updates the absolute position
92
virtual void updateAbsolutePosition();
94
//! returns children of the inner pane
95
virtual const core::list<IGUIElement*>& getChildren();
97
//! Returns the type name of the gui element.
98
virtual const c8* getTypeName() const
100
return GUIEditElementTypeNames[EGUIEDIT_GUIPANEL];
103
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0);
104
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0);
107
void moveInnerPane();
108
void resizeInnerPane();
109
void calculateClientArea();
113
IGUIScrollBar* VScrollBar;
114
IGUIScrollBar* HScrollBar;
118
E_SCROLL_BAR_MODE VScrollBarMode;
119
E_SCROLL_BAR_MODE HScrollBarMode;