[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]

[XaraXtreme-commits] Commit Complete



Commit by  : alex
Repository : xara
Revision   : 1037
Date       : Sat May 13 19:25:07 BST 2006

Changed paths:
   M /Trunk/XaraLX/Kernel/prpsgds.cpp
   M /Trunk/XaraLX/wxOil/Makefile.am
   M /Trunk/XaraLX/wxOil/coldrop.cpp
   M /Trunk/XaraLX/wxOil/coldrop.h
   A /Trunk/XaraLX/wxOil/dropdown.cpp
   A /Trunk/XaraLX/wxOil/dropdown.h
   M /Trunk/XaraLX/wxXtra/combo.cpp
   M /Trunk/XaraLX/wxXtra/combo.h
   M /Trunk/XaraLX/wxXtra/combog.cpp
   M /Trunk/XaraLX/wxXtra/odcombo.cpp
   M /Trunk/XaraLX/wxXtra/odcombo.h

Mode wxODComboBox work. Firt port of dropdown and coldrop.


Diff:
Index: Trunk/XaraLX/Kernel/prpsgds.cpp
===================================================================
--- Trunk/XaraLX/Kernel/prpsgds.cpp	(revision 1036)
+++ Trunk/XaraLX/Kernel/prpsgds.cpp	(revision 1037)
@@ -114,7 +114,7 @@
 //#include "nev.h"		// error messages
 #include "prpsgds.h"
 #include "guides.h"
-//#include "coldrop.h"
+#include "coldrop.h"
 #include "fixmem.h"
 #include "document.h"
 //#include "markn.h"
@@ -174,11 +174,9 @@
 																				
 GuidesPropertiesTab::~GuidesPropertiesTab()
 {
-PORTNOTE("other", "Disabled Colour Dropdown")
-#ifndef EXCLUDE_FROM_XARALX
 	if (pColourDropDown != NULL)
 		delete pColourDropDown;
-#endif
+
 	GuidelineList.DeleteAll();
 }        
 
@@ -515,8 +513,6 @@
 
 BOOL GuidesPropertiesTab::ShowColours()
 {
-PORTNOTE("other", "Disabled Colour Dropdown")
-#ifndef EXCLUDE_FROM_XARALX
 	if (pColourDropDown != NULL)
 	{
 		IndexedColour* pIndexedColour = NULL;
@@ -553,7 +549,6 @@
 		else
 			pColourDropDown->FillInColourList(NULL,0);
 	}
-#endif
 	return TRUE;
 }
 
@@ -649,8 +644,6 @@
 
 BOOL GuidesPropertiesTab::ColourListChanged(Document* pDoc)
 {
-PORTNOTE("other", "Disabled Colour Dropdown")
-#ifndef EXCLUDE_FROM_XARALX
 	ERROR2IF(pPropertiesDlg == NULL,FALSE,"GuidesPropertiesTab::UpdateGuidelineSection() called with no dialog pointer");
 	ERROR2IF(pColourDropDown == NULL,FALSE,"ptr to 'colour drop down' is NULL");
 
@@ -666,7 +659,6 @@
 		else
 			pColourDropDown->ClearList();			
 	}
-#endif
 	return TRUE;
 }
 
@@ -776,8 +768,6 @@
 
 BOOL GuidesPropertiesTab::ColourChanged(INT32 Index)
 {
-PORTNOTE("other", "Disabled Colour Dropdown")
-#ifndef EXCLUDE_FROM_XARALX
 	if (pColourDropDown == NULL || Index < 0)
 		return FALSE;
  
@@ -797,7 +787,6 @@
 //		pLayer->SetGuideColour(pNewColour);
 //		LayerSGallery::ForceRedrawLayer(pDocument,pLayer);
 	}
-#endif
 	return TRUE;
 }
 
@@ -1010,12 +999,9 @@
 TRACEUSER( "Neville", _T("GuidesPropertiesTab::InitSection
"));
 	ERROR2IF(pPropertiesDlg == NULL,FALSE,"GuidesPropertiesTab::InitSection called with no dialog pointer");
 
-PORTNOTE("other", "Disabled colour dropdown")
-#ifndef EXCLUDE_FROM_XARALX
 	pColourDropDown = new ColourDropDown;
 	if (pColourDropDown != NULL)
 		pColourDropDown->Init(pPropertiesDlg->GetReadWriteWindowID(),_R(IDC_GUIDETAB_COLOURLIST));
-#endif
 
 	ShowDetails();
 
Index: Trunk/XaraLX/wxXtra/combo.cpp
===================================================================
--- Trunk/XaraLX/wxXtra/combo.cpp	(revision 1036)
+++ Trunk/XaraLX/wxXtra/combo.cpp	(revision 1037)
@@ -369,18 +369,24 @@
     return wxSize(minWidth,prefHeight);
 }
 
-void wxComboPopup::PaintComboControl( wxDC& dc, const wxRect& rect )
+void wxComboPopup::DefaultPaintComboControl( wxComboControlBase* combo,
+                                             wxDC& dc, const wxRect& rect )
 {
-    if ( m_combo->GetWindowStyle() & wxCB_READONLY ) // ie. no textctrl
+    if ( combo->GetWindowStyle() & wxCB_READONLY ) // ie. no textctrl
     {
-        m_combo->DrawFocusBackground(dc,rect,0);
+        combo->DrawFocusBackground(dc,rect,0);
 
-        dc.DrawText( GetStringValue(),
-                     rect.x + m_combo->GetTextIndent(),
-                     (rect.height-dc.GetCharHeight())/2 + m_combo->m_widthCustomBorder );
+        dc.DrawText( combo->GetValue(),
+                     rect.x + combo->GetTextIndent(),
+                     (rect.height-dc.GetCharHeight())/2 + rect.y );
     }
 }
 
+void wxComboPopup::PaintComboControl( wxDC& dc, const wxRect& rect )
+{
+    DefaultPaintComboControl(m_combo,dc,rect);
+}
+
 void wxComboPopup::OnComboKeyEvent( wxKeyEvent& event )
 {
     event.Skip();
@@ -457,12 +463,12 @@
     if ( m_combo->IsPopupShown() )
     {
         // pass it to the popped up control
-        m_combo->GetPopupControl()->AddPendingEvent(event);
+        m_combo->GetPopupControl()->GetControl()->AddPendingEvent(event);
     }
     else // no popup
     {
         int comboStyle = m_combo->GetWindowStyle();
-        wxComboPopup* popupInterface = m_combo->GetPopup();
+        wxComboPopup* popupInterface = m_combo->GetPopupControl();
 
         if ( !popupInterface )
         {
@@ -482,6 +488,8 @@
                     m_combo->OnButtonClick();
                     return;
                 }
+                else
+                    event.Skip();
             }
             else
                 popupInterface->OnComboKeyEvent(event);
@@ -491,7 +499,6 @@
     }
 }
 
-
 void wxComboBoxExtraInputHandler::OnFocus(wxFocusEvent& event)
 {
     // FIXME: This code does run when control is clicked,
@@ -504,6 +511,18 @@
             m_combo->SetSelection(-1,-1);
     }
 
+    if ( event.GetId() != m_combo->GetId() )
+    {
+        // Add textctrl set focus events as combo set focus events
+        // NOTE: Simply changing the event and skipping didn't seem
+        // to do the trick.
+        wxFocusEvent evt2(wxEVT_SET_FOCUS,m_combo->GetId());
+        evt2.SetEventObject(m_combo);
+        m_combo->GetEventHandler()->ProcessEvent(evt2);
+    }
+    else
+        event.Skip();
+
     event.Skip();
 }
 
@@ -526,7 +545,7 @@
 
     void OnMouseEvent( wxMouseEvent& event );
 
