8#ifndef UI_GGUINOTEBOOK_H_
9#define UI_GGUINOTEBOOK_H_
161 int ox = 0, oy = 0, x, y, w, h;
163 bool enabled =
false;
165 bool isPointInside(
int tx,
int ty) {
169 return tx >= ox + x && tx <= ox + x + w && ty >= oy + y && ty <= oy + y + h;
195 box.x =
boxw - box.w;
200 box.y =
boxh - box.h;
208 void render()
const {
229 Tab(
gGUISizer* sizer, std::string title,
bool closable,
int titlewidth,
int titleheight)
230 : sizer(sizer), title(
std::move(title)), closable(closable), autoclose(false),
231 titlewidth(titlewidth), titleheight(titleheight), tabwidth(0) {
238 void drawHeaderBackground();
240 void mousePressed(
int x,
int y,
int button)
override;
241 void mouseMoved(
int x,
int y)
override;
242 void mouseScrolled(
int x,
int y)
override;
246 Tab* getTab(
int index);
247 int findIndexByTitle(
const std::string&
title);
250 std::vector<Tab> tabs;
257 int scrollbuttonwidth;
264 Box scrollpreviousbutton;
265 Box scrollnextbutton;
Definition gBaseGUIObject.h:18
gBaseApp * root
Definition gBaseGUIObject.h:147
std::string title
Definition gBaseGUIObject.h:145
Definition gGUIContainer.h:15
Definition gGUINotebook.h:18
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.
TabPosition
Definition gGUINotebook.h:20
void setTabPosition(TabPosition position)
Sets the position of the tab bar.
void setTabVisibility(bool visible)
Definition gGUISizer.h:14
void gDrawRectangle(float x, float y, float w, float h, bool isFilled=false)