SavvyUI C++ UI Library
Loading...
Searching...
No Matches
GridPanel.h
Go to the documentation of this file.
1#pragma once
2
3#include "PanelBase.h"
4
6{
7public:
8 GridPanelColumn(int width)
9 {
10 _width = width;
11 _calculatedWidth = width;
12 }
13
14 int _width;
16};
17
19{
20public:
21 GridPanelRow(int height)
22 {
23 _height = height;
24 _calculatedHeight = height;
25 }
26
27 int _height;
29};
30
38class GridPanel : public PanelBase
39{
40 vector<GridPanelColumn> _columns;
41 vector<GridPanelRow> _rows;
42
43 long _fillRowsMinHeight;
44
45 long _margin;
46 long _vGap;
47 long _allRowsHeight;
48 long _rowHeight;
49 long _viewHeight;
50
51 long _maxVisibleRows;
52 long _firstVisibleRow;
53
54 BOOL _hasBorderLeft, _hasBorderTop, _hasBorderRight, _hasBorderBottom;
55
59 void Layout();
60
61protected:
66 wstring getClassName();
67
72
73public:
75 virtual ~GridPanel();
76
80 void clear();
81
87 void setMargin(int margin);
88
89 void setHasBorder(BOOL hasBorderLeft, BOOL hasBorderTop, BOOL hasBorderRight, BOOL hasBorderBottom);
90
100 void setLayout(const vector<int>& columns, const vector<int>& rows);
101
105 void setFillRowsMinHeight(int minHeight);
106
116 void addComponent(Component* component, int column, int row, int columnCount = 1, int rowCount = 1);
117
122
129
139 BOOL onMouseWheel(WinHandle hWnd, int x, int y, int delta);
140
149 BOOL getScrollingInfo(__int64& scrollMin, __int64& scrollMax, __int64& pageSize);
150
156 void setScrollbarTopOffset(__int64 firstVisibleRow);
157};
HWND WinHandle
Definition Common.h:16
Component()
Constructs a new Component instance.
Definition Graphics.h:161
int _calculatedWidth
Definition GridPanel.h:15
GridPanelColumn(int width)
Definition GridPanel.h:8
int _width
Definition GridPanel.h:14
void setHasBorder(BOOL hasBorderLeft, BOOL hasBorderTop, BOOL hasBorderRight, BOOL hasBorderBottom)
BOOL getScrollingInfo(__int64 &scrollMin, __int64 &scrollMax, __int64 &pageSize)
Provides scrolling information for scrollbar support.
void addComponent(Component *component, int column, int row, int columnCount=1, int rowCount=1)
Adds a child component at a specific grid location.
void setFillRowsMinHeight(int minHeight)
Sets the minimum allowed height for fill rows.
void setLayout(const vector< int > &columns, const vector< int > &rows)
Sets the layout structure by defining columns and rows sizes.
void onWindowResized()
Called when the window is resized; recalculates layout.
virtual ~GridPanel()
void onPaint(Graphics *g)
Paints the panel and its child components.
void setMargin(int margin)
Sets the left, top, right, and bottom margins.
wstring getClassName()
Returns the class name of the component.
void windowCreated()
Called after the native window is created.
void setScrollbarTopOffset(__int64 firstVisibleRow)
Updates the scrollbar position based on the top visible row.
void clear()
Clears all rows, columns, and child components from the panel.
BOOL onMouseWheel(WinHandle hWnd, int x, int y, int delta)
Handles mouse wheel scrolling events.
int _calculatedHeight
Definition GridPanel.h:28
GridPanelRow(int height)
Definition GridPanel.h:21
int _height
Definition GridPanel.h:27
PanelBase()
Constructs a PanelBase instance.