-    // Called from wxPGComboControlBase::OnPopupDismiss
+    // Called from wxComboControlBase::OnPopupDismiss
     void OnPopupDismiss()
     {
         m_beenInside = false;
@@ -535,7 +554,7 @@
 protected:
     wxComboControlBase*     m_combo;
 
-    bool                            m_beenInside;
+    bool                    m_beenInside;
 
 private:
     DECLARE_EVENT_TABLE()
@@ -550,7 +569,7 @@
 void wxComboPopupExtraEventHandler::OnMouseEvent( wxMouseEvent& event )
 {
     wxPoint pt = event.GetPosition();
-    wxSize sz = m_combo->GetPopupControl()->GetClientSize();
+    wxSize sz = m_combo->GetPopupControl()->GetControl()->GetClientSize();
     int evtType = event.GetEventType();
     bool isInside = pt.x >= 0 && pt.y >= 0 && pt.x < sz.x && pt.y < sz.y;
 
@@ -716,7 +735,7 @@
                                 // processed by looking at ancestors to see if they have
                                 // wxTAB_TRAVERSAL. The navigation event is then sent to
                                 // the wrong window.
-                                wxTE_PROCESS_TAB | wxTE_PROCESS_ENTER |
+                                wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB |
                                 extraStyle,
                                 validator);
 
@@ -1239,24 +1258,6 @@
 }
 
 
-bool wxComboControlBase::OnDrawListItem( wxDC& WXUNUSED(dc),
-                                         const wxRect& WXUNUSED(rect),
-                                         int WXUNUSED(item),
-                                         int WXUNUSED(flags) )
-{
-    return false; // signals caller to make default drawing
-}
-
-wxCoord wxComboControlBase::OnMeasureListItem( int WXUNUSED(item) )
-{
-    return -1; // signals caller to use default
-}
-
-wxCoord wxComboControlBase::OnMeasureListItemWidth( int WXUNUSED(item) )
-{
-    return -1; // signals caller to use default
-}
-
 // ----------------------------------------------------------------------------
 // miscellaneous event handlers
 // ----------------------------------------------------------------------------
@@ -1519,9 +1520,14 @@
 
 void wxComboControlBase::SetPopupControl( wxComboPopup* iface )
 {
+    wxCHECK_RET( iface, wxT("no popup interface set for wxComboControl") );
+
     delete m_popupInterface;
     delete m_winPopup;
 
+    iface->InitBase(this);
+    iface->Init();
+
     m_popupInterface = iface;
 
     if ( !iface->LazyCreate() || m_winPopup )
@@ -1533,10 +1539,19 @@
         m_popup = (wxWindow*) NULL;
     }
 
-    // This must be after creation
-    if ( m_valueString )
+    // This must be done after creation
+    if ( m_valueString.length() )
+    {
         iface->SetStringValue(m_valueString);
+        //Refresh();
+    }
+}
 
+// Ensures there is atleast the default popup
+void wxComboControlBase::EnsurePopupControl()
+{
+    if ( !m_popupInterface )
+        SetPopupControl(NULL);
 }
 
 void wxComboControlBase::OnButtonClick()
@@ -1548,7 +1563,7 @@
 
 void wxComboControlBase::ShowPopup()
 {
-    wxCHECK_RET( m_popupInterface, wxT("no popup interface set for wxComboControl") );
+    EnsurePopupControl();
     wxCHECK_RET( !IsPopupShown(), wxT("popup window already shown") );
 
     SetFocus();
@@ -1663,7 +1678,6 @@
     else
     {
         // This is neede since focus/selection indication may change when popup is shown
-        // FIXME: But in that case, would m_isPopupShown need to go before this?
         Refresh();
     }
 
@@ -1859,13 +1873,25 @@
             m_text->SelectAll();
     }
 
+    m_valueString = value;
+
+    Refresh();
+
     // Since wxComboPopup may want to paint the combo as well, we need
     // to set the string value here (as well as sometimes in ShowPopup).
     if ( m_valueString != value && m_popupInterface )
     {
         m_popupInterface->SetStringValue(value);
     }
+}
 
+// In this SetValue variant wxComboPopup::SetStringValue is not called
+void wxComboControlBase::SetText(const wxString& value)
+{
+    // Unlike in SetValue(), this must be called here or
+    // the behaviour will no be consistent in readonlys.
+    EnsurePopupControl();
+
     m_valueString = value;
 
     Refresh();
Index: Trunk/XaraLX/wxXtra/combo.h
===================================================================
--- Trunk/XaraLX/wxXtra/combo.h	(revision 1036)
+++ Trunk/XaraLX/wxXtra/combo.h	(revision 1037)
@@ -64,7 +64,7 @@
     wxCC_ALT_KEYS                   = 0x0200,
 
     // Dropbutton acts like standard push button.
-    wxCC_STD_BUTTON                 = 0x0400,
+    wxCC_STD_BUTTON                 = 0x0400
 };
 
 
@@ -88,14 +88,14 @@
     // Internal use: SetTextIndent has been called
     wxCC_IFLAG_INDENT_SET           = 0x0400,
     // Internal use: Set wxTAB_TRAVERSAL to parent when popup is dismissed
-    wxCC_IFLAG_PARENT_TAB_TRAVERSAL = 0x0800,
+    wxCC_IFLAG_PARENT_TAB_TRAVERSAL = 0x0800
 };
 
 
 // Flags used by PreprocessMouseEvent and HandleButtonMouseEvent
 enum
 {
-    wxCC_MF_ON_BUTTON               =   0x0001, // cursor is on dropbutton area
+    wxCC_MF_ON_BUTTON               =   0x0001 // cursor is on dropbutton area
 };
 
 
@@ -122,7 +122,7 @@
         All                 = MovableButton|BitmapButton|
                               ButtonSpacing|TextIndent|
                               PaintControl|PaintWritable|
-                              Borderless,
+                              Borderless
     };
 };
 
@@ -156,17 +156,15 @@
     bool IsPopupShown() const { return m_isPopupShown; }
 
     // set interface class instance derived from wxComboPopup
-    void SetPopupControl( wxComboPopup* iface );
+    // NULL popup can be used to indicate default in a derived class
+    virtual void SetPopupControl( wxComboPopup* popup );
 
     // get interface class instance derived from wxComboPopup
-    wxComboPopup* GetPopup() const { return m_popupInterface; }
+    wxComboPopup* GetPopupControl() const { return m_popupInterface; }
 
     // get the popup window containing the popup control
     wxWindow *GetPopupWindow() const { return m_winPopup; }
 
-    // get the popup control/panel in window
-    wxWindow *GetPopupControl() const { return m_popup; }
-
     // Get the text control which is part of the combobox.
     wxTextCtrl *GetTextCtrl() const { return m_text; }
 
@@ -178,9 +176,6 @@
     virtual bool Enable(bool enable = true);
     virtual bool Show(bool show = true);
     virtual bool SetFont(const wxFont& font);
-#if wxUSE_TOOLTIPS
-    virtual void DoSetToolTip( wxToolTip *tip );
-#endif
 
     // wxTextCtrl methods - for readonly combo they should return
     // without errors.
@@ -196,9 +191,12 @@
     virtual void Replace(long from, long to, const wxString& value);
     virtual void Remove(long from, long to);
     virtual void SetSelection(long from, long to);
-    virtual void SetSelection(long sel) {SetSelection(sel, sel);}
     virtual void Undo();
 
+    // This method sets the text without affecting list selection
+    // (ie. wxComboPopup::SetStringValue doesn't get called).
+    void SetText(const wxString& value);
+
     //
     // Popup customization methods
     //
@@ -254,23 +252,25 @@
     //   spacingX: empty space on sides of the button. Default is 0.
     // Remarks:
     //   There is no spacingY - the button will be centered vertically.
