-
Notifications
You must be signed in to change notification settings - Fork 0
/
RuDBGridColumns.h
110 lines (98 loc) · 2.85 KB
/
RuDBGridColumns.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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/*
* Copyright (c) 2005, Ing. Robert Ulbricht
*
* Projekt: AKontakt
* Obsah: TRurDBGridConfigurator, TRurDBGridColumnsDlg
* Nastavovanie stlpcov na gride
*/
#ifndef RuDBGridColumnsH
#define RuDBGridColumnsH
//----------------------------------------------------------------------------
#include <System.Classes.hpp>
#include <Vcl.Controls.hpp>
#include <Vcl.CheckLst.hpp>
#include <Vcl.StdCtrls.hpp>
#if defined(RUR_GRID_USE_DATASET)
#include <Data.DB.hpp>
#else
#include <FireDAC.Comp.Client.hpp>
#endif
//----------------------------------------------------------------------------
class XMLConfig;
class TRurDBGrid;
namespace Vcl {
namespace Dbgrids {
class TDBGrid;
}
}
///
/// Konfiguracny program
///
class TRurDBGridConfigurator
{
XMLConfig *xml; ///< Defaultna konfiguracia
XMLConfig *user; ///< Uzivatelska konfiguracia
#if defined(RUR_GRID_USE_DATASET)
TDataSet *save; ///< Sem ukladam uzivatelske nastavenie pre kazdy jeho grid
#else
TFDQuery *save; ///< Sem ukladam uzivatelske nastavenie pre kazdy jeho grid
#endif
int user_id; ///< id uzivatela
public:
TRurDBGridConfigurator();
~TRurDBGridConfigurator();
void Init(AnsiString path);
void Close();
bool CreateColumns(TRurDBGrid *grid, AnsiString name, bool &saved);
bool CreateColumns(Vcl::Dbgrids::TDBGrid *grid, AnsiString name, bool &saved);
#if defined(RUR_GRID_USE_DATASET)
void Init(AnsiString table, TDataSet *_save, int _user_id);
#else
void Init(AnsiString table,TFDConnection *c, int _user_id);
#endif
void SaveGrid(Vcl::Dbgrids::TDBGrid *grid, AnsiString name);
void ResetGrid(AnsiString name);
void SaveData(String name, String data);
String LoadData(String name);
};
#if defined(RUR_GRID_USE_DATASET)
void RurGridConfiguratorInit(AnsiString table, TDataSet *save, int user_id);
#else
void RurGridConfiguratorInit(AnsiString table,TFDConnection *c, int user_id);
#endif
extern TRurDBGridConfigurator rdgc;
class TRurDBGridMenu
{
Vcl::Dbgrids::TDBGrid *grid;
TPopupMenu *menu;
void __fastcall OnSetup(TObject *Sender);
public:
TRurDBGridMenu(Vcl::Dbgrids::TDBGrid *g);
void CreateMenu();
};
///
/// Dialog na nastavenie viditelnosti stlpcov
///
class TRurDBGridColumnsDlg : public TForm
{
__published:
TButton *OKBtn;
TButton *CancelBtn;
TCheckListBox *lb;
TButton *Button1;
TButton *Button2;
TButton *Button3;
void __fastcall FormShow(TObject *Sender);
void __fastcall Roztiahnut(TObject *Sender);
void __fastcall Hore(TObject *Sender);
void __fastcall Dolu(TObject *Sender);
void __fastcall OKBtnClick(TObject *Sender);
private:
public:
virtual __fastcall TRurDBGridColumnsDlg(TComponent* AOwner);
Vcl::Dbgrids::TDBGrid *grid;
};
//----------------------------------------------------------------------------
extern PACKAGE TRurDBGridColumnsDlg *RurDBGridColumnsDlg;
//----------------------------------------------------------------------------
#endif