-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLGridTextEditor.h
92 lines (85 loc) · 2.32 KB
/
LGridTextEditor.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/*
* File: LGridTextEditor.h
* Author: Saleem Edah-Tally - [email protected]
* License : LGPL version 2.1
* Copyright Saleem Edah-Tally, M. D. - © 2014
*
* Created on 9 juin 2014, 16:08
*/
#ifndef LGRIDTEXTEDITOR_H
#define LGRIDTEXTEDITOR_H
#include "LGridColEditor.h"
#include "LBoundTextCtrl.h"
/**
* Edits table data using an LBoundTextCtrl.
*/
class LGridTextEditor : public wxGridCellAutoWrapStringEditor, public LGridColEditor
{
public:
/**
*
* @param newColName database column name
* @param newMultiline if true, use wxTE_MULTILINE
*/
LGridTextEditor(const wxString& newColName, bool newMultiline = false);
/**
* The editor gets deleted.
*/
virtual ~LGridTextEditor();
/**
* Creates m_control as LBoundTextCtrl.
* @param parent
* @param id
* @param evtHandler
*/
void Create(wxWindow *parent, wxWindowID id, wxEvtHandler *evtHandler);
/**
* Creates m_control if necessary. Registers the editor in the grid's resultset.
* @param row
* @param col
* @param grid
*/
void BeginEdit(int row, int col, wxGrid *grid);
wxGridCellEditor* Clone() const;
bool EndEdit(int row, int col, const wxGrid *grid, const wxString &oldval, wxString *newval);
/**
* Applies the editor value as returned by GetValue() to the grid cell.
* @param row
* @param col
* @param grid
*/
void ApplyEdit(int row, int col, wxGrid *grid);
/**
* Deletes the editor, all pointers to the editor are set to NULL.
*/
void Reset();
/**
*
* @return GetData(), or wxEmptyString if the editor control has not been created.
*/
wxString GetValue() const;
/**
* Creates a wxTextCtrl to be used as editor in form view.
*/
wxControl* ProvideFormEditor(wxWindow * parent);
wxControl* GetFormEditor() const
{
return m_formEditor;
}
/**
* Updates the grid cell and the editor. m_formEditor is deleted and set to NULL.
* @param row
* @param col
* @param grid
*/
void SyncBack(const int row, const int col, wxGrid * grid);
private:
bool m_multiline;
unsigned long m_style;
wxTextCtrl * m_formEditor;
/**
* Fully typed alias to m_control.
*/
LBoundTextCtrl * m_BoundTextCtrl;
};
#endif /* LGRIDTEXTEDITOR_H */