-    void SetButtonPosition( int width = 0, int height = 0, int side = wxRIGHT,
-                            int spacingX = 0 /*, int spacingY = 0*/ );
+    void SetButtonPosition( int width = 0,
+                            int height = 0,
+                            int side = wxRIGHT,
+                            int spacingX = 0 );
 
 
     //
     // Sets dropbutton to be drawn with custom bitmaps.
     //
     //  bmpNormal: drawn when cursor is not on button
-    //  blankButtonBg: Draw blank button background below the image.
-    //                 NOTE! This is only properly supported on platforms with appropriate
-    //                       method in wxRendererNative.
+    //  pushButtonBg: Draw push button background below the image.
+    //                NOTE! This is usually only properly supported on platforms with appropriate
+    //                      method in wxRendererNative.
     //  bmpPressed: drawn when button is depressed
     //  bmpHover: drawn when cursor hovers on button. This is ignored on platforms
     //            that do not generally display hover differently.
     //  bmpDisabled: drawn when combobox is disabled.
     void SetButtonBitmaps( const wxBitmap& bmpNormal,
-                           bool blankButtonBg = false,
+                           bool pushButtonBg = false,
                            const wxBitmap& bmpPressed = wxNullBitmap,
                            const wxBitmap& bmpHover = wxNullBitmap,
                            const wxBitmap& bmpDisabled = wxNullBitmap );
@@ -303,7 +303,7 @@
     //                                wxCONTROL_DISABLED: control/item is disabled
     virtual void DrawFocusBackground( wxDC& dc, const wxRect& rect, int flags );
 
-    // Returns true if focus indicator should be drawn.
+    // Returns true if focus indicator should be drawn in the control.
     bool ShouldDrawFocus() const
     {
         const wxWindow* curFocus = FindFocus();
@@ -324,25 +324,6 @@
     // Return true if Create has finished
     bool IsCreated() const { return m_iFlags & wxCC_IFLAG_CREATED ? true : false; }
 
-    // Popup may use these as callbacks to measure and draw list items.
-    // (wxOwnerDrawnComboBox uses these, obviously)
-    // item: -1 means item is the combo control itself
-    // flags: wxCC_PAINTING_CONTROL is set if painting to combo control instead of list
-    // return value: OnDrawListItem must return true if it did anything
-    virtual bool OnDrawListItem( wxDC& dc, const wxRect& rect, int item, int flags );
-
-    // Return item height, or -1 for text height (default)
-    virtual wxCoord OnMeasureListItem( int item );
-
-    // Return item width, or -1 for calculating from text extent (default)
-    virtual wxCoord OnMeasureListItemWidth( int item );
-
-    // NOTE:
-    // I basicly needed to add callback methods into wxComboControlBase - otherwise it
-    // will not be easily possible to use wxVListBoxComboPopup from simultaneously existing
-    // wxComboControl and wxGenericComboControl (since some native implementations
-    // might not have all the features, I really would like to have this options).
-
     // common code to be called on popup hide/dismiss
     void OnPopupDismiss();
 
@@ -395,6 +376,9 @@
     virtual void DoMoveWindow(int x, int y, int width, int height);
     virtual wxSize DoGetBestSize() const;
 
+    // ensures there is atleast the default popup
+    void EnsurePopupControl();
+
     // Recalculates button and textctrl areas. Called when size or button setup change.
     //   btnWidth: default/calculated width of the dropbutton. 0 means unchanged,
     //             just recalculate.
@@ -416,6 +400,10 @@
     // Dispatches size event and refreshes
     void RecalcAndRefresh();
 
+#if wxUSE_TOOLTIPS
+    virtual void DoSetToolTip( wxToolTip *tip );
+#endif
+
     // Used by OnPaints of derived classes
     wxBitmap& GetBufferBitmap(const wxSize& sz) const;
 
@@ -433,7 +421,7 @@
     wxWindow*               m_popup;
 
     // popup interface
-    wxComboPopup*         m_popupInterface;
+    wxComboPopup*           m_popupInterface;
 
     // this is for this control itself
     wxEvtHandler*           m_extraEvtHandler;
@@ -534,7 +522,7 @@
 // wxComboPopup internal flags
 enum
 {
-    wxCP_IFLAG_CREATED      = 0x0001, // Set by wxComboControlBase after Create is called
+    wxCP_IFLAG_CREATED      = 0x0001 // Set by wxComboControlBase after Create is called
 };
 
 
@@ -542,12 +530,18 @@
 {
     friend class wxComboControlBase;
 public:
-    wxComboPopup(wxComboControlBase *combo)
+    wxComboPopup()
     {
-        m_combo = combo;
+        m_combo = (wxComboControlBase*) NULL;
         m_iFlags = 0;
     }
 
+    // This is called immediately after construction finishes. m_combo member
+    // variable has been initialized before the call.
+    // NOTE: It is not in constructor so the derived class doesn't need to redefine
+    //       a default constructor of its own.
+    virtual void Init() { };
+
     virtual ~wxComboPopup();
 
     // Create the popup child control.
@@ -608,9 +602,21 @@
         return (m_iFlags & wxCP_IFLAG_CREATED) ? true : false;
     }
 
+    // Default PaintComboControl behaviour
+    static void DefaultPaintComboControl( wxComboControlBase* combo,
+                                          wxDC& dc,
+                                          const wxRect& rect );
+
 protected:
     wxComboControlBase* m_combo;
     wxUint32            m_iFlags;
+
+private:
+    // Called in wxComboControlBase::SetPopupControl
+    void InitBase(wxComboControlBase *combo)
+    {
+        m_combo = combo;
+    }
 };
 
 
Index: Trunk/XaraLX/wxXtra/combog.cpp
===================================================================
--- Trunk/XaraLX/wxXtra/combog.cpp	(revision 1036)
+++ Trunk/XaraLX/wxXtra/combog.cpp	(revision 1037)
@@ -251,7 +251,7 @@
         DrawButton(dc,rectb,true);
 
     // paint required portion on the control
-    if ( !m_text || m_widthCustomPaint )
+    if ( (!m_text || m_widthCustomPaint) )
     {
         wxASSERT( m_widthCustomPaint >= 0 );
 
@@ -263,7 +263,10 @@
         dc.SetFont( GetFont() );
 
         dc.SetClippingRegion(rect);
-        m_popupInterface->PaintComboControl(dc,rect);
+        if ( m_popupInterface )
+            m_popupInterface->PaintComboControl(dc,rect);
+        else
+            wxComboPopup::DefaultPaintComboControl(this,dc,rect);
     }
 }
 
@@ -277,7 +280,14 @@
     if ( PreprocessMouseEvent(event,handlerFlags) )
         return;
 
-    if ( (m_windowStyle & (wxCC_SPECIAL_DCLICK|wxCB_READONLY)) == wxCB_READONLY )
+#ifdef __WXMSW__
+    const bool ctrlIsButton = true;
+#else
+    const bool ctrlIsButton = false;
+#endif
+
+    if ( ctrlIsButton &&
+         (m_windowStyle & (wxCC_SPECIAL_DCLICK|wxCB_READONLY)) == wxCB_READONLY )
     {
         // if no textctrl and no special double-click, then the entire control acts
         // as a button
@@ -401,7 +411,7 @@
                         GetName());
 
         if (selection != -1)
-            control->SetSelection(selection);
+            control->SetSelection(selection, selection);
 
         SetupWindow(control);
 
Index: Trunk/XaraLX/wxXtra/odcombo.cpp
===================================================================
--- Trunk/XaraLX/wxXtra/odcombo.cpp	(revision 1036)
+++ Trunk/XaraLX/wxXtra/odcombo.cpp	(revision 1037)
@@ -48,9 +48,9 @@
 END_EVENT_TABLE()
 
 
