Hi,
I'm still working on a ctlColourPicker widget, our custom
wxColourPickerCtrl to work around issues found on Mac OS X by Dave. I
was obviously wrong when I said that coding this widget would be simple :-/
The patch attached is my current work. I'm pretty ashamed of it, but
can't find a way to fix my linking issue. Here is the error I got at the
linking step:
pgAdmin3.o: In function `ctlColourPickerXmlHandler':
/home/guillaume/freeprojects/git.pgadmin/pgadmin/../pgadmin/include/ctl/xh_ctlcolourpicker.h:25:
undefined reference to `vtable for ctlColourPickerXmlHandler'
collect2: ld returned 1 exit status
I have absolutely no idea what this could mean. Search engines didn't
help me on this. I don't know what to do. If you have any idea, I
welcome them.
If I don't find any way to fix this before the end of the week, I think
I'll fix the first issue another way: replacing wxColourPickerCtrl with
wxBitmapButton for each control (which means duplicated code, but much
simpler work). Simpler work means quicker work, so more time to code new
interesting 9.0 features. And I'll get back to this widget for next dev
cycle. But I would definitely prefer having a solution to my linking issue.
--
Guillaume.
http://www.postgresqlfr.org
http://dalibo.com
diff --git a/pgadmin/ctl/ctlColourPicker.cpp b/pgadmin/ctl/ctlColourPicker.cpp
new file mode 100644
index 0000000..00c4897
--- /dev/null
+++ b/pgadmin/ctl/ctlColourPicker.cpp
@@ -0,0 +1,42 @@
+//////////////////////////////////////////////////////////////////////////
+//
+// pgAdmin III - PostgreSQL Tools
+// RCS-ID: $Id$
+// Copyright (C) 2002 - 2010, The pgAdmin Development Team
+// This software is released under the BSD Licence
+//
+// ctlColourPicker.cpp - Colour Picker with a wxBitmapButton
+//
+//////////////////////////////////////////////////////////////////////////
+
+// wxWindows headers
+#include <wx/wx.h>
+
+// App headers
+#include "pgAdmin3.h"
+#include "ctl/ctlColourPicker.h"
+
+
+/*
+BEGIN_EVENT_TABLE(ctlColourPicker, wxBitmapButton)
+ EVT_BUTTON(ctlColourPicker::OnClick)
+END_EVENT_TABLE()
+*/
+
+
+ctlColourPicker::ctlColourPicker(wxWindow* parent, wxWindowID id, const wxBitmap& bitmap)
+: wxBitmapButton(parent, id, bitmap)
+{
+}
+
+wxColour ctlColourPicker::GetColour()
+{
+}
+
+void ctlColourPicker::SetColour(wxColour colour)
+{
+}
+
+void ctlColourPicker::OnClick(wxCommandEvent &ev)
+{
+}
diff --git a/pgadmin/ctl/module.mk b/pgadmin/ctl/module.mk
index e0cd6d7..0ef6bea 100644
--- a/pgadmin/ctl/module.mk
+++ b/pgadmin/ctl/module.mk
@@ -12,6 +12,7 @@
pgadmin3_SOURCES += \
$(srcdir)/ctl/calbox.cpp \
$(srcdir)/ctl/ctlCheckTreeView.cpp \
+ $(srcdir)/ctl/ctlColourPicker.cpp \
$(srcdir)/ctl/ctlComboBox.cpp \
$(srcdir)/ctl/ctlListView.cpp \
$(srcdir)/ctl/ctlMenuToolbar.cpp \
diff --git a/pgadmin/ctl/xh_ctlcolourpicker.cpp b/pgadmin/ctl/xh_ctlcolourpicker.cpp
new file mode 100644
index 0000000..2e566e1
--- /dev/null
+++ b/pgadmin/ctl/xh_ctlcolourpicker.cpp
@@ -0,0 +1,33 @@
+//////////////////////////////////////////////////////////////////////////
+//
+// pgAdmin III - PostgreSQL Tools
+// RCS-ID: $Id$
+// Copyright (C) 2002 - 2010, The pgAdmin Development Team
+// This software is released under the BSD Licence
+//
+// xh_ctlcolourpicker.cpp - ctlColourPicker handler
+//
+//////////////////////////////////////////////////////////////////////////
+
+#include "pgAdmin3.h"
+
+#include "wx/wx.h"
+#include "ctl/ctlColourPicker.h"
+#include "ctl/xh_ctlcolourpicker.h"
+
+IMPLEMENT_DYNAMIC_CLASS(ctlColourPickerXmlHandler, wxBitmapButtonXmlHandler)
+
+
+wxObject *ctlColourPickerXmlHandler::DoCreateResource()
+{
+ ctlColourPicker *ctl=new ctlColourPicker(m_parentAsWindow, GetID(), wxNullBitmap);
+
+ SetupWindow(ctl);
+
+ return ctl;
+}
+
+bool ctlColourPickerXmlHandler::CanHandle(wxXmlNode *node)
+{
+ return IsOfClass(node, wxT("ctlColourPicker"));
+}
diff --git a/pgadmin/include/ctl/ctlColourPicker.h b/pgadmin/include/ctl/ctlColourPicker.h
new file mode 100644
index 0000000..f2f06f2
--- /dev/null
+++ b/pgadmin/include/ctl/ctlColourPicker.h
@@ -0,0 +1,34 @@
+//////////////////////////////////////////////////////////////////////////
+//
+// pgAdmin III - PostgreSQL Tools
+// RCS-ID: $Id$
+// Copyright (C) 2002 - 2010, The pgAdmin Development Team
+// This software is released under the BSD Licence
+//
+// ctlColourPicker.cpp - TreeView with Checkboxes
+//
+//////////////////////////////////////////////////////////////////////////
+
+
+#ifndef _CTLCOLOURPICKER_H
+#define _CTLCOLOURPICKER_H
+
+// wxWindows headers
+#include <wx/wx.h>
+#include "utils/misc.h"
+
+
+
+class ctlColourPicker : public wxBitmapButton
+{
+public:
+ ctlColourPicker(wxWindow* parent, wxWindowID id, const wxBitmap& bitmap);
+
+ wxColour GetColour();
+ void SetColour(wxColour colour);
+
+private:
+ void OnClick(wxCommandEvent &evt);
+};
+
+#endif
diff --git a/pgadmin/include/ctl/module.mk b/pgadmin/include/ctl/module.mk
index 5d2be6d..7ab23f8 100644
--- a/pgadmin/include/ctl/module.mk
+++ b/pgadmin/include/ctl/module.mk
@@ -12,6 +12,7 @@
pgadmin3_SOURCES += \
$(srcdir)/include/ctl/calbox.h \
$(srcdir)/include/ctl/ctlCheckTreeView.h \
+ $(srcdir)/include/ctl/ctlColourPicker.h \
$(srcdir)/include/ctl/ctlComboBox.h \
$(srcdir)/include/ctl/ctlListView.h \
$(srcdir)/include/ctl/ctlMenuToolbar.h \
diff --git a/pgadmin/include/ctl/xh_ctlchecktreeview.h b/pgadmin/include/ctl/xh_ctlchecktreeview.h
index 073cce8..8100e6e 100644
--- a/pgadmin/include/ctl/xh_ctlchecktreeview.h
+++ b/pgadmin/include/ctl/xh_ctlchecktreeview.h
@@ -5,7 +5,7 @@
// Copyright (C) 2002 - 2010, The pgAdmin Development Team
// This software is released under the PostgreSQL Licence
//
-// xh_ctltree.h - ctlTree handler
+// xh_ctlchecktreeview.h - ctlCheckTreeView handler
//
//////////////////////////////////////////////////////////////////////////
diff --git a/pgadmin/include/ctl/xh_ctlcolourpicker.h b/pgadmin/include/ctl/xh_ctlcolourpicker.h
new file mode 100644
index 0000000..655c959
--- /dev/null
+++ b/pgadmin/include/ctl/xh_ctlcolourpicker.h
@@ -0,0 +1,31 @@
+//////////////////////////////////////////////////////////////////////////
+//
+// pgAdmin III - PostgreSQL Tools
+// RCS-ID: $Id$
+// Copyright (C) 2002 - 2010, The pgAdmin Development Team
+// This software is released under the BSD Licence
+//
+// xh_ctlcolourpicker.h - ctlColourPicker handler
+//
+//////////////////////////////////////////////////////////////////////////
+
+
+#ifndef _WX_XH_CTLCOLOURPICKER_H_
+#define _WX_XH_CTLCOLOURPICKER_H_
+
+
+#include "wx/xrc/xmlres.h"
+#include "wx/xrc/xh_bmpbt.h"
+
+//class WXDLLIMPEXP_XRC
+class ctlColourPickerXmlHandler : public wxBitmapButtonXmlHandler
+{
+DECLARE_DYNAMIC_CLASS(ctlColourPickerXmlHandler)
+public:
+ ctlColourPickerXmlHandler() : wxBitmapButtonXmlHandler() {}
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+};
+
+
+#endif
diff --git a/pgadmin/include/pgAdmin3.h b/pgadmin/include/pgAdmin3.h
index dc922b1..45c2793 100644
--- a/pgadmin/include/pgAdmin3.h
+++ b/pgadmin/include/pgAdmin3.h
@@ -24,6 +24,7 @@
#include "ctl/ctlListView.h"
#include "ctl/ctlComboBox.h"
#include <ctl/ctlCheckTreeView.h>
+#include <ctl/ctlColourPicker.h>
#include "dlg/dlgClasses.h"
#include "db/pgConn.h"
#include "db/pgSet.h"
diff --git a/pgadmin/include/precomp.h b/pgadmin/include/precomp.h
index e3004d0..0277ae4 100644
--- a/pgadmin/include/precomp.h
+++ b/pgadmin/include/precomp.h
@@ -24,6 +24,7 @@
#include "ctl/calbox.h"
#include "ctl/ctlCheckTreeView.h"
+#include "ctl/ctlColourPicker.h"
#include "ctl/ctlComboBox.h"
#include "ctl/ctlListView.h"
#include "ctl/ctlSecurityPanel.h"
@@ -37,6 +38,7 @@
#include "ctl/xh_calb.h"
#include "ctl/xh_ctlcombo.h"
#include "ctl/xh_ctlchecktreeview.h"
+#include "ctl/xh_ctlcolourpicker.h"
#include "ctl/xh_ctltree.h"
#include "ctl/xh_sqlbox.h"
#include "ctl/xh_timespin.h"
diff --git a/pgadmin/include/utils/misc.h b/pgadmin/include/utils/misc.h
index b98f1cb..4a9dad6 100644
--- a/pgadmin/include/utils/misc.h
+++ b/pgadmin/include/utils/misc.h
@@ -87,7 +87,7 @@ extern sysSettings *settings;
#define CTRL_CHECKLISTBOX(id) (XRCCTRL(*this, id, wxCheckListBox))
#define CTRL_DATEPICK(id) (XRCCTRL(*this, id, wxDatePickerCtrl))
#define CTRL_TREE(id) (XRCCTRL(*this, id, ctlTree))
-#define CTRL_COLOURPICKER(id) (XRCCTRL(*this, id, wxColourPickerCtrl))
+#define CTRL_COLOURPICKER(id) (XRCCTRL(*this, id, ctlColourPicker))
#define CTRL_CHECKTREEVIEW(id) (XRCCTRL(*this, id, ctlCheckTreeView))
#endif // PGSCLI
diff --git a/pgadmin/pgAdmin3.cpp b/pgadmin/pgAdmin3.cpp
index 1c12dae..7e742ef 100644
--- a/pgadmin/pgAdmin3.cpp
+++ b/pgadmin/pgAdmin3.cpp
@@ -66,6 +66,7 @@
#include "ctl/xh_ctlcombo.h"
#include "ctl/xh_ctltree.h"
#include "ctl/xh_ctlchecktreeview.h"
+#include "ctl/xh_ctlcolourpicker.h"
#define DOC_DIR wxT("/docs")
#define UI_DIR wxT("/ui")
@@ -379,6 +380,7 @@ bool pgAdmin3::OnInit()
wxXmlResource::Get()->AddHandler(new ctlComboBoxXmlHandler);
wxXmlResource::Get()->AddHandler(new ctlTreeXmlHandler);
wxXmlResource::Get()->AddHandler(new ctlCheckTreeViewXmlHandler);
+ wxXmlResource::Get()->AddHandler(new ctlColourPickerXmlHandler);
InitXml();
--
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers