uigridlayout.h

main 69 lines · 2.6 KB Raw
Alex Alex Commit Client Upload Part 2 19/10/2026 00:06
1/*
2 * Copyright (c) 2010-2017 OTClient <https://github.com/edubart/otclient>
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 * THE SOFTWARE.
21 */
22
23#ifndef UIGRIDLAYOUT_H
24#define UIGRIDLAYOUT_H
25
26#include "uilayout.h"
27
28// @bindclass
29class UIGridLayout : public UILayout
30{
31public:
32 UIGridLayout(UIWidgetPtr parentWidget);
33
34 void applyStyle(const OTMLNodePtr& styleNode);
35 void removeWidget(const UIWidgetPtr& widget);
36 void addWidget(const UIWidgetPtr& widget);
37
38 void setCellSize(const Size& size) { m_cellSize = size; update(); }
39 void setCellWidth(int width) { m_cellSize.setWidth(width); update(); }
40 void setCellHeight(int height) { m_cellSize.setHeight(height); update(); }
41 void setCellSpacing(int spacing) { m_cellSpacing = spacing; update(); }
42 void setNumColumns(int columns) { m_numColumns = columns; update(); }
43 void setNumLines(int lines) { m_numLines = lines; update(); }
44 void setAutoSpacing(bool enable) { m_autoSpacing = enable; update(); }
45 void setFitChildren(bool enable) { m_fitChildren = enable; update(); }
46 void setFlow(bool enable) { m_flow = enable; update(); }
47
48 Size getCellSize() { return m_cellSize; }
49 int getCellSpacing() { return m_cellSpacing; }
50 int getNumColumns() { return m_numColumns; }
51 int getNumLines() { return m_numLines; }
52
53 virtual bool isUIGridLayout() { return true; }
54
55protected:
56 bool internalUpdate();
57
58private:
59 Size m_cellSize;
60 int m_cellSpacing;
61 int m_numColumns;
62 int m_numLines;
63 stdext::boolean<false> m_autoSpacing;
64 stdext::boolean<false> m_fitChildren;
65 stdext::boolean<false> m_flow;
66};
67
68#endif
69
Top