-wxVListBoxComboPopup::wxVListBoxComboPopup(wxComboControlBase* combo)
-                                           : wxVListBox(),
-                                             wxComboPopup(combo)
+void wxVListBoxComboPopup::Init()
+/*                                           : wxVListBox(),
+                                             wxComboPopup(combo)*/
 {
     m_widestWidth = 0;
     m_avgCharWidth = 0;
@@ -70,8 +70,7 @@
                              wxBORDER_SIMPLE | wxLB_INT_HEIGHT | wxWANTS_CHARS) )
         return false;
 
-    wxASSERT( GetParent()->GetParent() );
-    SetFont( GetParent()->GetParent()->GetFont() );
+    m_useFont = m_combo->GetFont();
 
     wxVListBox::SetItemCount(m_strings.GetCount());
 
@@ -102,8 +101,8 @@
         m_combo->DrawFocusBackground(dc,rect,0);
         if ( m_value >= 0 )
         {
-            if ( m_combo->OnDrawListItem(dc,rect,m_value,wxCC_PAINTING_CONTROL) )
-                return;
+            OnDrawItem(dc,rect,m_value,wxCP_PAINTING_CONTROL);
+            return;
         }
     }
 
@@ -112,29 +111,32 @@
 
 void wxVListBoxComboPopup::OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const
 {
-    dc.SetFont( m_font );
+    // TODO: Maybe this code could be moved to wxVListBox::OnPaint?
+    dc.SetFont(m_useFont);
 
-    bool isHilited = GetSelection() == (int) n;
-
     // Set correct text colour for selected items
-    // (must always set the correct colour - atleast GTK may have lost it
-    // in between calls).
-    if ( isHilited )
+    if ( wxVListBox::GetSelection() == (int) n )
         dc.SetTextForeground( wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT) );
     else
         dc.SetTextForeground( wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT) );
 
-    if ( !m_combo->OnDrawListItem(dc,rect,(int)n,0) )
-        dc.DrawText( GetString(n), rect.x + 2, rect.y );
+    OnDrawItem(dc,rect,(int)n,0);
 }
 
-wxCoord wxVListBoxComboPopup::OnMeasureItem(size_t n) const
+wxCoord wxVListBoxComboPopup::OnMeasureItem(size_t WXUNUSED(n)) const
 {
+    /*
     int itemHeight = m_combo->OnMeasureListItem(n);
     if ( itemHeight < 0 )
         itemHeight = m_itemHeight;
+    */
+    return m_itemHeight;
+}
 
-    return itemHeight;
+wxCoord wxVListBoxComboPopup::OnMeasureItemWidth(size_t WXUNUSED(n)) const
+{
+    //return OnMeasureListItemWidth(n);
+    return -1;
 }
 
 void wxVListBoxComboPopup::OnDrawBackground(wxDC& dc, const wxRect& rect, size_t n) const
@@ -147,12 +149,47 @@
     //else: do nothing for the normal items
 }
 
-void wxVListBoxComboPopup::SendComboBoxEvent()
+// This is called from wxVListBoxComboPopup::OnDrawItem, with text colour and font prepared
+void wxVListBoxComboPopup::OnDrawItem( wxDC& dc, const wxRect& rect, int item, int flags ) const
 {
+    if ( flags & wxCP_PAINTING_CONTROL )
+    {
+        dc.DrawText( m_combo->GetValue(),
+                     rect.x + m_combo->GetTextIndent(),
+                     (rect.height-dc.GetCharHeight())/2 + rect.y );
+    }
+    else
+    {
+        dc.DrawText( GetString(item), rect.x + 2, rect.y );
+    }
+}
+
+void wxVListBoxComboPopup::DismissWithEvent()
+{
+    int selection = wxVListBox::GetSelection();
+
+    Dismiss();
+
+    wxString valStr;
+    if ( selection != wxNOT_FOUND )
+        valStr = m_strings[selection];
+    else
+        valStr = wxEmptyString;
+
+    m_value = selection;
+
+    if ( valStr != m_combo->GetValue() )
+        m_combo->SetValue(valStr);
+
+    SendComboBoxEvent(selection);
+}
+
+void wxVListBoxComboPopup::SendComboBoxEvent( int selection )
+{
     wxCommandEvent evt(wxEVT_COMMAND_COMBOBOX_SELECTED,m_combo->GetId());
-    int selection = m_value;
 
     evt.SetEventObject(m_combo);
+
     evt.SetInt(selection);
 
     // Set client data, if any
@@ -225,11 +262,10 @@
 
     m_value = value;
 
-    wxString valStr;
     if ( value >= 0 )
         m_combo->SetValue(m_strings[value]);
 
-    SendComboBoxEvent();
+    SendComboBoxEvent(m_value);
 
     return true;
 }
@@ -268,9 +304,7 @@
 
 void wxVListBoxComboPopup::OnLeftClick(wxMouseEvent& WXUNUSED(event))
 {
-    m_value = wxVListBox::GetSelection();
-    Dismiss();
-    SendComboBoxEvent();
+    DismissWithEvent();
 }
 
 void wxVListBoxComboPopup::OnKey(wxKeyEvent& event)
@@ -278,9 +312,7 @@
     // Select item if ENTER is pressed
     if ( event.GetKeyCode() == WXK_RETURN || event.GetKeyCode() == WXK_NUMPAD_ENTER )
     {
-        m_value = wxVListBox::GetSelection();
-        Dismiss();
-        SendComboBoxEvent();
+        DismissWithEvent();
     }
     // Hide popup if ESC is pressed
     else if ( event.GetKeyCode() == WXK_ESCAPE )
@@ -291,15 +323,15 @@
 
 void wxVListBoxComboPopup::CheckWidth( int pos )
 {
-    wxCoord x = m_combo->OnMeasureListItemWidth(pos);
+    wxCoord x = OnMeasureItemWidth(pos);
 
     if ( x < 0 )
     {
-        if ( !m_font.Ok() )
-            m_font = m_combo->GetFont();
+        if ( !m_useFont.Ok() )
+            m_useFont = m_combo->GetFont();
 
         wxCoord y;
-        m_combo->GetTextExtent(m_strings[pos], &x, &y, 0, 0, &m_font);
+        m_combo->GetTextExtent(m_strings[pos], &x, &y, 0, 0, &m_useFont);
         x += 4;
     }
 
@@ -315,7 +347,9 @@
     wxString strValue;
     if ( !(m_combo->GetWindowStyle() & wxCB_READONLY) &&
          m_combo->GetValue() == item )
+    {
         m_value = pos;
+    }
 
     m_strings.Insert(item,pos);
 
@@ -389,7 +423,7 @@
 
 void* wxVListBoxComboPopup::GetItemClientData(int n) const
 {
-    if ( m_clientDatas.GetCount() > (unsigned int)n )
+    if ( (int)m_clientDatas.GetCount() > n )
         return m_clientDatas[n];
 
     return NULL;
@@ -451,6 +485,11 @@
         wxVListBox::SetSelection(item);
 }
 
+int wxVListBoxComboPopup::GetSelection() const
+{
+    return m_value;
+}
+
 void wxVListBoxComboPopup::SetStringValue( const wxString& value )
 {
     int index = m_strings.Index(value);
@@ -497,13 +536,16 @@
                   height+2);
 }
 
