SavvyUI C++ UI Library
Loading...
Searching...
No Matches
GridView.h
Go to the documentation of this file.
1#pragma once
2
3#include "Component.h"
4
5#include "CardPanel.h"
6#include "GridPanel.h"
7#include "FluidPanel.h"
8#include "Grid.h"
9#include "Button.h"
10
12{
13public:
15
17 virtual ~GridContainer();
18};
19
32class GridView : public Component,
33 public ActionListener,
35{
36 CardPanel _cardPanel;
37 /*GridPanel*/FluidPanel _formView;
38 GridContainer _gridContainer;
39
40 Button _buttonAdd;
41 Button _buttonEdit;
42 Button _buttonDelete;
43 Button _buttonSave;
44 Button _buttonCancel;
45
46 vector<Component*> _formComponents;
47
48 GridViewListener* _listener;
49
50 long _editingRowIndex;
51 string _editingType;
52 BOOL _inlineEditingEnabled;
53
58 void createChildren(WinHandle hParent);
59
63 void loadForm();
64
68 void gridRowToForm();
69
74 BOOL formToGridRow();
75
76protected:
85 BOOL getCreateWindowOptions(wstring& title, UINT& widownStyles, wstring& wndClassName, BOOL& isCustomWndProc);
86
91
92public:
94 virtual ~GridView();
95
99 void clear();
100
105 void enableInlineEditing(BOOL bEnable);
106
115 void addColumn(const wstring& name, const wstring& title, BOOL isVisible, UINT width, long alignment = -1, BOOL isSortable = FALSE, BOOL isFilterable = FALSE,
116 BOOL isEditable = FALSE, const EditType& editStyle = EditType::TEXTFIELD, const vector<wstring>& editOptions = {});
117
122 long addRow();
123
130 void setCellValue(long rowIndex, long columnIndex, const wstring& value);
131
138 wstring getCellValue(long rowIndex, long columnIndex);
139
145
150
156
161 void onAction(const ActionEvent& ev);
162
168};
HWND WinHandle
Definition Common.h:16
EditType
Definition Common.h:139
@ TEXTFIELD
Definition Common.h:140
Definition EventListeners.h:38
Definition EventListeners.h:46
A clickable UI component representing a button with customizable text and type.
Definition Button.h:13
A UI component that manages multiple "cards", displaying only one at a time.
Definition CardPanel.h:27
Component()
Constructs a new Component instance.
A flexible panel layout component that arranges child components fluidly.
Definition FluidPanel.h:13
Definition Graphics.h:161
Definition GridView.h:12
virtual ~GridContainer()
Grid _gridView
Grid displaying rows and columns.
Definition GridView.h:14
A UI component representing a data grid with paging, selection, and editing capabilities.
Definition Grid.h:59
void onItemDoubleClicked(const RowDoubleClickEvent &ev)
Handles double-click events on grid rows.
void addColumn(const wstring &name, const wstring &title, BOOL isVisible, UINT width, long alignment=-1, BOOL isSortable=FALSE, BOOL isFilterable=FALSE, BOOL isEditable=FALSE, const EditType &editStyle=EditType::TEXTFIELD, const vector< wstring > &editOptions={})
Adds a column to the grid.
wstring getCellValue(long rowIndex, long columnIndex)
Gets the value of a specific cell in the grid.
void onWindowResized()
Called when the window is resized; adjusts layouts.
BOOL getCreateWindowOptions(wstring &title, UINT &widownStyles, wstring &wndClassName, BOOL &isCustomWndProc)
Provides window creation options specific to this component.
void onAction(const ActionEvent &ev)
Handles actions triggered by buttons or other components.
long addRow()
Adds a new empty row to the grid.
virtual ~GridView()
void enableInlineEditing(BOOL bEnable)
Enables or disables inline editing mode.
void setCellValue(long rowIndex, long columnIndex, const wstring &value)
Sets the value of a specific cell in the grid.
void clear()
Clears all data and resets the grid and form views.
void windowCreated()
Called after the native window is created; initializes child components.
void onPaint(Graphics *g)
Called to paint the GridView component.
void setListener(GridViewListener *listener)
Sets the listener for GridView CRUD events.
Definition EventListeners.h:67
Definition EventListeners.h:53
Definition EventListeners.h:60