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
23class GridView : public Component,
24 public ActionListener,
26{
27 CardPanel _cardPanel;
28 /*GridPanel*/FluidPanel _formView;
29 Grid _gridView;
30
31 Button _buttonAdd;
32 Button _buttonEdit;
33 Button _buttonDelete;
34 Button _buttonSave;
35 Button _buttonCancel;
36
37 vector<Component*> _formComponents;
38
39 GridViewListener* _listener;
40
41 long _editingRowIndex;
42 string _editingType;
43 BOOL _inlineEditingEnabled;
44
49 void createChildren(Component *parent);
50
54 void loadForm();
55
59 void gridRowToForm();
60
65 BOOL formToGridRow();
66
67protected:
76 BOOL getCreateWindowOptions(wstring& title, UINT& widownStyles, wstring& wndClassName, BOOL& isCustomWndProc);
77
82
83public:
84
85 BOOL getChildren(vector<Component*>& children);
86
87public:
89 virtual ~GridView();
90
94 void clear();
95
100 void enableInlineEditing(BOOL bEnable);
101
102 __int64 getRowCount();
103
112 void addColumn(const wstring& name, const wstring& title, BOOL isVisible, UINT width, long alignment = -1, BOOL isSortable = FALSE, BOOL isFilterable = FALSE,
113 BOOL isEditable = FALSE, const EditType& editStyle = EditType::TEXTFIELD, const vector<wstring>& editOptions = {});
114
119 long addRow();
120
127 void setCellValue(long rowIndex, long columnIndex, const wstring& value);
128 void setCellValue(long rowIndex, const wstring& columnName, const wstring& value);
129
136 wstring getCellValue(long rowIndex, long columnIndex);
137 wstring getCellValue(long rowIndex, const wstring& columnName);
138
144
149
155
160 void onAction(const ActionEvent& ev);
161
167};
EditType
Definition Common.h:147
@ TEXTFIELD
Definition Common.h:148
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:171
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.
__int64 getRowCount()
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 setCellValue(long rowIndex, const wstring &columnName, const wstring &value)
BOOL getChildren(vector< Component * > &children)
wstring getCellValue(long rowIndex, const wstring &columnName)
void setListener(GridViewListener *listener)
Sets the listener for GridView CRUD events.
Definition EventListeners.h:67
Definition EventListeners.h:53
Definition EventListeners.h:60