-void wxVListBoxComboPopup::Populate( int n, const wxString choices[] )
+//void wxVListBoxComboPopup::Populate( int n, const wxString choices[] )
+void wxVListBoxComboPopup::Populate( const wxArrayString& choices )
 {
     int i;
 
+    int n = choices.GetCount();
+
     for ( i=0; i<n; i++ )
     {
-        const wxString& item = choices[i];
+        const wxString& item = choices.Item(i);
         m_strings.Add(item);
         CheckWidth(i);
     }
@@ -534,6 +576,7 @@
 
 void wxOwnerDrawnComboBox::Init()
 {
+    m_popupInterface = NULL;
 }
 
 bool wxOwnerDrawnComboBox::Create(wxWindow *parent,
@@ -559,7 +602,6 @@
                                            const wxString& name)
     : wxComboControl()
 {
-    m_popupInterface=NULL;
     Init();
 
     Create(parent,id,value,pos,size,choices,style, validator, name);
@@ -575,10 +617,13 @@
                                   const wxValidator& validator,
                                   const wxString& name)
 {
-    wxCArrayString chs(choices);
+    m_initChs = choices;
+    //wxCArrayString chs(choices);
 
-    return Create(parent, id, value, pos, size, chs.GetCount(),
-                  chs.GetStrings(), style, validator, name);
+    //return Create(parent, id, value, pos, size, chs.GetCount(),
+    //              chs.GetStrings(), style, validator, name);
+    return Create(parent, id, value, pos, size, 0,
+                  NULL, style, validator, name);
 }
 
 bool wxOwnerDrawnComboBox::Create(wxWindow *parent,
@@ -599,15 +644,10 @@
         return false;
     }
 
-    wxVListBoxComboPopup* iface = new wxVListBoxComboPopup(this);
-    SetPopupControl(iface);
+    int i;
+    for ( i=0; i<n; i++ )
+        m_initChs.Add(choices[i]);
 
-    // m_popupInterface has been overridden as wxVListBoxComboPopup
-    m_popupInterface = iface;
-
-    // Add initial choices to the wxVListBox
-    iface->Populate(n,choices);
-
     return true;
 }
 
@@ -617,13 +657,34 @@
         m_popupInterface->ClearClientDatas();
 }
 
+void wxOwnerDrawnComboBox::SetPopupControl( wxComboPopup* popup )
+{
+    if ( !popup )
+    {
+        popup = new wxVListBoxComboPopup();
+    }
+
+    wxComboControl::SetPopupControl(popup);
+
+    wxASSERT(popup);
+    m_popupInterface = (wxVListBoxComboPopup*) popup;
+
+    // Add initial choices to the wxVListBox
+    if ( !m_popupInterface->GetCount() )
+    {
+        //m_popupInterface->Populate(m_initChs.GetCount(),m_initChs.GetStrings());
+        m_popupInterface->Populate(m_initChs);
+        m_initChs.Clear();
+    }
+}
+
 // ----------------------------------------------------------------------------
 // wxOwnerDrawnComboBox item manipulation methods
 // ----------------------------------------------------------------------------
 
 void wxOwnerDrawnComboBox::Clear()
 {
-    wxASSERT( m_popupInterface );
+    EnsurePopupControl();
 
     m_popupInterface->Clear();
 
@@ -642,7 +703,7 @@
 
 int wxOwnerDrawnComboBox::GetCount() const
 {
-    wxASSERT( m_popupInterface );
+    wxASSERT_MSG( m_popupInterface, wxT("no popup interface") );
     return m_popupInterface->GetCount();
 }
 
@@ -660,14 +721,14 @@
 
 int wxOwnerDrawnComboBox::FindString(const wxString& s) const
 {
-    wxASSERT( m_popupInterface );
+    wxASSERT_MSG( m_popupInterface, wxT("no popup interface") );
     return m_popupInterface->FindString(s);
 }
 
 void wxOwnerDrawnComboBox::Select(int n)
 {
-    wxCHECK_RET( (n >= -1) && (n < GetCount()), _T("invalid index in wxOwnerDrawnComboBox::Select") );
-    wxASSERT( m_popupInterface );
+    wxCHECK_RET( (n >= -1) && (n < (int)GetCount()), _T("invalid index in wxOwnerDrawnComboBox::Select") );
+    EnsurePopupControl();
 
     m_popupInterface->SetSelection(n);
 
@@ -776,6 +837,8 @@
                         wxDefaultValidator,
                         GetName());
 
+        control->SetPopupControl(NULL);
+
         if (selection != -1)
             control->SetSelection(selection);
 
Index: Trunk/XaraLX/wxXtra/odcombo.h
===================================================================
--- Trunk/XaraLX/wxXtra/odcombo.h	(revision 1036)
+++ Trunk/XaraLX/wxXtra/odcombo.h	(revision 1037)
@@ -50,7 +50,7 @@
 {
     // when set, we are painting the selected item in control,
     // not in the popup
-    wxCC_PAINTING_CONTROL       = 0x0001
+    wxCP_PAINTING_CONTROL           = 0x0001
 };
 
 
@@ -71,11 +71,12 @@
     friend class wxOwnerDrawnComboBox;
 public:
 
-    // ctor and dtor
-    wxVListBoxComboPopup(wxComboControlBase* combo);
+    // init and dtor
+    wxVListBoxComboPopup() : wxVListBox(), wxComboPopup() { }
     virtual ~wxVListBoxComboPopup();
 
     // required virtuals
+    virtual void Init();
     virtual bool Create(wxWindow* parent);
     virtual wxWindow *GetControl() { return this; }
     virtual void SetStringValue( const wxString& value );
@@ -89,20 +90,33 @@
     virtual void OnComboDoubleClick();
     virtual bool LazyCreate();
 
+    // Callbacks for drawing and measuring items. Override in a derived class for
+    // owner-drawnness.
+    // item: item index to be drawn, may be wxNOT_FOUND when painting combo control itself
+    //       and there is no valid selection
+    // flags: wxCP_PAINTING_CONTROL is set if painting to combo control instead of list
+    virtual void OnDrawItem( wxDC& dc, const wxRect& rect, int item, int flags ) const;
+
+    // Return item width, or -1 for calculating from text extent (default)
+    virtual wxCoord OnMeasureItemWidth( size_t item ) const;
+
+
     // Item management
     void SetSelection( int item );
     void Insert( const wxString& item, int pos );
     int Append(const wxString& item);
     void Clear();
     void Delete( int item );
-    void SetItemClientData(int n, void* clientData, wxClientDataType clientDataItemsType);
-    void *GetItemClientData(int n) const;
+    void SetItemClientData( int n, void* clientData, wxClientDataType clientDataItemsType);
+    void *GetItemClientData( int n) const;
     void SetString( int item, const wxString& str );
     wxString GetString( int item ) const;
     int GetCount() const;
     int FindString(const wxString& s) const;
+    int GetSelection() const;
 
-    void Populate( int n, const wxString choices[] );
+    //void Populate( int n, const wxString choices[] );
+    void Populate( const wxArrayString& choices );
     void ClearClientDatas();
 
     // helpers
@@ -116,16 +130,22 @@
     bool HandleKey( int keycode, bool saturate );
 
     // sends combobox select event from the parent combo control
-    void SendComboBoxEvent();
+    void SendComboBoxEvent( int selection );
+    
+    // gets value, sends event and dismisses
+    void DismissWithEvent();
 
     // Re-calculates width for given item
     void CheckWidth( int pos );
 
     // wxVListBox implementation
     virtual void OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const;
-    virtual wxCoord OnMeasureItem(size_t n) const;
+    //virtual wxCoord OnMeasureItem(size_t n) const;
     void OnDrawBackground(wxDC& dc, const wxRect& rect, size_t n) const;
 
+    // Return item height
+    virtual wxCoord OnMeasureItem( size_t item ) const;
+
     // filter mouse move events happening outside the list box
     // move selection with cursor
     void OnMouseMove(wxMouseEvent& event);
@@ -137,8 +157,9 @@
     wxArrayPtrVoid          m_clientDatas;
     wxArrayInt              m_widths; // cached line widths
 
-    wxFont                  m_font;
+    wxFont                  m_useFont;
 
+    //wxString                m_stringValue; // displayed text (may be different than m_strings[m_value])
     int                     m_value; // selection
     int                     m_itemHover; // on which item the cursor is
     int                     m_widestWidth; // width of widest item thus far
@@ -232,6 +253,9 @@
 
     virtual ~wxOwnerDrawnComboBox();
 
+    // NULL popup can be used to indicate default interface
+    virtual void SetPopupControl( wxComboPopup* popup );
+
     // wxControlWithItems methods
     virtual void Clear();
     virtual void Delete(int n);
@@ -260,6 +284,11 @@
     // overload m_popupInterface member so we can access specific popup interface easier
     wxVListBoxComboPopup*   m_popupInterface;
 
+    // temporary storage for the initial choices
+    //const wxString*         m_baseChoices;
+    //int                     m_baseChoicesCount;
+    wxArrayString           m_initChs;
+
 private:
     void Init();
 
Index: Trunk/XaraLX/wxOil/Makefile.am
===================================================================
--- Trunk/XaraLX/wxOil/Makefile.am	(revision 1036)
+++ Trunk/XaraLX/wxOil/Makefile.am	(revision 1037)
@@ -43,7 +43,7 @@
 	drawctl.cpp filedlgs.cpp fileutil.cpp ktimer.cpp camplatform.cpp \
 	outptdib.cpp outptpng.cpp outptgif.cpp gpalopt.cpp bmpfiltr.cpp giffiltr.cpp \
 	fontbase.cpp ftfonts.cpp textfuns.cpp dragbmp.cpp xpoilflt.cpp xmlutils.cpp \
-	camprocess.cpp \
+	camprocess.cpp dropdown.cpp coldrop.cpp \
 	binreloc.c \
 	resources.cpp
 
Index: Trunk/XaraLX/wxOil/coldrop.cpp
===================================================================
--- Trunk/XaraLX/wxOil/coldrop.cpp	(revision 1036)
+++ Trunk/XaraLX/wxOil/coldrop.cpp	(revision 1037)
@@ -377,9 +377,7 @@
 			Ptr->ItemColour = *NewColour;
 			
 			// And cause the combobox to redraw
-			HWND hGadget = ::GetDlgItem(ParentDlg, ParentGadget);
-			if (hGadget != NULL)
-				::InvalidateRect(hGadget, NULL, FALSE);
+			DialogManager::InvalidateGadget(ParentDlg, ParentGadget);
 
 			return(TRUE);
 		}
