ToolMap
Loading...
Searching...
No Matches
tmchecklistboxrank.h
1/***************************************************************************
2 tmchecklistboxrank.h
3 Deals with checklistbox but add the ability to save the order
4 -------------------
5 copyright : (C) 2007 CREALP Lucien Schreiber
6 ***************************************************************************/
7
8/***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17// comment doxygen
18
19#ifndef _TMCHECKLISTBOXRANK_H_
20#define _TMCHECKLISTBOXRANK_H_
21
22// For compilers that support precompilation, includes "wx/wx.h".
23#include <wx/wxprec.h>
24
25// Include wxWidgets' headers
26#ifndef WX_PRECOMP
27#include <wx/wx.h>
28#endif
29
30#include "../database/database_tm.h" // for database operation (saving rank)
31#include "tmchecklistbox.h" // for parent class
32
33// menu items
34const int tmCHECK_MENU_SAVE_RANK = 10005;
35
36/***************************************************************************/
46 private:
47 // members
48 wxString m_RankColName;
49 wxString m_TableName;
50 DataBaseTM* m_pDB;
51
52 // functions
53 void Init();
54
55 bool AddToMenu();
56
57 // event functions
58 void OnSaveOrder(wxCommandEvent& event);
59
60 protected:
61 bool PrepareOrderStatement(wxString& sqlstatement);
62
63 void EnableRelevantMenuEntries();
64
65 public:
67
68 tmCheckListBoxRank(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition,
69 const wxSize& size = wxDefaultSize, int nStrings = 0, const wxString* choices = nullptr,
70 long style = 0, const wxValidator& validator = wxDefaultValidator,
71 const wxString& name = wxListBoxNameStr);
72
73 bool Create(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition,
74 const wxSize& size = wxDefaultSize, int nStrings = 0, const wxString* choices = nullptr, long style = 0,
75 const wxValidator& validator = wxDefaultValidator, const wxString& name = wxListBoxNameStr);
76
77 // set and get the rank column name
78 wxString GetRankColName() {
79 return m_RankColName;
80 }
81
82 void SetRankColName(const wxString& colrank = _T("RANK"));
83
84 // set and get the table name for the rank
85 wxString GetTableName() {
86 return m_TableName;
87 }
88
89 void SetTableName(const wxString& tabname = TABLE_NAME_OBJECTS);
90
91 // set the database
92 void SetDataBase(DataBaseTM* pDB) {
93 m_pDB = pDB;
94 }
95};
96
97#endif
Definition database_tm.h:80
Enhance the tmCheckListBox class.
Definition tmchecklistboxrank.h:45
bool PrepareOrderStatement(wxString &sqlstatement)
Prepare the statement for setting order.
Definition tmchecklistboxrank.cpp:178
bool Create(wxWindow *parent, wxWindowID id, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, int nStrings=0, const wxString *choices=nullptr, long style=0, const wxValidator &validator=wxDefaultValidator, const wxString &name=wxListBoxNameStr)
Constructor for two steps creation.
Definition tmchecklistboxrank.cpp:40
void SetTableName(const wxString &tabname=TABLE_NAME_OBJECTS)
Set the table name.
Definition tmchecklistboxrank.cpp:139
~tmCheckListBoxRank()
Destructor Do nothing actually.
Definition tmchecklistboxrank.cpp:72
void SetRankColName(const wxString &colrank=_T("RANK"))
Set the rank column name.
Definition tmchecklistboxrank.cpp:126
Deals with checkbox list.
Definition tmchecklistbox.h:56