GlistEngine
Loading...
Searching...
No Matches
gGUINotebook Class Reference

#include <gGUINotebook.h>

Inheritance diagram for gGUINotebook:
Collaboration diagram for gGUINotebook:

Public Types

enum class  TabPosition { TOP , BOTTOM , LEFT , RIGHT }
Public Types inherited from gBaseGUIObject
enum  { TEXTALIGNMENT_LEFT , TEXTALIGNMENT_MIDDLE , TEXTALIGNMENT_RIGHT }

Public Member Functions

 gGUINotebook ()
virtual ~gGUINotebook ()
void set (gBaseApp *root, gBaseGUIObject *topParentGUIObject, gBaseGUIObject *parentGUIObject, int parentSlotLineNo, int parentSlotColumnNo, int x, int y, int w, int h) override
void draw () override
void setFont (gFont *font)
void setTabPosition (TabPosition position)
 Sets the position of the tab bar.
TabPosition getTabPosition () const
 Get the current tab position.
void setTabVisibility (bool visible)
void setActiveTab (int index)
 Sets the active tab of the notebook.
int getActiveTab () const
 Gets the index of the active tab.
void setTabClosable (int index, bool isClosable)
 Sets whether a tab is closable or not.
bool isTabClosable (int index)
 Returns if a tab is closable or not.
void setTabAutoClose (int index, bool autoClose)
 Sets whether a tab is automatically closed when switched out of it.
bool isTabAutoClose (int index)
 Returns if a tab is set to automatically close when switched out of it.
int addTab (gGUISizer *sizer, std::string title, bool closable=true)
 Add a tab to a GUI sizer.
void closeTab (int index)
 Closes the tab at the specified index.
gGUISizer * getTabSizer (int index)
 Gets the tab sizer of the tab at the given index.
gGUISizer * getTabSizerByTitle (const std::string &title)
 Gets the tab sizer by its title.
Public Member Functions inherited from gGUIContainer
 gGUIContainer ()
virtual ~gGUIContainer () override
void set (int x, int y, int w, int h)
void setSizer (gGUISizer *guiSizer)
gGUISizer * getSizer ()
void setContentSize (int contentWidth, int contentHeight)
void enableContentScrolling (bool enabled)
bool isContentScrollingEnabled () const
int getCursor (int x, int y) override
void keyPressed (int key) override
void keyReleased (int key) override
void charPressed (unsigned int codepoint) override
void mouseDragged (int x, int y, int button) override
void mouseReleased (int x, int y, int button) override
void windowResized (int w, int h) override
void update () override
void drawContent () override
void setCursorOn (bool isOn) override
void unfocus () override
Public Member Functions inherited from gGUIScrollable
 gGUIScrollable ()
virtual ~gGUIScrollable () override
void enableScrollbars (bool isVerticalEnabled, bool isHorizontalEnabled)
void updateScrollbar ()
void draw () override
virtual void drawScrollbars ()
void windowResized (int w, int h) override
void mouseMoved (int x, int y) override
void mousePressed (int x, int y, int button) override
void mouseDragged (int x, int y, int button) override
void mouseReleased (int x, int y, int button) override
void mouseScrolled (int x, int y) override
int getVerticalScroll ()
gFbo * getFbo ()
int getTitleTop ()
void setToolbarSpace (int toolbarW, int toolbarH)
Public Member Functions inherited from gGUIControl
 gGUIControl ()
virtual ~gGUIControl () override
int getCursor (int x, int y) override
void update () override
virtual int calculateContentHeight ()
virtual bool countAsSpace ()
void setCountAsSpace (bool isSpace)
void setFont (gFont *font)
gFont * getFont ()
Public Member Functions inherited from gBaseGUIObject
 gBaseGUIObject ()
