Thread: SVN Commit by andreas: r4787 - in trunk/pgadmin3/src: ctl dlg frm include include/base include/ctl
SVN Commit by andreas: r4787 - in trunk/pgadmin3/src: ctl dlg frm include include/base include/ctl
From
svn@pgadmin.org
Date:
Author: andreas Date: 2005-12-02 23:34:54 +0000 (Fri, 02 Dec 2005) New Revision: 4787 Modified: trunk/pgadmin3/src/ctl/ctlComboBox.cpp trunk/pgadmin3/src/dlg/dlgOperator.cpp trunk/pgadmin3/src/dlg/dlgProperty.cpp trunk/pgadmin3/src/dlg/dlgSelectConnection.cpp trunk/pgadmin3/src/frm/frmQuery.cpp trunk/pgadmin3/src/include/base/base.h trunk/pgadmin3/src/include/ctl/ctlComboBox.h trunk/pgadmin3/src/include/dlgOperator.h trunk/pgadmin3/src/include/dlgProperty.h trunk/pgadmin3/src/include/dlgSelectConnection.h trunk/pgadmin3/src/include/frmQuery.h Log: More wx2.6.2 API change fixes Modified: trunk/pgadmin3/src/ctl/ctlComboBox.cpp =================================================================== --- trunk/pgadmin3/src/ctl/ctlComboBox.cpp 2005-12-02 15:26:49 UTC (rev 4786) +++ trunk/pgadmin3/src/ctl/ctlComboBox.cpp 2005-12-02 23:34:54 UTC (rev 4787) @@ -27,25 +27,25 @@ -int wxComboBoxFix::Append(const wxString& item, const wxString &str) +int ctlComboBoxFix::Append(const wxString& item, const wxString &str) { return wxComboBox::Append(item, new StringClientData(str)); } -int wxComboBoxFix::Append(const wxString& item, long l) +int ctlComboBoxFix::Append(const wxString& item, long l) { return wxComboBox::Append(item, (void*)l); } -int wxComboBoxFix::Append(const wxString& item, OID oid) +int ctlComboBoxFix::Append(const wxString& item, OID oid) { return wxComboBox::Append(item, (void*)oid); } -int wxComboBoxFix::FillLongKey(pgConnBase *conn, const wxChar *qry) +int ctlComboBoxFix::FillLongKey(pgConnBase *conn, const wxChar *qry) { int cnt=0; pgSetIterator set(conn->ExecuteSet(qry)); @@ -60,7 +60,7 @@ } -int wxComboBoxFix::FillOidKey(pgConnBase *conn, const wxChar *qry) +int ctlComboBoxFix::FillOidKey(pgConnBase *conn, const wxChar *qry) { int cnt=0; pgSetIterator set(conn->ExecuteSet(qry)); @@ -75,7 +75,7 @@ } -int wxComboBoxFix::FillStringKey(pgConnBase *conn, const wxChar *qry) +int ctlComboBoxFix::FillStringKey(pgConnBase *conn, const wxChar *qry) { int cnt=0; pgSetIterator set(conn->ExecuteSet(qry)); @@ -89,21 +89,21 @@ return cnt; } -long wxComboBoxFix::GetLongKey(int sel) +long ctlComboBoxFix::GetLongKey(int sel) { if (sel < 0) sel = GetSelection(); return (long)GetClientData(sel); } -OID wxComboBoxFix::GetOIDKey(int sel) +OID ctlComboBoxFix::GetOIDKey(int sel) { if (sel < 0) sel = GetSelection(); return (OID)GetClientData(sel); } -wxString wxComboBoxFix::GetStringKey(int sel) +wxString ctlComboBoxFix::GetStringKey(int sel) { if (sel < 0) sel = GetSelection(); @@ -114,13 +114,13 @@ } -wxComboBoxFix::wxComboBoxFix(wxWindow *wnd, int id, wxPoint pos, wxSize siz, long attr) +ctlComboBoxFix::ctlComboBoxFix(wxWindow *wnd, int id, wxPoint pos, wxSize siz, long attr) : wxComboBox(wnd, id, wxEmptyString, pos, siz, 0, NULL, attr) { } -bool wxComboBoxFix::SetKey(long val) +bool ctlComboBoxFix::SetKey(long val) { int i; for (i=0 ; i < GetCount() ; i++) @@ -136,7 +136,7 @@ } -bool wxComboBoxFix::SetKey(OID val) +bool ctlComboBoxFix::SetKey(OID val) { int i; for (i=0 ; i < GetCount() ; i++) @@ -152,7 +152,7 @@ } -bool wxComboBoxFix::SetKey(const wxString &val) +bool ctlComboBoxFix::SetKey(const wxString &val) { int i; for (i=0 ; i < GetCount() ; i++) @@ -168,10 +168,21 @@ } +int ctlComboBoxFix::GetSelection() const +{ +#if wxABI_VERSION >= 20602 + int sel=wxComboBox::GetCurrentSelection(); +#else + int sel=wxComboBox::GetSelection(); +#endif + return sel; +} + + //////////////////////////////////////////// ctlComboBox::ctlComboBox(wxWindow *wnd, int id, wxPoint pos, wxSize siz, long attr) -: wxComboBoxFix(wnd, id, pos, siz, attr) +: ctlComboBoxFix(wnd, id, pos, siz, attr) { #ifdef __WXGTK__ SetEditable(false); @@ -208,11 +219,8 @@ int ctlComboBox::GetGuessedSelection() const { -#if wxABI_VERSION >= 20602 - int sel=wxComboBox::GetCurrentSelection(); -#else - int sel=wxComboBox::GetSelection(); -#endif + int sel=ctlComboBoxFix::GetCurrentSelection(); + if (sel < 0) sel = FindString(GetValue()); return sel; @@ -220,11 +228,8 @@ int ctlComboBox::GetSelection() const { -#if wxABI_VERSION >= 20602 - int sel=wxComboBox::GetCurrentSelection(); -#else - int sel=wxComboBox::GetSelection(); -#endif + int sel=ctlComboBoxFix::GetCurrentSelection(); + if (sel < 0) sel = FindString(GetValue()); return sel; Modified: trunk/pgadmin3/src/dlg/dlgOperator.cpp =================================================================== --- trunk/pgadmin3/src/dlg/dlgOperator.cpp 2005-12-02 15:26:49 UTC (rev 4786) +++ trunk/pgadmin3/src/dlg/dlgOperator.cpp 2005-12-02 23:34:54 UTC (rev 4787) @@ -362,7 +362,7 @@ -void dlgOperator::AppendFilledOperator(wxString &sql, wxChar *txt, wxComboBoxFix *cb) +void dlgOperator::AppendFilledOperator(wxString &sql, wxChar *txt, ctlComboBoxFix *cb) { wxString op=cb->GetValue().Trim(); if (!op.IsNull()) Modified: trunk/pgadmin3/src/dlg/dlgProperty.cpp =================================================================== --- trunk/pgadmin3/src/dlg/dlgProperty.cpp 2005-12-02 15:26:49 UTC (rev 4786) +++ trunk/pgadmin3/src/dlg/dlgProperty.cpp 2005-12-02 23:34:54 UTC (rev 4787) @@ -201,7 +201,7 @@ if (pos.x >= 0 && pos.y >= 0) Move(pos); - wxComboBoxFix *cbowner = (wxComboBoxFix*)cbOwner; + ctlComboBoxFix *cbowner = (ctlComboBoxFix*)cbOwner; if (cbClusterSet) { @@ -381,7 +381,7 @@ } -void dlgProperty::FillCombobox(const wxString &query, wxComboBox *cb1, wxComboBox *cb2) +void dlgProperty::FillCombobox(const wxString &query, ctlComboBoxFix *cb1, ctlComboBoxFix *cb2) { if (!cb1 && !cb2) return; @@ -401,13 +401,13 @@ } -void dlgProperty::AddUsers(wxComboBox *cb1, wxComboBox *cb2) +void dlgProperty::AddUsers(ctlComboBoxFix *cb1, ctlComboBoxFix *cb2) { FillCombobox(wxT("SELECT usename FROM pg_user ORDER BY usename"), cb1, cb2); } -void dlgProperty::PrepareTablespace(wxComboBox *cb, const wxChar *current) +void dlgProperty::PrepareTablespace(ctlComboBoxFix *cb, const wxChar *current) { wxASSERT(cb != 0); Modified: trunk/pgadmin3/src/dlg/dlgSelectConnection.cpp =================================================================== --- trunk/pgadmin3/src/dlg/dlgSelectConnection.cpp 2005-12-02 15:26:49 UTC (rev 4786) +++ trunk/pgadmin3/src/dlg/dlgSelectConnection.cpp 2005-12-02 23:34:54 UTC (rev 4787) @@ -139,7 +139,7 @@ } -int dlgSelectConnection::Go(pgConn *conn, wxComboBox *cb) +int dlgSelectConnection::Go(pgConn *conn, ctlComboBoxFix *cb) { cbConnection=cb; treeObjectIterator servers(mainForm->GetBrowser(), mainForm->GetServerCollection()); Modified: trunk/pgadmin3/src/frm/frmQuery.cpp =================================================================== --- trunk/pgadmin3/src/frm/frmQuery.cpp 2005-12-02 15:26:49 UTC (rev 4786) +++ trunk/pgadmin3/src/frm/frmQuery.cpp 2005-12-02 23:34:54 UTC (rev 4787) @@ -199,7 +199,7 @@ toolBar->AddTool(MNU_FIND, _("Find"), wxBitmap(edit_find_xpm), _("Find text"), wxITEM_NORMAL); toolBar->AddSeparator(); - cbConnection = new wxComboBox(toolBar, CTRLID_CONNECTION, wxEmptyString, wxDefaultPosition, wxSize(GetCharWidth()*30,-1), 0, 0, wxCB_READONLY|wxCB_DROPDOWN); + cbConnection = new ctlComboBoxFix(toolBar, CTRLID_CONNECTION, wxDefaultPosition, wxSize(GetCharWidth()*30, -1), wxCB_READONLY|wxCB_DROPDOWN); cbConnection->Append(conn->GetName(), (void*)conn); cbConnection->Append(_("<new connection>"), (void*)0); toolBar->AddControl(cbConnection); Modified: trunk/pgadmin3/src/include/base/base.h =================================================================== --- trunk/pgadmin3/src/include/base/base.h 2005-12-02 15:26:49 UTC (rev 4786) +++ trunk/pgadmin3/src/include/base/base.h 2005-12-02 23:34:54 UTC (rev 4787) @@ -67,7 +67,7 @@ #define CTRL_TEXTNUMERIC(id) ((wxTextNumericCtrl*)(XRCCTRL(*this, id, wxTextCtrl))) #define CTRL_LISTBOX(id) (XRCCTRL(*this, id, wxListBox)) #define CTRL_LISTCTRL(id) (XRCCTRL(*this, id, wxListCtrl)) -#define CTRL_COMBOBOX(id) (XRCCTRL(*this, id, wxComboBoxFix)) +#define CTRL_COMBOBOX(id) ((ctlComboBoxFix*)(XRCCTRL(*this, id, wxComboBox))) #define CTRL_LISTVIEW(id) ((ctlListView*)(XRCCTRL(*this, id, wxListCtrl))) #define CTRL_COMBOBOX2(id) (XRCCTRL(*this, id, ctlComboBox)) #define CTRL_CHECKBOX(id) (XRCCTRL(*this, id, wxCheckBox)) Modified: trunk/pgadmin3/src/include/ctl/ctlComboBox.h =================================================================== --- trunk/pgadmin3/src/include/ctl/ctlComboBox.h 2005-12-02 15:26:49 UTC (rev 4786) +++ trunk/pgadmin3/src/include/ctl/ctlComboBox.h 2005-12-02 23:34:54 UTC (rev 4787) @@ -20,10 +20,12 @@ class pgConnBase; -class wxComboBoxFix : public wxComboBox +class ctlComboBoxFix : public wxComboBox { public: - wxComboBoxFix(wxWindow *wnd, int id, wxPoint pos, wxSize siz, long attr); + ctlComboBoxFix(wxWindow *wnd, int id, wxPoint pos, wxSize siz, long attr); + + int GetSelection() const; int FillLongKey(pgConnBase *conn, const wxChar *qry); int FillOidKey(pgConnBase *conn, const wxChar *qry); int FillStringKey(pgConnBase *conn, const wxChar *qry); @@ -47,7 +49,7 @@ #endif }; -class ctlComboBox : public wxComboBoxFix +class ctlComboBox : public ctlComboBoxFix { public: ctlComboBox(wxWindow *wnd, int id, wxPoint pos, wxSize siz, long attr=0); Modified: trunk/pgadmin3/src/include/dlgOperator.h =================================================================== --- trunk/pgadmin3/src/include/dlgOperator.h 2005-12-02 15:26:49 UTC (rev 4786) +++ trunk/pgadmin3/src/include/dlgOperator.h 2005-12-02 23:34:54 UTC (rev 4787) @@ -35,7 +35,7 @@ void OnChangeTypeRight(wxCommandEvent &ev); void OnChangeJoin(wxCommandEvent &ev); - void AppendFilledOperator(wxString &sql, wxChar *txt, wxComboBoxFix *cb); + void AppendFilledOperator(wxString &sql, wxChar *txt, ctlComboBoxFix *cb); pgSchema *schema; pgOperator *oper; Modified: trunk/pgadmin3/src/include/dlgProperty.h =================================================================== --- trunk/pgadmin3/src/include/dlgProperty.h 2005-12-02 15:26:49 UTC (rev 4786) +++ trunk/pgadmin3/src/include/dlgProperty.h 2005-12-02 23:34:54 UTC (rev 4787) @@ -82,9 +82,9 @@ void OnChangeStc(wxStyledTextEvent& event); protected: - void AddUsers(wxComboBox *cb1, wxComboBox *cb2=0); - void FillCombobox(const wxString &query, wxComboBox *cb1, wxComboBox *cb2=0); - void PrepareTablespace(wxComboBox *cb, const wxChar *current=0); + void AddUsers(ctlComboBoxFix *cb1, ctlComboBoxFix *cb2=0); + void FillCombobox(const wxString &query, ctlComboBoxFix *cb1, ctlComboBoxFix *cb2=0); + void PrepareTablespace(ctlComboBoxFix *cb, const wxChar *current=0); pgConn *connection; pgDatabase *database; Modified: trunk/pgadmin3/src/include/dlgSelectConnection.h =================================================================== --- trunk/pgadmin3/src/include/dlgSelectConnection.h 2005-12-02 15:26:49 UTC (rev 4786) +++ trunk/pgadmin3/src/include/dlgSelectConnection.h 2005-12-02 23:34:54 UTC (rev 4787) @@ -25,7 +25,7 @@ pgServer *GetServer() { return remoteServer; } wxString GetDatabase(); - int Go(pgConn *conn, wxComboBox *cb); + int Go(pgConn *conn, ctlComboBoxFix *cb); private: void OnChangeServer(wxCommandEvent& ev); @@ -34,7 +34,7 @@ void OnCancel(wxCommandEvent& ev); pgServer *remoteServer; - wxComboBox *cbConnection; + ctlComboBoxFix *cbConnection; DECLARE_EVENT_TABLE() }; Modified: trunk/pgadmin3/src/include/frmQuery.h =================================================================== --- trunk/pgadmin3/src/include/frmQuery.h 2005-12-02 15:26:49 UTC (rev 4786) +++ trunk/pgadmin3/src/include/frmQuery.h 2005-12-02 23:34:54 UTC (rev 4787) @@ -33,7 +33,7 @@ ctlSQLResult *sqlResult; ExplainCanvas *explainCanvas; wxTextCtrl *msgResult, *msgHistory; - wxComboBox *cbConnection; + ctlComboBoxFix *cbConnection; pgConn *conn; wxLongLong elapsedQuery, elapsedRetrieve;