8#ifndef UI_GGUINOTEBOOK_H_
9#define UI_GGUINOTEBOOK_H_
162 int ox = 0, oy = 0, x, y, w, h;
164 bool enabled =
false;
166 bool isPointInside(
int tx,
int ty) {
170 return tx >= ox + x && tx <= ox + x + w && ty >= oy + y && ty <= oy + y + h;
196 box.x =
boxw - box.w;
201 box.y =
boxh - box.h;
209 void render()
const {
230 Tab(gGUISizer* sizer, std::string title,
bool closable,
int titlewidth,
int titleheight)
231 : sizer(sizer), title(std::move(title)), closable(closable), autoclose(false),
232 titlewidth(titlewidth), titleheight(titleheight), tabwidth(0) {
239 void drawHeaderBackground();
241 void mousePressed(
int x,
int y,
int button)
override;
242 void mouseMoved(
int x,
int y)
override;
243 void mouseScrolled(
int x,
int y)
override;
247 Tab* getTab(
int index);
248 int findIndexByTitle(
const std::string&
title);
251 std::vector<Tab> tabs;
258 int scrollbuttonwidth;
265 Box scrollpreviousbutton;
266 Box scrollnextbutton;
271 gGUISizer notebooksizer;
Definition gBaseGUIObject.h:18
gBaseApp * root
Definition gBaseGUIObject.h:151
static gFont * font
Definition gBaseGUIObject.h:137
std::string title
Definition gBaseGUIObject.h:149
gGUISizer * getTabSizer(int index)
Gets the tab sizer of the tab at the given index.
void set(gBaseApp *root, gBaseGUIObject *topParentGUIObject, gBaseGUIObject *parentGUIObject, int parentSlotLineNo, int parentSlotColumnNo, int x, int y, int w, int h) override
int addTab(gGUISizer *sizer, std::string title, bool closable=true)
Add a tab to a GUI sizer.
void setActiveTab(int index)
Sets the active tab of the notebook.
gGUISizer * getTabSizerByTitle(const std::string &title)
Gets the tab sizer by its title.
TabPosition getTabPosition() const
Get the current tab position.
int getActiveTab() const
Gets the index of the active tab.
void closeTab(int index)
Closes the tab at the specified index.
bool isTabAutoClose(int index)
Returns if a tab is set to automatically close when switched out of it.
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.
void setTabClosable(int index, bool isClosable)
Sets whether a tab is closable or not.
void setFont(gFont *font)
TabPosition
Definition gGUINotebook.h:20
@ BOTTOM
Definition gGUINotebook.h:22
@ RIGHT
Definition gGUINotebook.h:24
@ TOP
Definition gGUINotebook.h:21
@ LEFT
Definition gGUINotebook.h:23
void setTabPosition(TabPosition position)
Sets the position of the tab bar.
void setTabVisibility(bool visible)
Definition gGUISizer.h:15
void gDrawRectangle(float x, float y, float w, float h, bool isFilled=false, float rotateAngle=0.0f, float pivotx=0.5f, float pivoty=0.5f)