@@ -452,7 +450,7 @@
 
 		while (Ptr != NULL)
 		{
-			AddItem((DWORD) Ptr);
+			AddItem((void *) Ptr);
 			Ptr = SpecialEntries.GetNext(Ptr);
 		}
 
@@ -491,7 +489,7 @@
 			// can safely pass NULL into IsADescendantOf())
 			if (!Ptr->IsDeleted() && Ptr->IsNamed() && !Ptr->IsADescendantOf(NotDescendantOf))
 			{
-				AddItem((DWORD) Ptr);
+				AddItem((void *) Ptr);
 				Result = TRUE;			// We've succeeded in adding at least 1 item
 				if (Ptr == Selected)
 					SelectedIndex = Index;
@@ -616,9 +614,9 @@
 	if (!SpecialEntries.IsEmpty() && SelectionIndex <= (INT32)SpecialEntries.GetCount())
 		return(NULL);
 
-	INT32 Data = GetItemData(SelectionIndex);
-	if (Data == -1)				// If the list is empty, we will get a -1 back, so weed it out
-		return(NULL);
+	void * Data = GetItemData(SelectionIndex);
+//	if (Data == -1)				// If the list is empty, we will get a -1 back, so weed it out
+//		return(NULL);
 
 	// Otherwise, it must be a colour, so fetch the colour pointer...
 	return( (IndexedColour *) Data);
@@ -703,7 +701,7 @@
 
 /********************************************************************************************
 
->	virtual BOOL ColourDropDown::HasIcon(DWORD ItemData)
+>	virtual BOOL ColourDropDown::HasIcon(void * ItemData)
 
 	Author:		Jason_Williams (Xara Group Ltd) <camelotdev@xxxxxxxx>
 	Date:		13/9/95
@@ -726,7 +724,7 @@
 
 ********************************************************************************************/
 
-BOOL ColourDropDown::HasIcon(DWORD ItemData)
+BOOL ColourDropDown::HasIcon(void * ItemData)
 {
 	// All our items have a colour splodge
 	return(TRUE);
@@ -736,14 +734,14 @@
 
 /********************************************************************************************
 
->	virtual BOOL ColourDropDown::DrawIcon(DWORD ItemData, HDC hDC, RECT *IconRect,
+>	virtual BOOL ColourDropDown::DrawIcon(void * ItemData, wxDC& dc, wxRect& IconRect,
 											BOOL Disabled)
 
 	Author:		Jason_Williams (Xara Group Ltd) <camelotdev@xxxxxxxx>
 	Date:		13/9/95
 
 	Inputs:		ItemData - Your item data
-				hDC - The DC to render into
+				dc - The DC to render into
 				IconRect - points at a rectangle (square in fact) to be drawn within
 				Disabled - TRUE if this item is disabled so the icon should be drawn greyed
 
@@ -764,22 +762,23 @@
 
 ********************************************************************************************/
 
-BOOL ColourDropDown::DrawIcon(DWORD ItemData, HDC hDC, RECT *IconRect, BOOL Disabled)
+BOOL ColourDropDown::DrawIcon(void * ItemData, wxDC& dc, wxRect& IconRect, BOOL Disabled)
 {
-	GDrawBrush.Init(hDC);
+	GDrawBrush.Init(&dc);
 	GDrawBrush.Start();
 
-	LOGBRUSH LogBrush;
-	HGDIOBJ OldPen;
-	DWORD rgb;
+	wxBrush OldBrush=dc.GetBrush();
+	wxPen OldPen=dc.GetPen();
 
+	COLORREF rgb;
+
 	BOOL IsSpotColour = FALSE;
 
 	if (Disabled)
 	{
 		// The item is disabled, so just put a light grey splodge in the place of the colour
 		rgb = RGB(192, 192, 192);
-	 	OldPen = ::SelectObject(hDC, ::GetStockObject(NULL_PEN));
+	 	dc.SetPen(*wxTRANSPARENT_PEN);
 	}
 	else
 	{
@@ -801,34 +800,28 @@
 		else
 			rgb = ConvertColourToScreenWord(CCrgbt, &(((SpecialEntry *)ItemData)->ItemColour));
 
-	 	OldPen = ::SelectObject(hDC, ::GetStockObject(BLACK_PEN));
+	 	dc.SetPen(*wxBLACK_PEN);
 	}
 
+	wxBrush brush;
 	if (GDrawBrush.Available())
-		GDrawBrush.GetLogBrush(rgb, &LogBrush);
+		GDrawBrush.GetLogBrush(rgb, &brush);
 	else
-	{
-		LogBrush.lbStyle = BS_SOLID;
-		LogBrush.lbColor = rgb;
-		LogBrush.lbHatch = 0;
-	}
+		brush=wxBrush(rgb);
 
-	HBRUSH TheBrush  = ::CreateBrushIndirect(&LogBrush);
-	HGDIOBJ OldBrush = ::SelectObject(hDC, TheBrush);
+	dc.SetBrush(brush);
 
 	if (IsSpotColour)
-		::Ellipse(hDC, IconRect->left, IconRect->top, IconRect->right, IconRect->bottom);
+		dc.DrawEllipse(IconRect.GetLeft(), IconRect.GetTop(), IconRect.GetRight(), IconRect.GetBottom());
 	else
-		::Rectangle(hDC, IconRect->left, IconRect->top, IconRect->right, IconRect->bottom);
+		dc.DrawRectangle(IconRect.GetLeft(), IconRect.GetTop(), IconRect.GetRight(), IconRect.GetBottom());
 
-	::SelectObject(hDC, OldBrush);
-	::DeleteObject(TheBrush);
-
- 	::SelectObject(hDC, OldPen);
-
 	// Finish with GBrush
 	GDrawBrush.Stop();
 
+	dc.SetBrush(OldBrush);
+	dc.SetPen(OldPen);
+
 	return(TRUE);
 }
 
@@ -836,15 +829,13 @@
 
 /********************************************************************************************
 
->	virtual BOOL ColourDropDown::DrawText(DWORD ItemData, HDC hDC, RECT *TextRect)
+>	virtual wxString ColourDropDown::GetText(void * ItemData)
 
 	Author:		Jason_Williams (Xara Group Ltd) <camelotdev@xxxxxxxx>
 	Date:		13/9/95
 
 	Inputs:		ItemData - Your item data
-				HDC - the DC to draw into
-				TextRect - points at a rectangle in which the text should be rendered
-
+				
 	Returns:	TRUE if redraw went well
 
 	Purpose:	Draws the text for an item
@@ -863,24 +854,23 @@
 
 ********************************************************************************************/
 
-BOOL ColourDropDown::DrawText(DWORD ItemData, HDC hDC, RECT *TextRect)
+wxString ColourDropDown::GetText(void * ItemData)
 {
-	ERROR3IF(ItemData == NULL || TextRect == NULL, "NULL Itemdata/TextRect in ColourDropDown::DrawText");
+	ERROR3IF(ItemData == NULL, "NULL Itemdata in ColourDropDown::DrawText");
 
 	// Determine if it's a colour or a special item, and find the text to draw
-	LPCTSTR TextToDraw = NULL;
+	TCHAR * TextToDraw = NULL;
 
 	CCObject *Item = (CCObject *) ItemData;
 	if (Item->IsKindOf(CC_RUNTIME_CLASS(IndexedColour)))
-		TextToDraw = (LPCTSTR) ( (TCHAR *) (*((IndexedColour *)ItemData)->GetName()) );
+		TextToDraw = ( (TCHAR *) (*((IndexedColour *)ItemData)->GetName()) );
 	else
-		TextToDraw = (LPCTSTR) ( (TCHAR *) ((SpecialEntry *)ItemData)->ItemText );
+		TextToDraw = ( (TCHAR *) ((SpecialEntry *)ItemData)->ItemText );
 
-	// Draw the text...
-	if (TextToDraw != NULL)
-		::DrawText(hDC, TextToDraw, -1, TextRect, DT_LEFT | DT_VCENTER);
-
-	return(TRUE);
+	if (TextToDraw)
+		return wxString(TextToDraw);
+	else
+		return wxEmptyString;
 }
 
 
@@ -929,18 +919,20 @@
 		ColourChangingMsg *Msg = (ColourChangingMsg *) Message;
 		switch ( Msg->State )
 		{
-			case ColourChangingMsg::ColourState::LISTDESELECTED:
-//			case ColourChangingMsg::ColourState::LISTPAGED:
-//			case ColourChangingMsg::ColourState::LISTUPDATED:
-//			case ColourChangingMsg::ColourState::COLOURUPDATED:
+			case ColourChangingMsg::LISTDESELECTED:
+//			case ColourChangingMsg::LISTPAGED:
+//			case ColourChangingMsg::LISTUPDATED:
+//			case ColourChangingMsg::COLOURUPDATED:
 				ColourDropDown::UpdateForNewColourList();
 				break;
 
-			case ColourChangingMsg::ColourState::SELVIEWCONTEXTCHANGE:
+			case ColourChangingMsg::SELVIEWCONTEXTCHANGE:
 				// The colour context for the selected view has chnaged, so we must immediately
 				// force a redraw to make sure we show the colours with correction/separation.
 				ColourDropDown::RedrawColourDropDowns();
 				break;
+			default:
+				break;
 		}
 	}
 
Index: Trunk/XaraLX/wxOil/dropdown.h
===================================================================
--- Trunk/XaraLX/wxOil/dropdown.h	(revision 0)
+++ Trunk/XaraLX/wxOil/dropdown.h	(revision 1037)
@@ -0,0 +1,186 @@
+// $Id: wxOil/dropdown.h, 1, 01-Jan-2006, Anonymous $
+/* @@tag:xara-cn@@ DO NOT MODIFY THIS LINE
+================================XARAHEADERSTART===========================
+
+			Xara LX, a vector drawing and manipulation program.
+					Copyright (C) 1993-2006 Xara Group Ltd.
+	Copyright on certain contributions may be held in joint with their
+			respective authors. See AUTHORS file for details.
+
+LICENSE TO USE AND MODIFY SOFTWARE
+----------------------------------
+
+This file is part of Xara LX.
+
+Xara LX is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 2 as published
+by the Free Software Foundation.
+
+Xara LX and its component source files are distributed in the hope
+that it will be useful, but WITHOUT ANY WARRANTY; without even the
+implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with Xara LX (see the file GPL in the root directory of the
+distribution); if not, write to the Free Software Foundation, Inc., 51
+Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+
+
+ADDITIONAL RIGHTS
+-----------------
+
+Conditional upon your continuing compliance with the GNU General Public
+License described above, Xara Group Ltd grants to you certain additional
+rights. 
+
+The additional rights are to use, modify, and distribute the software
+together with the wxWidgets library, the wxXtra library, and the "CDraw"
+library and any other such library that any version of Xara LX relased
+by Xara Group Ltd requires in order to compile and execute, including
+the static linking of that library to XaraLX. In the case of the
+"CDraw" library, you may satisfy obligation under the GNU General Public
+License to provide source code by providing a binary copy of the library
+concerned and a copy of the license accompanying it.
+
+Nothing in this section restricts any of the rights you have under
+the GNU General Public License.
+
+
+SCOPE OF LICENSE
+----------------
+
+This license applies to this program (XaraLX) and its constituent source
+files only, and does not necessarily apply to other Xara products which may
+in part share the same code base, and are subject to their own licensing
+terms.
+
+This license does not apply to files in the wxXtra directory, which
+are built into a separate library, and are subject to the wxWindows
+license contained within that directory in the file "WXXTRA-LICENSE".
+
+This license does not apply to the binary libraries (if any) within
+the "libs" directory, which are subject to a separate license contained
+within that directory in the file "LIBS-LICENSE".
+
+
+ARRANGEMENTS FOR CONTRIBUTION OF MODIFICATIONS
+----------------------------------------------
+
+Subject to the terms of the GNU Public License (see above), you are
+free to do whatever you like with your modifications. However, you may
+(at your option) wish contribute them to Xara's source tree. You can
+find details of how to do this at:
+http://www.xaraxtreme.org/developers/
+
+Prior to contributing your modifications, you will need to complete our
+contributor agreement. This can be found at:
+http://www.xaraxtreme.org/developers/contribute/
+
+Please note that Xara will not accept modifications which modify any of
+the text between the start and end of this header (marked
+XARAHEADERSTART and XARAHEADEREND).
+
+
+MARKS
+-----
+
+Xara, Xara LX, Xara X, Xara X/Xtreme, Xara Xtreme, the Xtreme and Xara
+designs are registered or unregistered trademarks, design-marks, and/or
+service marks of Xara Group Ltd. All rights in these marks are reserved.
+
+
+	Xara Group Ltd, Gaddesden Place, Hemel Hempstead, HP2 6EX, UK.
+						http://www.xara.com/
+
+=================================XARAHEADEREND============================
+*/
+
+// dropdown.h - The Drop-down list base class
+
+#ifndef INC_DROPDOWN
+#define INC_DROPDOWN
+
+#include "dlgtypes.h"
+#include "list.h"
+
+
+class DialogManager;
+class wxCamVListBoxComboPopup;
+
+class DropDown : public ListItem
+{
+friend class DialogManager;
+friend class wxCamVListBoxComboPopup;
+
+CC_DECLARE_DYNCREATE(DropDown)
+
+public:			// Creation/destruction
+	DropDown();
+	virtual ~DropDown();	
+
+	virtual BOOL Init(CWindowID ParentWindow, CGadgetID ParentControl);
+
+protected:
+	static List CurrentDropDowns;					// A list of all currently active dropdowns
+
+
+
+// --- Winoily section
+
+protected:		// Methods that must be overridden by derived classes
+	virtual BOOL HasIcon(void * ItemData);
+				// Returns TRUE if the item has an icon. Default is no icon
+
+	virtual BOOL DrawIcon(void * ItemData, wxDC& dc, wxRect& IconRect, BOOL Disabled);
+				// Handles redraw of the icon, if any. Default is nothing gets drawn
+
+	virtual wxSize DrawText(void * ItemData, wxDC& dc, wxRect& TextRect, INT32 item, BOOL Draw);
+				// Handles redraw of the text for an item. Default draws the text
+				// returned by GetText. You this probably do not need to override this
+
+	virtual wxString GetText(void * ItemData) {return wxEmptyString;}
+				// By default returns a dummy string
+
+
+public:			// Useful methods
+	void ClearList(void);
+				// Clears all items in the list
+
+
+protected:		// Useful methods to call from derived classes
+	void SetListRedraw(BOOL Enable);
+				// Enables/disables redraw of the list (use while adding items)
+
+	void AddItem(void * ItemData);
+				// Adds an item to the end of the list
+
+	void SetSelectedIndex(INT32 SelectedIndex);
+				// Sets the index of the selected item
+
+	void * GetItemData(INT32 ItemIndex);
+				// Retrieves the data associated with a given item
+
+	INT32 GetNumberOfItems(void);
+				// Determines how many items are in the list
+
+	wxOwnerDrawnComboBox * GetBox();
+				// Get a pointer to the combo box
+
+// --- Base class stuff you shouldn't have to mess with
+
+protected:
+	virtual wxSize HandleDrawItemInternal(wxDC& dc, const wxRect& rect, INT32 item, INT32 flags, BOOL Draw);
+				// Draws the item HandleDrawItem
+
+protected:
+	BOOL Initialised;								// TRUE once we have been initialised
+
+	CWindowID ParentDlg;							// CWindowID of the parent window
+	CGadgetID ParentGadget;							// Gadget ID of the combo box
+	wxCamVListBoxComboPopup * m_pPopup;				// Pointer to the popup control
+};
+
+
+#endif
+
Index: Trunk/XaraLX/wxOil/coldrop.h
===================================================================
--- Trunk/XaraLX/wxOil/coldrop.h	(revision 1036)
+++ Trunk/XaraLX/wxOil/coldrop.h	(revision 1037)
@@ -181,16 +181,15 @@
 // --- Winoily section
 
 protected:		// Methods that must be overridden by derived classes
-	virtual BOOL HasIcon(DWORD ItemData);
+	virtual BOOL HasIcon(void * ItemData);
 				// Returns TRUE if the item has an icon. Default is no icon
 
-	virtual BOOL DrawIcon(DWORD ItemData, HDC hDC, RECT *IconRect, BOOL Disabled);
+	virtual BOOL DrawIcon(void * ItemData, wxDC& dc, wxRect& IconRect, BOOL Disabled);
 				// Handles redraw of the icon, if any. Default is nothing gets drawn
 
-	virtual BOOL DrawText(DWORD ItemData, HDC hDC, RECT *TextRect);
-				// Handles redraw of the text for an item. Default draws nothing
+	virtual wxString GetText(void * ItemData);
+				// Gets the text
 
-
 protected:
 	GBrush GDrawBrush;								// A GBrush of our very own
 };
