1 //----------------------------------------------------------------------------------------
2 // Name:        dbtree.cpp/.h
3 // Purpose:     Tree with Table and Views, branches show Field information
4 // Author:      Mark Johnson
5 // Modified by: 19991129.mj10777
6 // Created:     19991129
7 // Copyright:   (c) Mark Johnson
8 // Licence:     wxWindows license
9 // RCS-ID:      $Id: dbtree.h 9256 2001-02-01 20:24:44Z georgetasker $
10 
11 //----------------------------------------------------------------------------------------
12 class MainDoc;             // Declared in doc.h file
13 
14 //----------------------------------------------------------------------------------------
15 class DBTreeData : public wxTreeItemData
16 {
17 public:
DBTreeData(const wxString & desc)18     DBTreeData(const wxString& desc) : m_desc(desc) { }
19     void ShowInfo(wxTreeCtrl *tree);
20     wxString m_desc;
21 };
22 
23 //----------------------------------------------------------------------------------------
24 class DBTree : public wxTreeCtrl
25 {
26 public:
27     enum
28     { // The order here must be the same as in m_imageListNormal !
29         TreeIc_Logo,                     // logo.ico
30             TreeIc_DsnClosed,                // dsnclose.ico
31             TreeIc_DsnOpen,                  // dsnopen.ico
32             TreeIc_TAB,                      // tab.ico
33             TreeIc_VIEW,                     // view.ico
34             TreeIc_COL,                      // col.ico
35             TreeIc_KEY,                      // key.ico
36             TreeIc_KEYF,                     // keyf.ico
37             TreeIc_DocOpen,                  // d_open.ico
38             TreeIc_DocClosed,                // d_closed.ico
39             TreeIc_FolderClosed,             // f_closed.ico
40             TreeIc_FolderOpen                // f_open.ico
41     };
42     wxString Temp0, Temp1, Temp2, Temp3, Temp4, Temp5;
43     //----------------------------------------------------------------------------------------
DBTree()44     DBTree() { }
45     DBTree(wxWindow *parent);
46     DBTree(wxWindow *parent, const wxWindowID id,const wxPoint& pos, const wxSize& size,long style);
47     virtual ~DBTree();
48     MainDoc *pDoc;
49     wxDbInf *ct_BrowserDB;
50     //----------------------------------------------------------------------------------------
51     int       i_TabArt;   // Tab = 0 ; Page = 1;
52     int       i_ViewNr;   // View Nummer in Tab / Page
53     int       i_Which;    // Which View, Database is this/using
54     wxString  s_DSN;      // Name of the Dataset
55     wxMenu   *popupMenu1; // OnDBClass
56     wxMenu   *popupMenu2; // OnDBGrid & OnTableclass
57     wxPoint TreePos;
58     //----------------------------------------------------------------------------------------
59     wxImageList *p_imageListNormal;
60     //----------------------------------------------------------------------------------------
61 public:
62     int  OnPopulate();
63     void OnSelChanged(wxTreeEvent& event);
64     void OnRightSelect(wxTreeEvent& event);
65     void OnDBGrid(wxCommandEvent& event);
66     void OnDBClass(wxCommandEvent& event);
67     void OnTableClass(wxCommandEvent& event);
68     void OnTableClassAll(wxCommandEvent& event);
69     void OnMouseEvent(wxMouseEvent& event);
70     void OnMouseMove(wxMouseEvent& event);
71 public:
72     //----------------------------------------------------------------------------------------
73     // NB: due to an ugly wxMSW hack you _must_ use DECLARE_DYNAMIC_CLASS()
74     //     if you want your overloaded OnCompareItems() to be called.
75     //     OTOH, if you don't want it you may omit the next line - this will
76     //     make default (alphabetical) sorting much faster under wxMSW.
77     DECLARE_DYNAMIC_CLASS(DBTree)
78         DECLARE_EVENT_TABLE()
79 };
80 
81 //----------------------------------------------------------------------------------------
82 #define POPUP_01_BEGIN     1100
83 #define DATA_SHOW          1101
84 #define DATA_DB            1102
85 #define DATA_TABLE         1103
86 #define DATA_TABLE_ALL     1104
87 #define POPUP_01_END       1117
88 //----------------------------------------------------------------------------------------
89