virtual ~gBaseGUIObject ()
int getId ()
int getType ()
void setEnabled (bool isEnabled)
bool isEnabled ()
void setVisible (bool isVisible)
bool isVisible ()
void setTitleOn (bool isTitleOn)
bool isTitleOn ()
virtual void setTopParent (gBaseGUIObject *parentGUIObject)
gBaseGUIObject * getTopParent ()
virtual void setParent (gBaseGUIObject *parentGUIObject)
gBaseGUIObject * getParent ()
void setParentSlotNo (int parentSlotLineNo, int parentSlotColumnNo)
int getParentSlotLineNo ()
int getParentSlotColumnNo ()
void setTitle (std::string title)
std::string getTitle ()
virtual void mouseEntered ()
virtual void mouseExited ()
virtual void onGUIEvent (int guiObjectId, int eventType, int sourceEventType, std::string value1="", std::string value2="")
void setRootApp (gBaseApp *root)
Public Member Functions inherited from gRenderObject
 gRenderObject ()
int getScreenWidth ()
int getScreenHeight ()
void pushMatrix ()
void popMatrix ()
Public Member Functions inherited from gObject
 gObject ()
void logi (std::string message)
void logd (std::string message)
void logw (std::string message)
void loge (std::string message)
void logi (std::string tag, std::string message)
void logd (std::string tag, std::string message)
void logw (std::string tag, std::string message)
void loge (std::string tag, std::string message)

Additional Inherited Members