Index: Trunk/XaraLX/wxOil/dropdown.cpp
===================================================================
--- Trunk/XaraLX/wxOil/dropdown.cpp	(revision 0)
+++ Trunk/XaraLX/wxOil/dropdown.cpp	(revision 1037)
@@ -0,0 +1,655 @@
+// $Id: wxOil/dropdown.cpp, 1, 01-Jan-2006, Anonymous $
+/* @@tag:xara-cn@@ DO NOT MODIFY THIS LINE
+================================XARAHEADERSTART===========================
+
+			Xara LX, a vector drawing and manipulation program.
+					Copyright (C) 1993-2006 Xara Group Ltd.
+	Copyright on certain contributions may be held in joint with their
+			respective authors. See AUTHORS file for details.
+
+LICENSE TO USE AND MODIFY SOFTWARE
+----------------------------------
+
+This file is part of Xara LX.
+
+Xara LX is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 2 as published
+by the Free Software Foundation.
+
+Xara LX and its component source files are distributed in the hope
+that it will be useful, but WITHOUT ANY WARRANTY; without even the
+implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with Xara LX (see the file GPL in the root directory of the
+distribution); if not, write to the Free Software Foundation, Inc., 51
+Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+
+
+ADDITIONAL RIGHTS
+-----------------
+
+Conditional upon your continuing compliance with the GNU General Public
+License described above, Xara Group Ltd grants to you certain additional
+rights. 
+
+The additional rights are to use, modify, and distribute the software
+together with the wxWidgets library, the wxXtra library, and the "CDraw"
+library and any other such library that any version of Xara LX relased
+by Xara Group Ltd requires in order to compile and execute, including
+the static linking of that library to XaraLX. In the case of the
+"CDraw" library, you may satisfy obligation under the GNU General Public
+License to provide source code by providing a binary copy of the library
+concerned and a copy of the license accompanying it.
+
+Nothing in this section restricts any of the rights you have under
+the GNU General Public License.
+
+
+SCOPE OF LICENSE
+----------------
+
+This license applies to this program (XaraLX) and its constituent source
+files only, and does not necessarily apply to other Xara products which may
+in part share the same code base, and are subject to their own licensing
+terms.
+
+This license does not apply to files in the wxXtra directory, which
+are built into a separate library, and are subject to the wxWindows
+license contained within that directory in the file "WXXTRA-LICENSE".
+
+This license does not apply to the binary libraries (if any) within
+the "libs" directory, which are subject to a separate license contained
+within that directory in the file "LIBS-LICENSE".
+
+
+ARRANGEMENTS FOR CONTRIBUTION OF MODIFICATIONS
+----------------------------------------------
+
+Subject to the terms of the GNU Public License (see above), you are
+free to do whatever you like with your modifications. However, you may
+(at your option) wish contribute them to Xara's source tree. You can
+find details of how to do this at:
+http://www.xaraxtreme.org/developers/
+
+Prior to contributing your modifications, you will need to complete our
+contributor agreement. This can be found at:
+http://www.xaraxtreme.org/developers/contribute/
+
+Please note that Xara will not accept modifications which modify any of
+the text between the start and end of this header (marked
+XARAHEADERSTART and XARAHEADEREND).
+
+
+MARKS
+-----
+
+Xara, Xara LX, Xara X, Xara X/Xtreme, Xara Xtreme, the Xtreme and Xara
+designs are registered or unregistered trademarks, design-marks, and/or
+service marks of Xara Group Ltd. All rights in these marks are reserved.
+
+
+	Xara Group Ltd, Gaddesden Place, Hemel Hempstead, HP2 6EX, UK.
+						http://www.xara.com/
+
+=================================XARAHEADEREND============================
+*/
+
+// dropdown.cpp - Drop-down list base class
+
+// >>>> See O: