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#include "Scrollbar.h"
5
7{
8public:
9 GridPanelColumn(int width)
10 {
11 _width = width;
12 _calculatedWidth = width;
13 }
14
15 int _width;
17};
18
20{
21public:
22 GridPanelRow(int height)
23 {
24 _height = height;
25 _calculatedHeight = height;
26 }
27
28 int _height;
30};
31
40{
41 Scrollbar _scrollBar;
42
43 vector<GridPanelColumn> _columns;
44 vector<GridPanelRow> _rows;
45
46 long _fillRowsMinHeight;
47
48 long _margin;
49 long _vGap;
50 long _allRowsHeight;
51 long _rowHeight;
52 long _totalRowCount;
53
54 long _maxVisibleRows;
55 long _firstVisibleRow;
56
57 long _borderWidthLeft, _borderWidthTop, _borderWidthRight, _borderWidthBottom;
58
62 void Layout();
63
64protected:
69 wstring getClassName();
70
75
79 virtual void constructPanel() {};
80
81public:
83 virtual ~GridPanel();
84
88 void clear();
89
95 void setMargin(int margin);
96
97 void setBorder(long borderWidthLeft, long borderWidthTop, long borderWidthRight, long borderWidthBottom);
98
108 void setLayout(const vector<int>& columns, const vector<int>& rows);
109
113 void setFillRowsMinHeight(int minHeight);
114
124 void addComponent(Component* component, int column, int row, int columnCount = 1, int rowCount = 1);
125
130
137
138 void onMousePressed(WinHandle hWnd, int x, int y, int clickCount, BOOL shiftPressed, BOOL ctrlPressed);
139 void onMouseReleased(WinHandle hWnd, int x, int y, BOOL shiftPressed, BOOL ctrlPressed);
140 void onMouseMoved(WinHandle hWnd, int x, int y, BOOL shiftPressed, BOOL ctrlPressed);
141 BOOL onMouseWheel(WinHandle hWnd, int x, int y, int delta);
142
143public:
144
145 void scrollBarActivity(__int64 firstVisibleItem);
147};
HWND WinHandle
Definition Common.h:16
Component()
Constructs a new Component instance.
Definition Graphics.h:171
int _calculatedWidth
Definition GridPanel.h:16
GridPanelColumn(int width)
Definition GridPanel.h:9
int _width
Definition GridPanel.h:15
void onMouseReleased(WinHandle hWnd, int x, int y, BOOL shiftPressed, BOOL ctrlPressed)
Called when the mouse button is released within the component.
void scrollBarActivity(__int64 firstVisibleItem)
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 onMousePressed(WinHandle hWnd, int x, int y, int clickCount, BOOL shiftPressed, BOOL ctrlPressed)
Called when the mouse is pressed within the component.
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.
void onMouseMoved(WinHandle hWnd, int x, int y, BOOL shiftPressed, BOOL ctrlPressed)
Called when the mouse is moved within the component.
wstring getClassName()
Returns the class name of the component.
void scrollBarRepaint()
void windowCreated()
Called after the native window is created.
void clear()
Clears all rows, columns, and child components from the panel.
virtual void constructPanel()
After this panel is created, constructPanel will be called on the descendent of this class.
Definition GridPanel.h:79
BOOL onMouseWheel(WinHandle hWnd, int x, int y, int delta)
Called when the mouse wheel is used over the component.
void setBorder(long borderWidthLeft, long borderWidthTop, long borderWidthRight, long borderWidthBottom)
int _calculatedHeight
Definition GridPanel.h:29
GridPanelRow(int height)
Definition GridPanel.h:22
int _height
Definition GridPanel.h:28
PanelBase()
Constructs a PanelBase instance.
Definition Scrollbar.h:14
Definition Scrollbar.h:6