Hi All,

I give a try on this.
* Created a combined component using wxPanel, which contains ctlCtrlView & arranger buttons both.

It is just a simple development patch.
Lot of modifications will be needed.

Please review it.

Regards,
Ashesh

Gevik Babakhani wrote:
I can give it a try. The xrc file(s) will have a minor change anyway by
replacing wxListCtrl with the "unknown" placeholder which then is populated
with the composite control in the code.


-----Original Message-----
From: Dave Page [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 12, 2008 10:44 AM
To: Ashesh D Vashi
Cc: Gevik Babakhani; Guillaume Lelarge; [email protected]
Subject: Re: [pgadmin-hackers] extending functionality strategy

On Wed, Nov 12, 2008 at 9:41 AM, Ashesh D Vashi <[EMAIL PROTECTED]> wrote:
Dave Page wrote:

On Mon, Nov 10, 2008 at 3:41 PM, Gevik Babakhani
<[EMAIL PROTECTED]> wrote:
Thinking about new solutions....

Perhaps we could create a composite type (a wxPanel hosting a wxListCtrl and the buttons) that has an interface like the
wxListCtrl.
This way we should not need to change the xrc files.



That should be possible. Are you going to give it a go?


I was trying the same earlier, but did not get any success.
:( May be
- I am not much familiar with wxWidgets.
OK, no problem - I did throw you in at the deep end somewhat :-)

--
Dave Page
EnterpriseDB UK:   http://www.enterprisedb.com

Index: ctl\xh_ctlListArranger.cpp
===================================================================
--- ctl\xh_ctlListArranger.cpp	(revision 0)
+++ ctl\xh_ctlListArranger.cpp	(revision 0)
@@ -0,0 +1,34 @@
+//////////////////////////////////////////////////////////////////////////
+//
+// pgAdmin III - PostgreSQL Tools
+// RCS-ID:
+// Copyright (C) 2002 - 2008, The pgAdmin Development Team
+// This software is released under the Artistic Licence
+//
+// xh_ctlListArranger.cpp - ctlListArranger handler
+//
+//////////////////////////////////////////////////////////////////////////
+ 
+
+#include "wx/wx.h"
+
+#include "pgAdmin3.h"
+#include "ctl/ctlListItemArranger.h"
+#include "ctl/xh_ctlListArranger.h"
+
+IMPLEMENT_DYNAMIC_CLASS(ctlListArrangerXmlHandler, wxPanelXmlHandler)
+
+
+wxObject *ctlListArrangerXmlHandler::DoCreateResource()
+{ 
+    ctlListItemArranger *ctl=new ctlListItemArranger(m_parentAsWindow, GetID(), GetPosition(), GetSize(), GetStyle());
+    
+    SetupWindow(ctl);
+   
+    return ctl;
+}
+
+bool ctlListArrangerXmlHandler::CanHandle(wxXmlNode *node)
+{
+    return IsOfClass(node, wxT("ctlListArranger"));
+}
Index: ctl/module.mk
===================================================================
--- ctl/module.mk	(revision 7499)
+++ ctl/module.mk	(working copy)
@@ -26,7 +26,9 @@
         $(srcdir)/ctl/xh_ctlcombo.cpp \
         $(srcdir)/ctl/xh_ctltree.cpp \
         $(srcdir)/ctl/xh_sqlbox.cpp \
-        $(srcdir)/ctl/xh_timespin.cpp
+        $(srcdir)/ctl/xh_timespin.cpp \
+        $(srcdir)/ctl/xh_ctlListArranger.cpp \
+        $(srcdir)/ctl/ctlListItemArranger.cpp     
 
 EXTRA_DIST += \
         $(srcdir)/ctl/module.mk
Index: pgAdmin3.cpp
===================================================================
--- pgAdmin3.cpp	(revision 7499)
+++ pgAdmin3.cpp	(working copy)
@@ -64,6 +64,7 @@
 #include "ctl/xh_sqlbox.h"
 #include "ctl/xh_ctlcombo.h"
 #include "ctl/xh_ctltree.h"
+#include "ctl/xh_ctlListArranger.h"
 
 #define DOC_DIR      wxT("/docs")
 #define UI_DIR       wxT("/ui")
@@ -369,6 +370,7 @@
     wxXmlResource::Get()->AddHandler(new wxTimeSpinXmlHandler);
     wxXmlResource::Get()->AddHandler(new ctlSQLBoxXmlHandler);
     wxXmlResource::Get()->AddHandler(new ctlComboBoxXmlHandler);
+    wxXmlResource::Get()->AddHandler(new ctlListArrangerXmlHandler);
     wxXmlResource::Get()->AddHandler(new ctlTreeXmlHandler);
 
     InitXml();
Index: include/ctl/module.mk
===================================================================
--- include/ctl/module.mk	(revision 7499)
+++ include/ctl/module.mk	(working copy)
@@ -26,7 +26,9 @@
 	$(srcdir)/include/ctl/xh_ctlcombo.h \
 	$(srcdir)/include/ctl/xh_ctltree.h \
 	$(srcdir)/include/ctl/xh_sqlbox.h \
-	$(srcdir)/include/ctl/xh_timespin.h
+	$(srcdir)/include/ctl/xh_timespin.h \
+	$(srcdir)/include/ctl/xh_ctlListArranger.h \
+	$(srcdir)/include/ctl/ctlListItemArranger.h
 
 EXTRA_DIST += \
     $(srcdir)/include/ctl/module.mk
Index: include/utils/misc.h
===================================================================
--- include/utils/misc.h	(revision 7499)
+++ include/utils/misc.h	(working copy)
@@ -86,6 +86,7 @@
 #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_LISTARRANGER(id)	((ctlListView*)((ctlListItemArranger*)(XRCCTRL(*this, id, wxPanel)))->GetList())
 
 #endif // PGSCLI
 
Index: include/images/ctlListItemArrangerLast.xpm
===================================================================
--- include/images/ctlListItemArrangerLast.xpm	(revision 0)
+++ include/images/ctlListItemArrangerLast.xpm	(revision 0)
@@ -0,0 +1,38 @@
+/* XPM */
+const char * ctlListItemArranger_Last_xpm[] = {
+"13 8 27 1",
+" 	c None",
+".	c #8BB161",
+"+	c #5A9B13",
+"@	c #CEE0A7",
+"#	c #BAD381",
+"$	c #B2CE71",
+"%	c #B0CD6C",
+"&	c #ADCB62",
+"*	c #ABC95E",
+"=	c #A9C856",
+"-	c #AFCC63",
+";	c #C5DA8D",
+">	c #BAD485",
+",	c #9FC353",
+"'	c #97BD40",
+")	c #92BA33",
+"!	c #90B82C",
+"~	c #94BB2F",
+"{	c #AFCC64",
+"]	c #BAD483",
+"^	c #9FC251",
+"/	c #94BB38",
+"(	c #92B931",
+"_	c #B1CD69",
+":	c #A5C55A",
+"<	c #B6D178",
+"[	c #CCDFA3",
+" .+++++++++. ",
+" [EMAIL PROTECTED]&*=-;+ ",
+" .+>,')!~{+. ",
+"  .+]^/(_+.  ",
+"   .+#:<+.   ",
+"    .+[+.    ",
+"     .+.     ",
+" .+++++++++. "};
Index: include/images/ctlListItemArrangerDown.xpm
===================================================================
--- include/images/ctlListItemArrangerDown.xpm	(revision 0)
+++ include/images/ctlListItemArrangerDown.xpm	(revision 0)
@@ -0,0 +1,49 @@
+/* XPM */
+const char * ctlListItemArranger_Down_xpm[] = {
+"13 8 38 1",
+" 	c None",
+".	c #8BB161",
+"+	c #5A9B13",
+"@	c #CEE0A7",
+"#	c #BAD381",
+"$	c #B2CE71",
+"%	c #B0CD6C",
+"&	c #AECB67",
+"*	c #ADCB62",
+"=	c #ABC95E",
+"-	c #AAC85A",
+";	c #A9C856",
+">	c #AFCC63",
+",	c #C5DA8D",
+"'	c #BAD485",
+")	c #9FC353",
+"!	c #97BD40",
+"~	c #95BB39",
+"{	c #92BA33",
+"]	c #90B82C",
+"^	c #8EB726",
+"/	c #94BB2F",
+"(	c #AFCC64",
+"_	c #BAD483",
+":	c #9FC251",
+"<	c #96BD3E",
+"[	c #94BB38",
+"}	c #92B931",
+"|	c #97BC38",
+"1	c #B1CD69",
+"2	c #BAD383",
+"3	c #9EC24F",
+"4	c #96BC3D",
+"5	c #9BBF43",
+"6	c #B4CF70",
+"7	c #A5C55A",
+"8	c #B6D178",
+"9	c #CCDFA3",
+".+++++++++++.",
+"[EMAIL PROTECTED]&*=-;>,+",
+".+')!~{]^/(+.",
+" .+_:<[}|1+. ",
+"  .+23456+.  ",
+"   .+#78+.   ",
+"    .+9+.    ",
+"     .+.     "};
Index: include/images/ctlListItemArrangerUp.xpm
===================================================================
--- include/images/ctlListItemArrangerUp.xpm	(revision 0)
+++ include/images/ctlListItemArrangerUp.xpm	(revision 0)
@@ -0,0 +1,49 @@
+/* XPM */
+const char * ctlListItemArranger_Up_xpm[] = {
+"13 8 38 1",
+" 	c None",
+".	c #8BB161",
+"+	c #5A9B13",
+"@	c #CCDFA3",
+"#	c #BAD381",
+"$	c #A5C55A",
+"%	c #B6D178",
+"&	c #BAD383",
+"*	c #9EC24F",
+"=	c #96BC3D",
+"-	c #9BBF43",
+";	c #B4CF70",
+">	c #BAD483",
+",	c #9FC251",
+"'	c #96BD3E",
+")	c #94BB38",
+"!	c #92B931",
+"~	c #97BC38",
+"{	c #B1CD69",
+"]	c #BAD485",
+"^	c #9FC353",
+"/	c #97BD40",
+"(	c #95BB39",
+"_	c #92BA33",
+":	c #90B82C",
+"<	c #8EB726",
+"[	c #94BB2F",
+"}	c #AFCC64",
+"|	c #CEE0A7",
+"1	c #B2CE71",
+"2	c #B0CD6C",
+"3	c #AECB67",
+"4	c #ADCB62",
+"5	c #ABC95E",
+"6	c #AAC85A",
+"7	c #A9C856",
+"8	c #AFCC63",
+"9	c #C5DA8D",
+"     .+.     ",
+"    [EMAIL PROTECTED]    ",
+"   .+#$%+.   ",
+"  .+&*=-;+.  ",
+" .+>,')!~{+. ",
+".+]^/(_:<[}+.",
+"+|#123456789+",
+".+++++++++++."};
Index: include/images/ctlListItemArrangerFirst.xpm
===================================================================
--- include/images/ctlListItemArrangerFirst.xpm	(revision 0)
+++ include/images/ctlListItemArrangerFirst.xpm	(revision 0)
@@ -0,0 +1,38 @@
+/* XPM */
+const char * ctlListItemArranger_First_xpm[] = {
+"13 8 27 1",
+" 	c None",
+".	c #8BB161",
+"+	c #5A9B13",
+"@	c #CCDFA3",
+"#	c #BAD381",
+"$	c #A5C55A",
+"%	c #B6D178",
+"&	c #BAD483",
+"*	c #9FC251",
+"=	c #94BB38",
+"-	c #92B931",
+";	c #B1CD69",
+">	c #BAD485",
+",	c #9FC353",
+"'	c #97BD40",
+")	c #92BA33",
+"!	c #90B82C",
+"~	c #94BB2F",
+"{	c #AFCC64",
+"]	c #CEE0A7",
+"^	c #B2CE71",
+"/	c #B0CD6C",
+"(	c #ADCB62",
+"_	c #ABC95E",
+":	c #A9C856",
+"<	c #AFCC63",
+"[	c #C5DA8D",
+" .+++++++++. ",
+"     .+.     ",
+"    [EMAIL PROTECTED]    ",
+"   .+#$%+.   ",
+"  .+&*=-;+.  ",
+" .+>,')!~{+. ",
+" +]#^/(_:<[+ ",
+" .+++++++++. "};
Index: include/images/module.mk
===================================================================
--- include/images/module.mk	(revision 7499)
+++ include/images/module.mk	(working copy)
@@ -202,7 +202,11 @@
 	$(srcdir)/include/images/view.xpm \
 	$(srcdir)/include/images/viewdata.xpm \
 	$(srcdir)/include/images/viewfiltereddata.xpm \
-	$(srcdir)/include/images/views.xpm
+	$(srcdir)/include/images/views.xpm \
+	$(srcdir)/include/images/ctlListItemArrangerDown.xpm \
+	$(srcdir)/include/images/ctlListItemArrangerFirst.xpm \
+	$(srcdir)/include/images/ctlListItemArrangerLast.xpm \
+	$(srcdir)/include/images/ctlListItemArrangerUp.xpm
 
 EXTRA_DIST += \
         $(srcdir)/include/images/module.mk \
Index: include/dlg/dlgType.h
===================================================================
--- include/dlg/dlgType.h	(revision 7499)
+++ include/dlg/dlgType.h	(working copy)
@@ -14,6 +14,7 @@
 #define __DLG_TYPEPROP
 
 #include "dlg/dlgProperty.h"
+#include "ctl/ctlListItemArranger.h"
 
 class pgType;
 
Index: include\ctl\xh_ctlListArranger.h
===================================================================
--- include\ctl\xh_ctlListArranger.h	(revision 0)
+++ include\ctl\xh_ctlListArranger.h	(revision 0)
@@ -0,0 +1,31 @@
+//////////////////////////////////////////////////////////////////////////
+//
+// pgAdmin III - PostgreSQL Tools
+// RCS-ID:
+// Copyright (C) 2002 - 2008, The pgAdmin Development Team
+// This software is released under the Artistic Licence
+//
+// xh_ctlListArranger.h - ctlListArranger handler
+//
+//////////////////////////////////////////////////////////////////////////
+
+
+#ifndef _WX_XH_CTLLISTARRANGER_H_
+#define _WX_XH_CTLLISTARRANGER_H_
+
+
+#include "wx/xrc/xmlres.h"
+#include "wx/xrc/xh_panel.h"
+
+//class WXDLLIMPEXP_XRC 
+class ctlListArrangerXmlHandler : public wxPanelXmlHandler
+{
+DECLARE_DYNAMIC_CLASS(ctlListArrangerXmlHandler)
+public:
+    ctlListArrangerXmlHandler() : wxPanelXmlHandler() {}
+    virtual wxObject *DoCreateResource();
+    virtual bool CanHandle(wxXmlNode *node);
+};
+
+
+#endif 
Index: utils/sysSettings.cpp
===================================================================
--- utils/sysSettings.cpp	(revision 7499)
+++ utils/sysSettings.cpp	(working copy)
@@ -147,7 +147,7 @@
     else if (objtype == _("Types")) 
     {
         engtype = wxT("Types");
-        def = false;
+        def = true;
     }
     else if (objtype == _("Views")) 
         engtype = wxT("Views");
Index: pgAdmin3.vcproj
===================================================================
--- pgAdmin3.vcproj	(revision 7499)
+++ pgAdmin3.vcproj	(working copy)
@@ -411,6 +411,10 @@
 				>
 			</File>
 			<File
+				RelativePath=".\ctl\ctlListItemArranger.cpp"
+				>
+			</File>
+			<File
 				RelativePath=".\ctl\explainCanvas.cpp"
 				>
 			</File>
@@ -439,6 +443,10 @@
 				>
 			</File>
 			<File
+				RelativePath=".\ctl\xh_ctlListArranger.cpp"
+				>
+			</File>
+			<File
 				RelativePath=".\ctl\xh_sqlbox.cpp"
 				>
 			</File>
@@ -938,6 +946,10 @@
 					>
 				</File>
 				<File
+					RelativePath=".\include\ctl\ctlListItemArranger.h"
+					>
+				</File>
+				<File
 					RelativePath=".\include\ctl\explainCanvas.h"
 					>
 				</File>
@@ -966,6 +978,10 @@
 					>
 				</File>
 				<File
+					RelativePath=".\include\ctl\xh_ctlListArranger.h"
+					>
+				</File>
+				<File
 					RelativePath=".\include\ctl\xh_sqlbox.h"
 					>
 				</File>
Index: dlg/dlgType.cpp
===================================================================
--- dlg/dlgType.cpp	(revision 7499)
+++ dlg/dlgType.cpp	(working copy)
@@ -21,6 +21,7 @@
 #include "schema/pgSchema.h"
 #include "schema/pgType.h"
 #include "schema/pgDatatype.h"
+#include "ctl/ctlListItemArranger.h"
 
 
 // pointer to controls
@@ -40,7 +41,7 @@
 #define chkByValue              CTRL_CHECKBOX("chkByValue")
 #define cbAlignment             CTRL_COMBOBOX("cbAlignment")
 #define cbStorage               CTRL_COMBOBOX("cbStorage")
-#define lstMembers              CTRL_LISTVIEW("lstMembers")
+#define lstMembers              CTRL_LISTARRANGER("lstMembers")
 #define txtMembername           CTRL_TEXT("txtMembername")
 #define lstLabels               CTRL_LISTVIEW("lstLabels")
 #define txtLabel                CTRL_TEXT("txtLabel")
@@ -182,15 +183,18 @@
 
         wxArrayString elements=type->GetTypesArray();
         size_t i;
-		for (i=0 ; i < elements.GetCount() ; i+=2)
+        for (i=0 ; i < elements.GetCount() ; i+=2)
             lstMembers->AppendItem(0, elements.Item(i), elements.Item(i+1));
 
+        // disable order re-arranging when a type exists
+        //lstMembers->setEnable(false);
+
         cbDatatype->Disable();
         txtLength->Disable();
 
         // Load the enum labels
         elements=type->GetLabelArray();
-		for (i=0 ; i < elements.GetCount() ; i++)
+        for (i=0 ; i < elements.GetCount() ; i++)
             lstLabels->AppendItem(0, elements.Item(i));
 
         if (!connection->BackendMinimumVersion(7, 5))
Index: ui/dlgType.xrc
===================================================================
--- ui/dlgType.xrc	(revision 7499)
+++ ui/dlgType.xrc	(working copy)
@@ -136,8 +136,7 @@
                     <growablecols>0</growablecols>
                     <growablerows>0</growablerows>
                     <object class="sizeritem">
-                      <object class="wxListCtrl" name="lstMembers">
-                        <style>wxLC_REPORT|wxLC_SINGLE_SEL</style>
+                      <object class="ctlListArranger" name="lstMembers">
                       </object>
                       <flag>wxEXPAND|wxALIGN_CENTRE_VERTICAL|wxTOP|wxLEFT|wxRIGHT</flag>
                       <border>4</border>
-- 
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers

Reply via email to