Static Public Member Functions inherited from gBaseGUIObject
static void setBackgroundColor (gColor *backgroundColor)
static gColor * getBackgroundColor ()
static void setMiddlegroundColor (gColor *middlegroundColor)
static gColor * getMiddlegroundColor ()
static void setForegroundColor (gColor *foregroundColor)
static gColor * getForegroundColor ()
static void setTextBackgroundColor (gColor *textBackgroundColor)
static gColor * getTextBackgroundColor ()
static void setNavigationBackgroundColor (gColor *navigationBackgroundColor)
static gColor * getNavigationBackgroundColor ()
static void setFont (gFont *font)
static gFont * getFont ()
static void setFontColor (gColor *fontColor)
static gColor * getFontColor ()
static void setNavigationFontColor (gColor *navigationFontColor)
static gColor * getNavigationFontColor ()
static void setButtonColor (gColor *color)
static gColor * getButtonColor ()
static void setPressedButtonColor (gColor *color)
static gColor * getPressedButtonColor ()
static void setDisabledButtonColor (gColor *color)
static gColor * getDisabledButtonColor ()
static void setButtonFontColor (gColor *color)
static gColor * getButtonFontColor ()
static void setPressedButtonFontColor (gColor *color)
static gColor * getPressedButtonFontColor ()
static void setDisabledButtonFontColor (gColor *color)
static gColor * getDisabledButtonFontColor ()
Static Public Member Functions inherited from gRenderObject
static void setScreenSize (int screenWidth, int screenHeight)
static void setUnitScreenSize (int unitWidth, int unitHeight)
static void setScreenScaling (int screenScaling)
static void enableShadowMapping ()
static void disableShadowMapping ()
static bool isShadowMappingEnabled ()
static void enableExtraShaders (bool isEnabled=true)
static void disableExtraShaders ()
static bool isExtraShadersEnabled ()
static gRenderer * getRenderer ()
static void destroyRenderer ()
static void createRenderer (int renderEngine=G_RENDERER_GL)
Static Public Member Functions inherited from gObject
static std::string gGetAppDir ()
static std::string gGetAssetsDir ()
static void gSetAssetsDir (std::string assetsDir)
static std::string gGetFilesDir ()
static std::string gGetImagesDir ()
static std::string gGetFontsDir ()
static std::string gGetModelsDir ()
static std::string gGetTexturesDir ()
static std::string gGetShadersDir ()
static std::string gGetSoundsDir ()
static std::string gGetDatabasesDir ()
static std::string gGetVideosDir ()
static void setCurrentResolution (int scalingNo, int currentResolutionNo)
Public Attributes inherited from gBaseGUIObject
int id
int type
int left
int top
int right
int bottom
int width
int height
int titlex
int titley
int titleheight
bool isfocused
bool iscursoron
bool issizer
bool iscontainer
bool isresizable
Static Public Attributes inherited from gBaseGUIObject
static const int GUIEVENT_FOCUSED = -1
static const int GUIEVENT_UNFOCUSED = -2
static const int CURSOR_ARROW = 0
static const int CURSOR_IBEAM = 1
static const int CURSOR_CROSSHAIR = 2
static const int CURSOR_HAND = 3
static const int CURSOR_HRESIZE = 4
static const int CURSOR_VRESIZE = 5
static int focusid
static int previousfocusid
Static Public Attributes inherited from gObject
static const int LOGLEVEL_SILENT
static const int LOGLEVEL_DEBUG
static const int LOGLEVEL_INFO
static const int LOGLEVEL_WARNING
static const int LOGLEVEL_ERROR
Protected Member Functions inherited from gGUIScrollable
bool isVerticalScrollEnabled () const
bool isHorizontalScrollEnabled () const
bool hasVerticalOverflow () const
bool hasHorizontalOverflow () const
bool isPointInsideVerticalScrollbar (int x, int y, bool checkFullSize=false)
bool isPointInsideHorizontalScrollbar (int x, int y, bool checkFullSize=false)
void setDimensions (int width, int height)
Protected Attributes inherited from gGUIContainer
gGUISizer * guisizer
gGUISizer temporaryemptysizer
int topbarh
int contentwidth
int contentheight
bool contentscrollingenabled
bool iscontentdragging
bool iscontentdragmoved
int contentdragstartx
int contentdragstarty
int contentdragscrollx
int contentdragscrolly
Protected Attributes inherited from gGUIScrollable
const int barsize = 12
int scrollamount = 8
int boxw = 0
int boxh = 0
int totalw = 0
int totalh = 0
int verticalscroll = 0
int horizontalscroll = 0
int verticalscrollbarpos = 0
int horizontalscrollbarpos = 0
int scrollbarverticalsize = 0
int scrollbarhorizontalsize = 0
bool isdraggingverticalscroll = false
int verticalscrolldragstart = 0
float verticalscrollclickedtime = 0.0f
bool isdragginghorizontalscroll = false
int horizontalscrolldragstart = 0
float horizontalscrollclickedtime = 0.0f
Protected Attributes inherited from gGUIControl
bool countasspace
int oldwidth
int oldheight
gFont * localfont
Protected Attributes inherited from gBaseGUIObject
std::string title
gBaseApp * root
gBaseGUIObject * topparent
gBaseGUIObject * parent
bool isenabled
bool isvisible
bool istitleon
int parentslotlineno
int parentslotcolumnno
Static Protected Attributes inherited from gBaseGUIObject
static gColor * backgroundcolor
static gColor * middlegroundcolor
static gColor * foregroundcolor
static gColor * textbackgroundcolor
static gColor * navigationbackgroundcolor
static gFont * font
static gColor * fontcolor
static gColor * navigationfontcolor
static gColor * buttoncolor
static gColor * pressedbuttoncolor
static gColor * disabledbuttoncolor
static gColor * buttonfontcolor
static gColor * pressedbuttonfontcolor
static gColor * disabledbuttonfontcolor
static gGUIActionManager actionmanager
static gGUIResources res
Static Protected Attributes inherited from gRenderObject
static bool isshadowmappingenabled
static bool isextrashadersenabled
Static Protected Attributes inherited from gObject
static int renderpassnum
static int renderpassno
static int releasescaling
static int releaseresolution

Member Enumeration Documentation

◆ TabPosition

enum class gGUINotebook::TabPosition
strong
Enumerator
TOP 
BOTTOM 
LEFT 
RIGHT 

Constructor & Destructor Documentation

◆ gGUINotebook()

gGUINotebook::gGUINotebook ( )

◆ ~gGUINotebook()

virtual gGUINotebook::~gGUINotebook ( )
virtual

Member Function Documentation

◆ addTab()

int gGUINotebook::addTab ( gGUISizer * sizer,
std::string title,
bool closable = true )

Add a tab to a GUI sizer.

Parameters
sizerThe GUI sizer to which the tab is added.
titleThe title of the tab.
closableWhether the tab should be closable. Default is true.
Returns
Index that the tab is added, do not store this return value as it can change when a tab before this has closed!

◆ closeTab()

void gGUINotebook::closeTab ( int index)

Closes the tab at the specified index.

If the index is out of range, or if there are no tabs in the notebook, the function does nothing. If the active tab is closed, previous tab will be active (if available).

Parameters
indexThe index of the tab to be closed.

◆ draw()

void gGUINotebook::draw ( )
overridevirtual

Reimplemented from gGUIContainer.

◆ getActiveTab()

int gGUINotebook::getActiveTab ( ) const

Gets the index of the active tab.

This function returns the index of the active tab in the notebook.

Returns
The index of the active tab. -1 if none is selected

◆ getTabPosition()

TabPosition gGUINotebook::getTabPosition ( ) const

Get the current tab position.

Tab position determines where the tab bar is displayed relative to the tab contents.

Returns
The current tab position as TabPosition enum.

◆ getTabSizer()

gGUISizer * gGUINotebook::getTabSizer ( int index)

Gets the tab sizer of the tab at the given index.

Parameters
indexThe index of the tab sizer to retrieve.
Returns
The tab sizer object. It will return nullptr if index is out of bounds.
Warning
It is the responsibility of the caller to handle null pointers returned by this function!

◆ getTabSizerByTitle()

gGUISizer * gGUINotebook::getTabSizerByTitle ( const std::string & title)

Gets the tab sizer by its title.

Parameters
titleTitle of the tab sizer to get.
Returns
gGUISizer object of the matching tab title, nullptr if none matches.
Note
This function assumes that all tab sizes have unique titles. If not, first matching will be returned.
Warning
It is the responsibility of the caller to handle null pointers returned by this function!

◆ isTabAutoClose()

bool gGUINotebook::isTabAutoClose ( int index)

Returns if a tab is set to automatically close when switched out of it.

Parameters
indexThe index of the tab.
Returns
True if the tab is set to automatically close, false otherwise.

◆ isTabClosable()

bool gGUINotebook::isTabClosable ( int index)

Returns if a tab is closable or not.

Parameters
indexThe index of the tab to get.
Returns
True if the tab is closable, false otherwise.
Note
If the index is out of range or if there are no tabs in the notebook, false will be returned.

◆ set()

void gGUINotebook::set ( gBaseApp * root,
gBaseGUIObject * topParentGUIObject,
gBaseGUIObject * parentGUIObject,
int parentSlotLineNo,
int parentSlotColumnNo,
int x,
int y,
int w,
int h )
overridevirtual

Reimplemented from gGUIContainer.

◆ setActiveTab()

void gGUINotebook::setActiveTab ( int index)

Sets the active tab of the notebook.

This function sets the active tab of the notebook to the tab at the given index. If the index is out of range, the active tab is set to -1 and no tab will be selected.

Parameters
indexThe index of the tab to set as active.

◆ setFont()

void gGUINotebook::setFont ( gFont * font)

◆ setTabAutoClose()

void gGUINotebook::setTabAutoClose ( int index,
bool autoClose )

Sets whether a tab is automatically closed when switched out of it.

Parameters
indexThe index of the tab.
autoCloseTrue if the tab should be automatically closed, false otherwise.

◆ setTabClosable()

void gGUINotebook::setTabClosable ( int index,
bool isClosable )

Sets whether a tab is closable or not.

Parameters
indexThe index of the tab.
isClosableTrue if the tab should be closable, false otherwise.

◆ setTabPosition()

void gGUINotebook::setTabPosition ( TabPosition position)

Sets the position of the tab bar.

Parameters
positionThe desired tab position. ex: gGUINotebook::TabPosition::LEFT
See also
getTabPosition

◆ setTabVisibility()

void gGUINotebook::setTabVisibility ( bool visible)

Sets the visibility of the tab header.

Parameters
visibleWhether the tab header should be visible or not.

The documentation for this class was generated from the following file: