]> git.saurik.com Git - wxWidgets.git/blame - samples/db/listdb.h
only check for lib directory for architectures which have multiple ABIs (Solaris...
[wxWidgets.git] / samples / db / listdb.h
CommitLineData
108106cf
JS
1///////////////////////////////////////////////////////////////////////////////
2// Name: listdb.h
be5a51fb 3// Purpose: wxWidgets database demo app
108106cf
JS
4// Author: George Tasker
5// Modified by:
6// Created: 1996
7// RCS-ID: $Id$
8// Copyright: (c) 1996 Remstar International, Inc.
9// Licence: wxWindows licence
10///////////////////////////////////////////////////////////////////////////////
11
52ad8c7d 12#if defined(__GNUG__) && !defined(__APPLE__)
108106cf 13#pragma interface "listdb.h"
1fc5dd6f 14#endif
108106cf
JS
15
16/*
e70e8f4c 17 Contains dialog class for creating a data table lookup listbox
108106cf
JS
18*/
19
20#ifndef LISTDB_DOT_H
21#define LISTDB_DOT_H
22
23
fb86524f 24#include "wx/dbtable.h"
108106cf 25
5b077d48 26const int LOOKUP_COL_LEN = 250;
108106cf 27
108106cf 28// Clookup class
f6bcfd97 29class Clookup : public wxDbTable
108106cf 30{
e70e8f4c 31 public:
108106cf 32
94613352 33 wxChar lookupCol[LOOKUP_COL_LEN+1];
108106cf 34
da1e87c4 35 Clookup(wxString tblName, wxString colName, wxDb *pDb, const wxString &defDir=wxT(""));
108106cf
JS
36
37}; // Clookup
38
049977d0 39
108106cf 40// Clookup2 class
f6bcfd97 41class Clookup2 : public wxDbTable
108106cf 42{
e70e8f4c 43 public:
108106cf 44
94613352
GT
45 wxChar lookupCol1[LOOKUP_COL_LEN+1];
46 wxChar lookupCol2[LOOKUP_COL_LEN+1];
108106cf 47
da1e87c4 48 Clookup2(wxString tblName, wxString colName1, wxString colName2, wxDb *pDb, const wxString &defDir=wxT(""));
108106cf
JS
49
50}; // Clookup2
51
049977d0
GT
52
53// ClookUpDlg class
1fc5dd6f 54class ClookUpDlg : public wxDialog
108106cf 55{
e70e8f4c
GT
56 private:
57 bool widgetPtrsSet;
58 int currentCursor;
59 Clookup *lookup;
60 Clookup2 *lookup2;
61 int noDisplayCols;
62 int col1Len;
63
64 wxListBox *pLookUpSelectList;
65 wxButton *pLookUpOkBtn;
66 wxButton *pLookUpCancelBtn;
67
68 public:
69
70 // This is a generic lookup constructor that will work with any table and any column
e689d52a
GT
71 ClookUpDlg(wxWindow *parent,
72 const wxString &windowTitle,
73 const wxString &tableName,
74 const wxString &colName,
75 const wxString &where,
76 const wxString &orderBy,
77 wxDb *pDb,
78 const wxString &defDir);
e70e8f4c
GT
79
80 //
81 // This is a generic lookup constructor that will work with any table and any column.
82 // It extends the capabilites of the lookup dialog in the following ways:
83 //
84 // 1) 2 columns rather than one
049977d0 85 // 2) The ability to select DISTINCT column values
e70e8f4c 86 //
6d841efd 87 // Only set distinctValues equal to true if necessary. In many cases, the constraints
e70e8f4c
GT
88 // of the index(es) will enforce this uniqueness. Selecting DISTINCT does require
89 // overhead by the database to ensure that all values returned are distinct. Therefore,
90 // use this ONLY when you need it.
91 //
92 // For complicated queries, you can pass in the sql select statement. This would be
93 // necessary if joins are involved since by default both columns must come from the
94 // same table.
95 //
96 // If you do query by sql statement, you must pass in the maximum length of column1,
97 // since it cannot be derived when you query using your own sql statement.
98 //
99 // The optional database connection can be used if you'd like the lookup class
049977d0
GT
100 // to use a database pointer other than the READONLY_DB of the app. This is necessary
101 // if records are being saved, but not committed to the db, yet should be included
e70e8f4c
GT
102 // in the lookup window.
103 //
104 ClookUpDlg(wxWindow *parent,
e689d52a
GT
105 const wxString &windowTitle,
106 const wxString &tableName,
107 const wxString &dispCol1, // Must have at least 1 display column
108 const wxString &dispCol2, // Optional
109 const wxString &where,
110 const wxString &orderBy,
111 wxDb *pDb, // Database connection pointer
112 const wxString &defDir,
113 bool distinctValues, // e.g. SELECT DISTINCT ...
114 const wxString &selectStmt = wxEmptyString, // If you wish to query by SQLstmt (complicated lookups)
115 int maxLenCol1 = 0, // Mandatory if querying by SQLstmt
116 bool allowOk = true); // is the OK button enabled
117
118 void OnButton(wxCommandEvent &event);
e70e8f4c
GT
119 void OnCommand(wxWindow& win, wxCommandEvent& event);
120 void OnClose(wxCloseEvent& event);
121 void OnActivate(bool) {}; // necessary for hot keys
e689d52a 122 void OnDClick(wxCommandEvent &event);
65d7ddc4
GT
123
124DECLARE_EVENT_TABLE()
049977d0 125}; // class ClookUpDlg
108106cf 126
1fc5dd6f
JS
127#define LOOKUP_DIALOG 500
128
129#define LOOKUP_DIALOG_SELECT 501
130#define LOOKUP_DIALOG_OK 502
131#define LOOKUP_DIALOG_CANCEL 503
132
108106cf
JS
133#endif // LISTDB_DOT_H
134
135// ************************************ listdb.h *********************************