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

[XaraXtreme-commits] Commit Complete



Commit by  : alex
Repository : xara
Revision   : 1417
Date       : Thu Jul  6 20:56:29 BST 2006

Changed paths:
   M /Trunk/XaraLX/wxOil/camresource.cpp
   M /Trunk/XaraLX/wxXtra/Makefile.am
   M /Trunk/XaraLX/wxXtra/combo.cpp
   M /Trunk/XaraLX/wxXtra/combo.h
   M /Trunk/XaraLX/wxXtra/combog.cpp
   M /Trunk/XaraLX/wxXtra/combog.h
   M /Trunk/XaraLX/wxXtra/odcombo.cpp
   M /Trunk/XaraLX/wxXtra/odcombo.h
   M /Trunk/XaraLX/wxXtra/wxXtra.h
   A /Trunk/XaraLX/wxXtra/xh_odcombo.cpp
   A /Trunk/XaraLX/wxXtra/xh_odcombo.h

Sync combo box code with wxWidgets 2.7


Diff:
Index: Trunk/XaraLX/wxXtra/combo.cpp
===================================================================
--- Trunk/XaraLX/wxXtra/combo.cpp	(revision 1416)
+++ Trunk/XaraLX/wxXtra/combo.cpp	(revision 1417)
@@ -127,7 +127,7 @@
 class wxComboFrameEventHandler : public wxEvtHandler
 {
 public:
-    wxComboFrameEventHandler( wxComboControlBase* pCb );
+    wxComboFrameEventHandler( wxComboCtrlBase* pCb );
     ~wxComboFrameEventHandler();
 
     void OnPopup();
@@ -142,7 +142,7 @@
 
 protected:
     wxWindow*                       m_focusStart;
-    wxComboControlBase*     m_combo;
+    wxComboCtrlBase*     m_combo;
 
 private:
     DECLARE_EVENT_TABLE()
@@ -160,7 +160,7 @@
     EVT_CLOSE(wxComboFrameEventHandler::OnClose)
 END_EVENT_TABLE()
 
-wxComboFrameEventHandler::wxComboFrameEventHandler( wxComboControlBase* combo )
+wxComboFrameEventHandler::wxComboFrameEventHandler( wxComboCtrlBase* combo )
     : wxEvtHandler()
 {
     m_combo = combo;
@@ -238,14 +238,14 @@
 
 // ----------------------------------------------------------------------------
 // wxComboPopupWindow is wxPopupWindow customized for
-// wxComboControl.
+// wxComboCtrl.
 // ----------------------------------------------------------------------------
 
 class wxComboPopupWindow : public wxComboPopupWindowBase
 {
 public:
 
-    wxComboPopupWindow( wxComboControlBase *parent, int style = wxBORDER_NONE );
+    wxComboPopupWindow( wxComboCtrlBase *parent, int style = wxBORDER_NONE );
 
 #if USE_TRANSIENT_POPUP
     virtual bool ProcessLeftDown(wxMouseEvent& event);
@@ -279,7 +279,7 @@
 END_EVENT_TABLE()
 
 
-wxComboPopupWindow::wxComboPopupWindow( wxComboControlBase *parent,
+wxComboPopupWindow::wxComboPopupWindow( wxComboCtrlBase *parent,
                                         int style )
 #if wxUSE_POPUPWIN
                                        : wxComboPopupWindowBase(parent,style)
@@ -315,9 +315,9 @@
     if ( !event.GetActive() )
     {
         // Tell combo control that we are dismissed.
-        wxComboControl* combo = (wxComboControl*) GetParent();
+        wxComboCtrl* combo = (wxComboCtrl*) GetParent();
         wxASSERT( combo );
-        wxASSERT( combo->IsKindOf(CLASSINFO(wxComboControl)) );
+        wxASSERT( combo->IsKindOf(CLASSINFO(wxComboCtrl)) );
 
         combo->HidePopup();
 
@@ -337,9 +337,9 @@
 // First thing that happens when a transient popup closes is that this method gets called.
 void wxComboPopupWindow::OnDismiss()
 {
-    wxComboControlBase* combo = (wxComboControlBase*) GetParent();
-    wxASSERT_MSG( combo->IsKindOf(CLASSINFO(wxComboControlBase)),
-                  wxT("parent might not be wxComboControl, but check IMPLEMENT_DYNAMIC_CLASS(2) macro for correctness") );
+    wxComboCtrlBase* combo = (wxComboCtrlBase*) GetParent();
+    wxASSERT_MSG( combo->IsKindOf(CLASSINFO(wxComboCtrlBase)),
+                  wxT("parent might not be wxComboCtrl, but check IMPLEMENT_DYNAMIC_CLASS(2) macro for correctness") );
 
     combo->OnPopupDismiss();
 }
@@ -369,7 +369,7 @@
     return wxSize(minWidth,prefHeight);
 }
 
-void wxComboPopup::DefaultPaintComboControl( wxComboControlBase* combo,
+void wxComboPopup::DefaultPaintComboControl( wxComboCtrlBase* combo,
                                              wxDC& dc, const wxRect& rect )
 {
     if ( combo->GetWindowStyle() & wxCB_READONLY ) // ie. no textctrl
@@ -422,7 +422,7 @@
 {
 public:
 
-    wxComboBoxExtraInputHandler( wxComboControlBase* combo )
+    wxComboBoxExtraInputHandler( wxComboCtrlBase* combo )
         : wxEvtHandler()
     {
         m_combo = combo;
@@ -432,7 +432,7 @@
     void OnFocus(wxFocusEvent& event);
 
 protected:
-    wxComboControlBase*   m_combo;
+    wxComboCtrlBase*   m_combo;
 
 private:
     DECLARE_EVENT_TABLE()
@@ -535,7 +535,7 @@
 {
 public:
 
-    wxComboPopupExtraEventHandler( wxComboControlBase* combo )
+    wxComboPopupExtraEventHandler( wxComboCtrlBase* combo )
         : wxEvtHandler()
     {
         m_combo = combo;
@@ -545,14 +545,14 @@
 
     void OnMouseEvent( wxMouseEvent& event );
 
-    // Called from wxComboControlBase::OnPopupDismiss
+    // Called from wxComboCtrlBase::OnPopupDismiss
     void OnPopupDismiss()
     {
         m_beenInside = false;
     }
 
 protected:
-    wxComboControlBase*     m_combo;
+    wxComboCtrlBase*     m_combo;
 
     bool                    m_beenInside;
 
@@ -623,27 +623,27 @@
 }
 
 // ----------------------------------------------------------------------------
-// wxComboControlBase
+// wxComboCtrlBase
 // ----------------------------------------------------------------------------
 
 
-BEGIN_EVENT_TABLE(wxComboControlBase, wxControl)
-    EVT_TEXT(wxID_ANY,wxComboControlBase::OnTextCtrlEvent)
-    EVT_SIZE(wxComboControlBase::OnSizeEvent)
-    EVT_SET_FOCUS(wxComboControlBase::OnFocusEvent)
-    EVT_KILL_FOCUS(wxComboControlBase::OnFocusEvent)
-    //EVT_BUTTON(wxID_ANY,wxComboControlBase::OnButtonClickEvent)
-    EVT_TEXT_ENTER(wxID_ANY,wxComboControlBase::OnTextCtrlEvent)
-    EVT_SYS_COLOUR_CHANGED(wxComboControlBase::OnSysColourChanged)
+BEGIN_EVENT_TABLE(wxComboCtrlBase, wxControl)
+    EVT_TEXT(wxID_ANY,wxComboCtrlBase::OnTextCtrlEvent)
+    EVT_SIZE(wxComboCtrlBase::OnSizeEvent)
+    EVT_SET_FOCUS(wxComboCtrlBase::OnFocusEvent)
+    EVT_KILL_FOCUS(wxComboCtrlBase::OnFocusEvent)
+    //EVT_BUTTON(wxID_ANY,wxComboCtrlBase::OnButtonClickEvent)
+    EVT_TEXT_ENTER(wxID_ANY,wxComboCtrlBase::OnTextCtrlEvent)
+    EVT_SYS_COLOUR_CHANGED(wxComboCtrlBase::OnSysColourChanged)
 END_EVENT_TABLE()
 
 
-IMPLEMENT_ABSTRACT_CLASS(wxComboControlBase, wxControl)
+IMPLEMENT_ABSTRACT_CLASS(wxComboCtrlBase, wxControl)
 
 // Have global double buffer - should be enough for multiple combos
 static wxBitmap* gs_doubleBuffer = (wxBitmap*) NULL;
 
-void wxComboControlBase::Init()
+void wxComboCtrlBase::Init()
 {
     m_winPopup = (wxWindow *)NULL;
     m_popup = (wxWindow *)NULL;
@@ -681,14 +681,14 @@
     m_timeCanAcceptClick = 0;
 }
 
-bool wxComboControlBase::Create(wxWindow *parent,
-                                wxWindowID id,
-                                const wxString& value,
-                                const wxPoint& pos,
-                                const wxSize& size,
-                                long style,
-                                const wxValidator& validator,
-                                const wxString& name)
+bool wxComboCtrlBase::Create(wxWindow *parent,
+                             wxWindowID id,
+                             const wxString& value,
+                             const wxPoint& pos,
+                             const wxSize& size,
+                             long style,
+                             const wxValidator& validator,
+                             const wxString& name)
 {
     if ( !wxControl::Create(parent,
                             id,
@@ -705,10 +705,20 @@
     OnThemeChange();
     m_absIndent = GetNativeTextIndent();
 
+    m_iFlags |= wxCC_IFLAG_CREATED;
+
+    // If x and y indicate valid size, wxSizeEvent won't be
+    // emitted automatically, so we need to add artifical one.
+    if ( size.x > 0 && size.y > 0 )
+    {
+        wxSizeEvent evt(size,GetId());
+        GetEventHandler()->AddPendingEvent(evt);
+    }
+
     return true;
 }
 
-void wxComboControlBase::InstallInputHandlers( bool alsoTextCtrl )
+void wxComboCtrlBase::InstallInputHandlers( bool alsoTextCtrl )
 {
     if ( m_text && alsoTextCtrl )
     {
@@ -721,35 +731,35 @@
     m_extraEvtHandler = inputHandler;
 }
 
-void wxComboControlBase::CreateTextCtrl( int extraStyle, const wxValidator& validator )
+void
+wxComboCtrlBase::CreateTextCtrl(int style, const wxValidator& validator)
 {
     if ( !(m_windowStyle & wxCB_READONLY) )
     {
-        m_text = new wxTextCtrl(this,
-                                12345,
-                                m_valueString,
-                                wxDefaultPosition,
-                                wxDefaultSize,
-                                // wxTE_PROCESS_TAB is needed because on Windows, wxTAB_TRAVERSAL is
-                                // not used by the wxPropertyGrid and therefore the tab is
-                                // processed by looking at ancestors to see if they have
-                                // wxTAB_TRAVERSAL. The navigation event is then sent to
-                                // the wrong window.
-                                wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB |
-                                extraStyle,
-                                validator);
+        // wxTE_PROCESS_TAB is needed because on Windows, wxTAB_TRAVERSAL is
+        // not used by the wxPropertyGrid and therefore the tab is processed by
+        // looking at ancestors to see if they have wxTAB_TRAVERSAL. The
+        // navigation event is then sent to the wrong window.
+        style |= wxTE_PROCESS_TAB;
 
+        if ( HasFlag(wxTE_PROCESS_ENTER) )
+            style |= wxTE_PROCESS_ENTER;
+
+        m_text = new wxTextCtrl(this, wxID_ANY, m_valueString,
+                                wxDefaultPosition, wxDefaultSize,
+                                style, validator);
+
         // This is required for some platforms (GTK+ atleast)
         m_text->SetSizeHints(2,4);
     }
 }
 
-void wxComboControlBase::OnThemeChange()
+void wxComboCtrlBase::OnThemeChange()
 {
     SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
 }
 
-wxComboControlBase::~wxComboControlBase()
+wxComboCtrlBase::~wxComboCtrlBase()
 {
     if ( HasCapture() )
         ReleaseMouse();
@@ -762,16 +772,8 @@
     m_toplevEvtHandler = (wxEvtHandler*) NULL;
 #endif
 
-    if ( m_popup )
-        m_popup->RemoveEventHandler(m_popupExtraHandler);
+    DestroyPopup();
 
-    delete m_popupExtraHandler;
-
-    HidePopup();
-
-    delete m_popupInterface;
-    delete m_winPopup;
-
     RemoveEventHandler(m_extraEvtHandler);
 
     if ( m_text )
@@ -787,24 +789,25 @@
 // ----------------------------------------------------------------------------
 
 // Recalculates button and textctrl areas
-void wxComboControlBase::CalculateAreas( int btnWidth )
+void wxComboCtrlBase::CalculateAreas( int btnWidth )
 {
     wxSize sz = GetClientSize();
     int customBorder = m_widthCustomBorder;
-    bool buttonOutside;
     int btnBorder; // border for button only
 
-    if ( ( (m_iFlags & wxCC_BUTTON_OUTSIDE_BORDER) || m_blankButtonBg ) &&
-//         m_btnSpacingX == 0 && m_btnWid == 0 && m_btnHei == 0 &&
-         (!m_bmpNormal.Ok() || m_blankButtonBg) )
+    // check if button should really be outside the border: we'll do it it if
+    // its platform default or bitmap+pushbutton background is used, but not if
+    // there is vertical size adjustment or horizontal spacing.
+    if ( ( (m_iFlags & wxCC_BUTTON_OUTSIDE_BORDER) ||
+                (m_bmpNormal.Ok() && m_blankButtonBg) ) &&
+         m_btnSpacingX == 0  &&
+         m_btnHei <= 0 )
     {
-        buttonOutside = true;
         m_iFlags |= wxCC_IFLAG_BUTTON_OUTSIDE;
         btnBorder = 0;
     }
     else
     {
-        buttonOutside = false;
         m_iFlags &= ~(wxCC_IFLAG_BUTTON_OUTSIDE);
         btnBorder = customBorder;
     }
@@ -823,16 +826,32 @@
     if ( butWidth <= 0 )
         return;
 
+    int butHeight = sz.y - btnBorder*2;
+
     // Adjust button width
     if ( m_btnWid < 0 )
         butWidth += m_btnWid;
     else if ( m_btnWid > 0 )
         butWidth = m_btnWid;
+    else
+    {
+        // Adjust button width to match aspect ratio
+        // (but only if control is smaller than best size).
+        int bestHeight = GetBestSize().y;
+        int height = GetSize().y;
 
-    int butHeight = sz.y;
+        if ( height < bestHeight )
+        {
+            // Make very small buttons square, as it makes
+            // them accommodate arrow image better and still
+            // looks decent.
+            if ( height > 18 )
+                butWidth = (height*butWidth)/bestHeight;
+            else
+                butWidth = butHeight;
+        }
+    }
 
-    butHeight -= btnBorder*2;
-
     // Adjust button height
     if ( m_btnHei < 0 )
         butHeight += m_btnHei;
@@ -864,7 +883,7 @@
         if ( (sz.y-(customBorder*2)) < butHeight && btnWidth == 0 )
         {
             int newY = butHeight+(customBorder*2);
-            SetClientSize(-1,newY);
+            SetClientSize(wxDefaultCoord,newY);
             sz.y = newY;
         }
     }
@@ -893,7 +912,7 @@
 */
 }
 
-void wxComboControlBase::PositionTextCtrl( int textCtrlXAdjust, int textCtrlYAdjust )
+void wxComboCtrlBase::PositionTextCtrl( int textCtrlXAdjust, int textCtrlYAdjust )
 {
     if ( !m_text )
         return;
@@ -935,7 +954,7 @@
     }
 }
 
-wxSize wxComboControlBase::DoGetBestSize() const
+wxSize wxComboCtrlBase::DoGetBestSize() const
 {
     wxSize sizeText(150,0);
 
@@ -982,20 +1001,12 @@
     return ret;
 }
 
-void wxComboControlBase::DoMoveWindow(int x, int y, int width, int height)
+void wxComboCtrlBase::OnSizeEvent( wxSizeEvent& event )
 {
-    // SetSize is called last in create, so it marks the end of creation
-    m_iFlags |= wxCC_IFLAG_CREATED;
-
-    wxControl::DoMoveWindow(x, y, width, height);
-}
-
-void wxComboControlBase::OnSizeEvent( wxSizeEvent& event )
-{
     if ( !IsCreated() )
         return;
 
-    // defined by actual wxComboControls
+    // defined by actual wxComboCtrls
     OnResize();
 
     event.Skip();
@@ -1005,7 +1016,7 @@
 // standard operations
 // ----------------------------------------------------------------------------
 
-bool wxComboControlBase::Enable(bool enable)
+bool wxComboCtrlBase::Enable(bool enable)
 {
     if ( !wxControl::Enable(enable) )
         return false;
@@ -1018,7 +1029,7 @@
     return true;
 }
 
-bool wxComboControlBase::Show(bool show)
+bool wxComboCtrlBase::Show(bool show)
 {
     if ( !wxControl::Show(show) )
         return false;
@@ -1032,7 +1043,7 @@
     return true;
 }
 
-bool wxComboControlBase::SetFont ( const wxFont& font )
+bool wxComboCtrlBase::SetFont ( const wxFont& font )
 {
     if ( !wxControl::SetFont(font) )
         return false;
@@ -1044,7 +1055,7 @@
 }
 
 #if wxUSE_TOOLTIPS
-void wxComboControlBase::DoSetToolTip(wxToolTip *tooltip)
+void wxComboCtrlBase::DoSetToolTip(wxToolTip *tooltip)
 {
     wxControl::DoSetToolTip(tooltip);
 
@@ -1068,7 +1079,7 @@
 // ----------------------------------------------------------------------------
 
 // draw focus background on area in a way typical on platform
-void wxComboControlBase::DrawFocusBackground( wxDC& dc, const wxRect& rect, int flags )
+void wxComboCtrlBase::DrawFocusBackground( wxDC& dc, const wxRect& rect, int flags ) const
 {
     wxSize sz = GetClientSize();
     bool isEnabled;
@@ -1102,9 +1113,15 @@
     wxRect selRect(rect);
     selRect.y += focusSpacingY;
     selRect.height -= (focusSpacingY*2);
-    selRect.x += m_widthCustomPaint + focusSpacingX;
-    selRect.width -= m_widthCustomPaint + (focusSpacingX*2);
 
+    int wcp = 0;
+
+    if ( !(flags & wxCONTROL_ISSUBMENU) )
+        wcp += m_widthCustomPaint;
+
+    selRect.x += wcp + focusSpacingX;
+    selRect.width -= wcp + (focusSpacingX*2);
+
     wxColour bgCol;
 
     if ( isEnabled )
@@ -1133,7 +1150,7 @@
     dc.DrawRectangle( selRect );
 }
 
-void wxComboControlBase::DrawButton( wxDC& dc, const wxRect& rect, bool paintBg )
+void wxComboCtrlBase::DrawButton( wxDC& dc, const wxRect& rect, bool paintBg )
 {
     int drawState = m_btnState;
 
@@ -1161,7 +1178,6 @@
     if ( !m_bmpNormal.Ok() )
     {
         // Need to clear button background even if m_btn is present
-        // (assume non-button background was cleared just before this call so brushes are good)
         if ( paintBg )
         {
             wxColour bgCol;
@@ -1210,7 +1226,6 @@
                 dc.DrawRectangle(rect);
             }
 #if 0
-// Not available on 2.6 - Help!
             wxRendererNative::Get().DrawPushButton(this,
                                                    dc,
                                                    drawRect,
@@ -1234,7 +1249,7 @@
     }
 }
 
-void wxComboControlBase::RecalcAndRefresh()
+void wxComboCtrlBase::RecalcAndRefresh()
 {
     if ( IsCreated() )
     {
@@ -1244,7 +1259,7 @@
     }
 }
 
-wxBitmap& wxComboControlBase::GetBufferBitmap( const wxSize& sz ) const
+wxBitmap& wxComboCtrlBase::GetBufferBitmap( const wxSize& sz ) const
 {
     // If size is larger, recalculate double buffer bitmap
     if ( !gs_doubleBuffer ||
@@ -1257,20 +1272,22 @@
     return *gs_doubleBuffer;
 }
 
-
 // ----------------------------------------------------------------------------
 // miscellaneous event handlers
 // ----------------------------------------------------------------------------
 
-void wxComboControlBase::OnTextCtrlEvent(wxCommandEvent& event)
+void wxComboCtrlBase::OnTextCtrlEvent(wxCommandEvent& event)
 {
-    // Change event id and relay it forward
+    // Change event id, object and string before relaying it forward
     event.SetId(GetId());
+    wxString s = event.GetString();
+    event.SetEventObject(this);
+    event.SetString(s);
     event.Skip();
 }
 
 // call if cursor is on button area or mouse is captured for the button
-bool wxComboControlBase::HandleButtonMouseEvent( wxMouseEvent& event,
+bool wxComboCtrlBase::HandleButtonMouseEvent( wxMouseEvent& event,
                                                  int flags )
 {
     int type = event.GetEventType();
@@ -1360,8 +1377,8 @@
 
 // Conversion to double-clicks and some basic filtering
 // returns true if event was consumed or filtered
-//bool wxComboControlBase::PreprocessMouseEvent( wxMouseEvent& event, bool isOnButtonArea )
-bool wxComboControlBase::PreprocessMouseEvent( wxMouseEvent& event,
+//bool wxComboCtrlBase::PreprocessMouseEvent( wxMouseEvent& event, bool isOnButtonArea )
+bool wxComboCtrlBase::PreprocessMouseEvent( wxMouseEvent& event,
                                                int flags )
 {
     wxLongLong t = ::wxGetLocalTimeMillis();
@@ -1419,7 +1436,7 @@
     return false;
 }
 
-void wxComboControlBase::HandleNormalMouseEvent( wxMouseEvent& event )
+void wxComboCtrlBase::HandleNormalMouseEvent( wxMouseEvent& event )
 {
     int evtType = event.GetEventType();
 
@@ -1463,7 +1480,7 @@
         event.Skip();
 }
 
-void wxComboControlBase::OnFocusEvent( wxFocusEvent& )
+void wxComboCtrlBase::OnFocusEvent( wxFocusEvent& )
 {
     // First click is the first part of double-click
     // Some platforms don't generate down-less mouse up-event
@@ -1482,7 +1499,7 @@
         Refresh();
 }
 
-void wxComboControlBase::OnSysColourChanged(wxSysColourChangedEvent& WXUNUSED(event))
+void wxComboCtrlBase::OnSysColourChanged(wxSysColourChangedEvent& WXUNUSED(event))
 {
     OnThemeChange();
     // indentation may also have changed
@@ -1496,7 +1513,7 @@
 // ----------------------------------------------------------------------------
 
 // Create popup window and the child control
-void wxComboControlBase::CreatePopup()
+void wxComboCtrlBase::CreatePopup()
 {
     wxComboPopup* popupInterface = m_popupInterface;
     wxWindow* popup;
@@ -1518,20 +1535,39 @@
     popupInterface->m_iFlags |= wxCP_IFLAG_CREATED;
 }
 
-void wxComboControlBase::SetPopupControl( wxComboPopup* iface )
+// Destroy popup window and the child control
+void wxComboCtrlBase::DestroyPopup()
 {
-    wxCHECK_RET( iface, wxT("no popup interface set for wxComboControl") );
+    if ( m_popup )
+        m_popup->RemoveEventHandler(m_popupExtraHandler);
 
+    delete m_popupExtraHandler;
+
+    HidePopup();
+
     delete m_popupInterface;
-    delete m_winPopup;
-    m_winPopup=NULL;
 
+    if ( m_winPopup )
+        m_winPopup->Destroy();
+
+    m_popupExtraHandler = (wxEvtHandler*) NULL;
+    m_popupInterface = (wxComboPopup*) NULL;
+    m_winPopup = (wxWindow*) NULL;
+    m_popup = (wxWindow*) NULL;
+}
+
+void wxComboCtrlBase::DoSetPopupControl(wxComboPopup* iface)
+{
+    wxCHECK_RET( iface, wxT("no popup interface set for wxComboCtrl") );
+
+    DestroyPopup();
+
     iface->InitBase(this);
     iface->Init();
 
     m_popupInterface = iface;
 
-    if ( !iface->LazyCreate() || m_winPopup )
+    if ( !iface->LazyCreate() )
     {
         CreatePopup();
     }
@@ -1549,20 +1585,20 @@
 }
 
 // Ensures there is atleast the default popup
-void wxComboControlBase::EnsurePopupControl()
+void wxComboCtrlBase::EnsurePopupControl()
 {
     if ( !m_popupInterface )
         SetPopupControl(NULL);
 }
 
-void wxComboControlBase::OnButtonClick()
+void wxComboCtrlBase::OnButtonClick()
 {
     // Derived classes can override this method for totally custom
     // popup action
     ShowPopup();
 }
 
-void wxComboControlBase::ShowPopup()
+void wxComboCtrlBase::ShowPopup()
 {
     EnsurePopupControl();
     wxCHECK_RET( !IsPopupShown(), wxT("popup window already shown") );
@@ -1641,16 +1677,46 @@
     int popupX;
     int popupY = scrPos.y + ctrlSz.y;
 
+    // Default anchor is wxLEFT
     int anchorSide = m_anchorSide;
     if ( !anchorSide )
-        anchorSide = m_btnSide;
+        anchorSide = wxLEFT;
 
-    // Anchor popup to the side the dropbutton is on
+    int rightX = scrPos.x + ctrlSz.x + m_extRight - szp.x;
+    int leftX = scrPos.x - m_extLeft;
+    int screenWidth = wxSystemSettings::GetMetric( wxSYS_SCREEN_X );
+
+    // If there is not enough horizontal space, anchor on the other side.
+    // If there is no space even then, place the popup at x 0.
     if ( anchorSide == wxRIGHT )
-        popupX = scrPos.x + ctrlSz.x + m_extRight- szp.x;
+    {
+        if ( rightX < 0 )
+        {
+            if ( (leftX+szp.x) < screenWidth )
+                anchorSide = wxLEFT;
+            else
+                anchorSide = 0;
+        }
+    }
     else
-        popupX = scrPos.x - m_extLeft;
+    {
+        if ( (leftX+szp.x) >= screenWidth )
+        {
+            if ( rightX >= 0 )
+                anchorSide = wxRIGHT;
+            else
+                anchorSide = 0;
+        }
+    }
 
+    // Select x coordinate according to the anchor side
+    if ( anchorSide == wxRIGHT )
+        popupX = rightX;
+    else if ( anchorSide == wxLEFT )
+        popupX = leftX;
+    else
+        popupX = 0;
+
     if ( spaceBelow < szp.y )
     {
         popupY = scrPos.y - szp.y;
@@ -1705,7 +1771,7 @@
 
 }
 
-void wxComboControlBase::OnPopupDismiss()
+void wxComboCtrlBase::OnPopupDismiss()
 {
     // Just in case, avoid double dismiss
     if ( !m_isPopupShown )
@@ -1755,7 +1821,7 @@
 
 }
 
-void wxComboControlBase::HidePopup()
+void wxComboCtrlBase::HidePopup()
 {
     // Should be able to call this without popup interface
     //wxCHECK_RET( m_popupInterface, _T("no popup interface") );
@@ -1778,7 +1844,7 @@
 // customization methods
 // ----------------------------------------------------------------------------
 
-void wxComboControlBase::SetButtonPosition( int width, int height,
+void wxComboCtrlBase::SetButtonPosition( int width, int height,
                                             int side, int spacingX )
 {
     m_btnWid = width;
@@ -1789,7 +1855,7 @@
     RecalcAndRefresh();
 }
 
-void wxComboControlBase::SetButtonBitmaps( const wxBitmap& bmpNormal,
+void wxComboCtrlBase::SetButtonBitmaps( const wxBitmap& bmpNormal,
                                            bool blankButtonBg,
                                            const wxBitmap& bmpPressed,
                                            const wxBitmap& bmpHover,
@@ -1816,7 +1882,7 @@
     RecalcAndRefresh();
 }
 
-void wxComboControlBase::SetCustomPaintWidth( int width )
+void wxComboCtrlBase::SetCustomPaintWidth( int width )
 {
     if ( m_text )
     {
@@ -1833,7 +1899,7 @@
     RecalcAndRefresh();
 }
 
-void wxComboControlBase::SetTextIndent( int indent )
+void wxComboCtrlBase::SetTextIndent( int indent )
 {
     if ( indent < 0 )
     {
@@ -1849,7 +1915,7 @@
     RecalcAndRefresh();
 }
 
-wxCoord wxComboControlBase::GetNativeTextIndent() const
+wxCoord wxComboCtrlBase::GetNativeTextIndent() const
 {
     return DEFAULT_TEXT_INDENT;
 }
@@ -1858,14 +1924,14 @@
 // methods forwarded to wxTextCtrl
 // ----------------------------------------------------------------------------
 
-wxString wxComboControlBase::GetValue() const
+wxString wxComboCtrlBase::GetValue() const
 {
     if ( m_text )
         return m_text->GetValue();
     return m_valueString;
 }
 
-void wxComboControlBase::SetValue(const wxString& value)
+void wxComboCtrlBase::SetValue(const wxString& value)
 {
     if ( m_text )
     {
@@ -1887,7 +1953,7 @@
 }
 
 // In this SetValue variant wxComboPopup::SetStringValue is not called
-void wxComboControlBase::SetText(const wxString& value)
+void wxComboCtrlBase::SetText(const wxString& value)
 {
     // Unlike in SetValue(), this must be called here or
     // the behaviour will no be consistent in readonlys.
@@ -1898,37 +1964,37 @@
     Refresh();
 }
 
-void wxComboControlBase::Copy()
+void wxComboCtrlBase::Copy()
 {
     if ( m_text )
         m_text->Copy();
 }
 
-void wxComboControlBase::Cut()
+void wxComboCtrlBase::Cut()
 {
     if ( m_text )
         m_text->Cut();
 }
 
-void wxComboControlBase::Paste()
+void wxComboCtrlBase::Paste()
 {
     if ( m_text )
         m_text->Paste();
 }
 
-void wxComboControlBase::SetInsertionPoint(long pos)
+void wxComboCtrlBase::SetInsertionPoint(long pos)
 {
     if ( m_text )
         m_text->SetInsertionPoint(pos);
 }
 
-void wxComboControlBase::SetInsertionPointEnd()
+void wxComboCtrlBase::SetInsertionPointEnd()
 {
     if ( m_text )
         m_text->SetInsertionPointEnd();
 }
 
-long wxComboControlBase::GetInsertionPoint() const
+long wxComboCtrlBase::GetInsertionPoint() const
 {
     if ( m_text )
         return m_text->GetInsertionPoint();
@@ -1936,7 +2002,7 @@
     return 0;
 }
 
-long wxComboControlBase::GetLastPosition() const
+long wxComboCtrlBase::GetLastPosition() const
 {
     if ( m_text )
         return m_text->GetLastPosition();
@@ -1944,25 +2010,25 @@
     return 0;
 }
 
-void wxComboControlBase::Replace(long from, long to, const wxString& value)
+void wxComboCtrlBase::Replace(long from, long to, const wxString& value)
 {
     if ( m_text )
         m_text->Replace(from, to, value);
 }
 
-void wxComboControlBase::Remove(long from, long to)
+void wxComboCtrlBase::Remove(long from, long to)
 {
     if ( m_text )
         m_text->Remove(from, to);
 }
 
-void wxComboControlBase::SetSelection(long from, long to)
+void wxComboCtrlBase::SetSelection(long from, long to)
 {
     if ( m_text )
         m_text->SetSelection(from, to);
 }
 
-void wxComboControlBase::Undo()
+void wxComboCtrlBase::Undo()
 {
     if ( m_text )
         m_text->Undo();
Index: Trunk/XaraLX/wxXtra/wxXtra.h
===================================================================
--- Trunk/XaraLX/wxXtra/wxXtra.h	(revision 1416)
+++ Trunk/XaraLX/wxXtra/wxXtra.h	(revision 1417)
@@ -14,6 +14,7 @@
 #include "combo.h"
 #include "combog.h"
 #include "odcombo.h"
+#include "xh_odcombo.h"
 #include "platform.h"
 #include "advsplash.h"
 #include "treebook.h"
Index: Trunk/XaraLX/wxXtra/combo.h
===================================================================
--- Trunk/XaraLX/wxXtra/combo.h	(revision 1416)
+++ Trunk/XaraLX/wxXtra/combo.h	(revision 1417)
@@ -22,8 +22,10 @@
 #if wxUSE_COMBOCTRL
 #undef wxXTRA_COMBOCTRL
 #include <wx/combo.h>
+#define wxIndex unsigned int
 #else
 #define wxXTRA_COMBOCTRL 1
+#define wxIndex int
 
 /*
    A few words about all the classes defined in this file are probably in
@@ -49,10 +51,11 @@
    instead it is just a mix-in.
  */
 
+class WXDLLIMPEXP_CORE wxTextCtrl;
 class WXDLLEXPORT wxComboPopup;
 
 //
-// New window styles for wxComboControlBase
+// New window styles for wxComboCtrlBase
 //
 enum
 {
@@ -69,7 +72,7 @@
 };
 
 
-// wxComboControl internal flags
+// wxComboCtrl internal flags
 enum
 {
     // First those that can be passed to Customize.
@@ -100,8 +103,8 @@
 };
 
 
-// Namespace for wxComboControl feature flags
-struct wxComboControlFeatures
+// Namespace for wxComboCtrl feature flags
+struct wxComboCtrlFeatures
 {
     enum
     {
@@ -128,12 +131,12 @@
 };
 
 
-class WXDLLEXPORT wxComboControlBase : public wxControl
+class WXDLLEXPORT wxComboCtrlBase : public wxControl
 {
     friend class wxComboPopup;
 public:
     // ctors and such
-    wxComboControlBase() : wxControl() { Init(); }
+    wxComboCtrlBase() : wxControl() { Init(); }
 
     bool Create(wxWindow *parent,
                 wxWindowID id,
@@ -144,7 +147,7 @@
                 const wxValidator& validator,
                 const wxString& name);
 
-    virtual ~wxComboControlBase();
+    virtual ~wxComboCtrlBase();
 
     // show/hide popup window
     virtual void ShowPopup();
@@ -158,10 +161,17 @@
 
     // set interface class instance derived from wxComboPopup
     // NULL popup can be used to indicate default in a derived class
-    virtual void SetPopupControl( wxComboPopup* popup );
+    void SetPopupControl( wxComboPopup* popup )
+    {
+        DoSetPopupControl(popup);
+    }
 
     // get interface class instance derived from wxComboPopup
-    wxComboPopup* GetPopupControl() const { return m_popupInterface; }
+    wxComboPopup* GetPopupControl()
+    {
+        EnsurePopupControl();
+        return m_popupInterface;
+    }
 
     // get the popup window containing the popup control
     wxWindow *GetPopupWindow() const { return m_winPopup; }
@@ -302,7 +312,7 @@
     // flags: wxRendererNative flags: wxCONTROL_ISSUBMENU: is drawing a list item instead of combo control
     //                                wxCONTROL_SELECTED: list item is selected
     //                                wxCONTROL_DISABLED: control/item is disabled
-    virtual void DrawFocusBackground( wxDC& dc, const wxRect& rect, int flags );
+    virtual void DrawFocusBackground( wxDC& dc, const wxRect& rect, int flags ) const;
 
     // Returns true if focus indicator should be drawn in the control.
     bool ShouldDrawFocus() const
@@ -373,10 +383,15 @@
     // Creates popup window, calls interface->Create(), etc
     void CreatePopup();
 
+    // Destroy popup window and all related constructs
+    void DestroyPopup();
+
     // override the base class virtuals involved in geometry calculations
-    virtual void DoMoveWindow(int x, int y, int width, int height);
     virtual wxSize DoGetBestSize() const;
 
+    // NULL popup can be used to indicate default in a derived class
+    virtual void DoSetPopupControl(wxComboPopup* popup);
+
     // ensures there is atleast the default popup
     void EnsurePopupControl();
 
@@ -395,7 +410,7 @@
     void OnTextCtrlEvent(wxCommandEvent& event);
     void OnSysColourChanged(wxSysColourChangedEvent& event);
 
-    // Set customization flags (directs how wxComboControlBase helpers behave)
+    // Set customization flags (directs how wxComboCtrlBase helpers behave)
     void Customize( wxUint32 flags ) { m_iFlags |= flags; }
 
     // Dispatches size event and refreshes
@@ -510,30 +525,30 @@
 
     DECLARE_EVENT_TABLE()
 
-    DECLARE_ABSTRACT_CLASS(wxComboControlBase)
+    DECLARE_ABSTRACT_CLASS(wxComboCtrlBase)
 };
 
 
 // ----------------------------------------------------------------------------
 // wxComboPopup is the interface which must be implemented by a control to be
-// used as a popup by wxComboControl
+// used as a popup by wxComboCtrl
 // ----------------------------------------------------------------------------
 
 
 // wxComboPopup internal flags
 enum
 {
-    wxCP_IFLAG_CREATED      = 0x0001 // Set by wxComboControlBase after Create is called
+    wxCP_IFLAG_CREATED      = 0x0001 // Set by wxComboCtrlBase after Create is called
 };
 
 
 class WXDLLEXPORT wxComboPopup
 {
-    friend class wxComboControlBase;
+    friend class wxComboCtrlBase;
 public:
     wxComboPopup()
     {
-        m_combo = (wxComboControlBase*) NULL;
+        m_combo = (wxComboCtrlBase*) NULL;
         m_iFlags = 0;
     }
 
@@ -569,12 +584,12 @@
     // Default implementation draws value as string.
     virtual void PaintComboControl( wxDC& dc, const wxRect& rect );
 
-    // Receives key events from the parent wxComboControl.
+    // Receives key events from the parent wxComboCtrl.
     // Events not handled should be skipped, as usual.
     virtual void OnComboKeyEvent( wxKeyEvent& event );
 
     // Implement if you need to support special action when user
-    // double-clicks on the parent wxComboControl.
+    // double-clicks on the parent wxComboCtrl.
     virtual void OnComboDoubleClick();
 
     // Return final size of popup. Called on every popup, just prior to OnShow.
@@ -604,23 +619,22 @@
     }
 
     // Default PaintComboControl behaviour
-    static void DefaultPaintComboControl( wxComboControlBase* combo,
+    static void DefaultPaintComboControl( wxComboCtrlBase* combo,
                                           wxDC& dc,
                                           const wxRect& rect );
 
 protected:
-    wxComboControlBase* m_combo;
+    wxComboCtrlBase* m_combo;
     wxUint32            m_iFlags;
 
 private:
-    // Called in wxComboControlBase::SetPopupControl
-    void InitBase(wxComboControlBase *combo)
+    // Called in wxComboCtrlBase::SetPopupControl
+    void InitBase(wxComboCtrlBase *combo)
     {
         m_combo = combo;
     }
 };
 
-
 // ----------------------------------------------------------------------------
 // include the platform-dependent header defining the real class
 // ----------------------------------------------------------------------------
Index: Trunk/XaraLX/wxXtra/combog.cpp
===================================================================
--- Trunk/XaraLX/wxXtra/combog.cpp	(revision 1416)
+++ Trunk/XaraLX/wxXtra/combog.cpp	(revision 1417)
@@ -25,7 +25,7 @@
 #include "combog.h"
 
 #if wxXTRA_COMBOCTRL
-
+#include "combo.h"
 #include <wx/dcbuffer.h>
 
 // ----------------------------------------------------------------------------
@@ -81,13 +81,13 @@
 // wxGenericComboControl
 // ----------------------------------------------------------------------------
 
-BEGIN_EVENT_TABLE(wxGenericComboControl, wxComboControlBase)
+BEGIN_EVENT_TABLE(wxGenericComboControl, wxComboCtrlBase)
     EVT_PAINT(wxGenericComboControl::OnPaintEvent)
     EVT_MOUSE_EVENTS(wxGenericComboControl::OnMouseEvent)
 END_EVENT_TABLE()
 
 
-IMPLEMENT_DYNAMIC_CLASS(wxGenericComboControl, wxComboControlBase)
+IMPLEMENT_DYNAMIC_CLASS(wxGenericComboControl, wxComboCtrlBase)
 
 void wxGenericComboControl::Init()
 {
@@ -139,14 +139,14 @@
         m_iFlags |= wxCC_POPUP_ON_MOUSE_UP;
 
     // create main window
-    if ( !wxComboControlBase::Create(parent,
-                                     id,
-                                     value,
-                                     pos,
-                                     size,
-                                     style | wxFULL_REPAINT_ON_RESIZE,
-                                     wxDefaultValidator,
-                                     name) )
+    if ( !wxComboCtrlBase::Create(parent,
+                                  id,
+                                  value,
+                                  pos,
+                                  size,
+                                  style | wxFULL_REPAINT_ON_RESIZE,
+                                  wxDefaultValidator,
+                                  name) )
         return false;
 
     // Create textctrl, if necessary
@@ -158,7 +158,7 @@
     // Set background
     SetBackgroundStyle( wxBG_STYLE_CUSTOM ); // for double-buffering
 
-    // SetSize should be called last
+    // SetBestSize should be called last
     SetBestSize(size);
 
     return true;
@@ -356,99 +356,10 @@
 
 // If native wxComboControl was not defined, then prepare a simple
 // front-end so that wxRTTI works as expected.
-#ifndef _WX_COMBOCONTROL_H_
-IMPLEMENT_DYNAMIC_CLASS(wxComboControl, wxGenericComboControl)
+#ifndef _WXXTRA_COMBOCONTROL_H_
+IMPLEMENT_DYNAMIC_CLASS(wxComboCtrl, wxGenericComboControl)
 #endif
 
-#ifdef WXXTRA_COMBO_XML_HANDLERS
-IMPLEMENT_DYNAMIC_CLASS(wxComboControlXmlHandler, wxXmlResourceHandler)
-
-wxComboControlXmlHandler::wxComboControlXmlHandler()
-: wxXmlResourceHandler() , m_insideBox(false)
-{
-    XRC_ADD_STYLE(wxCB_SIMPLE);
-    XRC_ADD_STYLE(wxCB_SORT);
-    XRC_ADD_STYLE(wxCB_READONLY);
-    XRC_ADD_STYLE(wxCB_DROPDOWN);
-    XRC_ADD_STYLE(wxCC_SPECIAL_DCLICK);
-    XRC_ADD_STYLE(wxCC_ALT_KEYS);
-    XRC_ADD_STYLE(wxCC_STD_BUTTON);
-    XRC_ADD_STYLE(wxCC_BUTTON_OUTSIDE_BORDER);
-    XRC_ADD_STYLE(wxCC_POPUP_ON_MOUSE_UP);
-    XRC_ADD_STYLE(wxCC_NO_TEXT_AUTO_SELECT);
-    AddWindowStyles();
-}
-
-wxObject *wxComboControlXmlHandler::DoCreateResource()
-{
-    if( m_class == wxT("wxComboControl"))
-    {
-        // find the selection
-        long selection = GetLong( wxT("selection"), -1 );
-
-        // need to build the list of strings from children
-        m_insideBox = true;
-        CreateChildrenPrivately(NULL, GetParamNode(wxT("content")));
-        wxString *strings = (wxString *) NULL;
-        if (strList.GetCount() > 0)
-        {
-            strings = new wxString[strList.GetCount()];
-            int count = strList.GetCount();
-            for (int i = 0; i < count; i++)
-                strings[i]=strList[i];
-        }
-
-        XRC_MAKE_INSTANCE(control, wxComboControl)
-
-        control->Create(m_parentAsWindow,
-                        GetID(),
-                        GetText(wxT("value")),
-                        GetPosition(), GetSize(),
-                        /*strList.GetCount(),*/
-                        /*strings,*/
-                        GetStyle(),
-                        wxDefaultValidator,
-                        GetName());
-
-        if (selection != -1)
-            control->SetSelection(selection, selection);
-
-        SetupWindow(control);
-
-        if (strings != NULL)
-            delete[] strings;
-        strList.Clear();    // dump the strings
-
-        return control;
-    }
-    else
-    {
-        // on the inside now.
-        // handle <item>Label</item>
-
-        // add to the list
-        wxString str = GetNodeContent(m_node);
-        if (m_resource->GetFlags() & wxXRC_USE_LOCALE)
-            str = wxGetTranslation(str);
-        strList.Add(str);
-
-        return NULL;
-    }
-}
-
-bool wxComboControlXmlHandler::CanHandle(wxXmlNode *node)
-{
-// Avoid GCC bug
-//    return (IsOfClass(node, wxT("wxComboControl")) ||
-//           (m_insideBox && node->GetName() == wxT("item")));
-	bool fOurClass = node->GetPropVal(wxT("class"), wxEmptyString) == wxT("wxComboControl");
-    return (fOurClass ||
-           (m_insideBox && node->GetName() == wxT("item")));
-}
-
-
-#endif
-
 #endif // !wxCOMBOCONTROL_FULLY_FEATURED
 
 #endif // wxUSE_COMBOCONTROL
Index: Trunk/XaraLX/wxXtra/combog.h
===================================================================
--- Trunk/XaraLX/wxXtra/combog.h	(revision 1416)
+++ Trunk/XaraLX/wxXtra/combog.h	(revision 1417)
@@ -24,7 +24,6 @@
 #undef wxXTRA_COMBOCTRL
 #else
 #define wxXTRA_COMBOCTRL 1
-#define wxComboCtrl wxComboControl
 
 #include "combo.h"
 
@@ -32,7 +31,7 @@
 #if !defined(wxCOMBOCONTROL_FULLY_FEATURED)
 
 // ----------------------------------------------------------------------------
-// Generic wxComboControl
+// Generic wxComboCtrl
 // ----------------------------------------------------------------------------
 
 #if defined(__WXUNIVERSAL__)
@@ -45,12 +44,13 @@
 
 #endif
 
+extern WXDLLIMPEXP_DATA_CORE(const wxChar *) wxComboBoxNameStr;
 
-class WXDLLEXPORT wxGenericComboControl : public wxComboControlBase
+class WXDLLEXPORT wxGenericComboControl : public wxComboCtrlBase
 {
 public:
     // ctors and such
-    wxGenericComboControl() : wxComboControlBase() { Init(); }
+    wxGenericComboControl() : wxComboCtrlBase() { Init(); }
 
     wxGenericComboControl(wxWindow *parent,
                           wxWindowID id = wxID_ANY,
@@ -60,7 +60,7 @@
                           long style = 0,
                           const wxValidator& validator = wxDefaultValidator,
                           const wxString& name = wxComboBoxNameStr)
-        : wxComboControlBase()
+        : wxComboCtrlBase()
     {
         Init();
 
@@ -78,7 +78,7 @@
 
     virtual ~wxGenericComboControl();
 
-    static int GetFeatures() { return wxComboControlFeatures::All; }
+    static int GetFeatures() { return wxComboCtrlFeatures::All; }
 
 #if defined(__WXUNIVERSAL__)
     // we have our own input handler and our own actions
@@ -107,15 +107,15 @@
 
 #ifndef _WX_COMBOCONTROL_H_
 
-// If native wxComboControl was not defined, then prepare a simple
+// If native wxComboCtrl was not defined, then prepare a simple
 // front-end so that wxRTTI works as expected.
 
-class WXDLLEXPORT wxComboControl : public wxGenericComboControl
+class WXDLLEXPORT wxComboCtrl : public wxGenericComboControl
 {
 public:
-    wxComboControl() : wxGenericComboControl() {}
+    wxComboCtrl() : wxGenericComboControl() {}
 
-    wxComboControl(wxWindow *parent,
+    wxComboCtrl(wxWindow *parent,
                    wxWindowID id = wxID_ANY,
                    const wxString& value = wxEmptyString,
                    const wxPoint& pos = wxDefaultPosition,
@@ -128,33 +128,19 @@
         (void)Create(parent, id, value, pos, size, style, validator, name);
     }
 
-    virtual ~wxComboControl() {}
+    virtual ~wxComboCtrl() {}
 
 protected:
 
 private:
-    DECLARE_DYNAMIC_CLASS(wxComboControl)
+    DECLARE_DYNAMIC_CLASS(wxComboCtrl)
 };
 
 #endif // _WX_COMBOCONTROL_H_
 
-#define WXXTRA_COMBO_XML_HANDLERS
-
-class WXDLLIMPEXP_XRC wxComboControlXmlHandler : public wxXmlResourceHandler
-{
-DECLARE_DYNAMIC_CLASS(wxComboControlXmlHandler)
-public:
-    wxComboControlXmlHandler();
-    virtual wxObject *DoCreateResource();
-    virtual bool CanHandle(wxXmlNode *node);
-private:
-    bool m_insideBox;
-    wxArrayString strList;
-};
-
 #else
 
-#define wxGenericComboControl   wxComboControl
+#define wxGenericComboControl   wxComboCtrl
 
 #endif // !defined(wxCOMBOCONTROL_FULLY_FEATURED)
 
Index: Trunk/XaraLX/wxXtra/xh_odcombo.cpp
===================================================================
--- Trunk/XaraLX/wxXtra/xh_odcombo.cpp	(revision 0)
+++ Trunk/XaraLX/wxXtra/xh_odcombo.cpp	(revision 1417)
@@ -0,0 +1,107 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        src/xrc/xh_odcombo.cpp
+// Purpose:     XRC resource for wxRadioBox
+// Author:      Alex Bligh - Based on src/xrc/xh_combo.cpp
+// Created:     2006/06/19
+// RCS-ID:      $Id: xh_odcombo.cpp,v 1.2 2006/06/20 17:02:26 ABX Exp $
+// Copyright:   (c) 2006 Alex Bligh
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#include <wx/wx.h>
+
+#include "xh_odcombo.h"
+// Only compile stuff if this is not already in WX
+#if wxXTRA_XH_ODCOMBO
+#include "odcombo.h"
+
+IMPLEMENT_DYNAMIC_CLASS(wxOwnerDrawnComboBoxXmlHandler, wxXmlResourceHandler)
+
+wxOwnerDrawnComboBoxXmlHandler::wxOwnerDrawnComboBoxXmlHandler()
+                     :wxXmlResourceHandler()
+                     ,m_insideBox(false)
+{
+    XRC_ADD_STYLE(wxCB_SIMPLE);
+    XRC_ADD_STYLE(wxCB_SORT);
+    XRC_ADD_STYLE(wxCB_READONLY);
+    XRC_ADD_STYLE(wxCB_DROPDOWN);
+    XRC_ADD_STYLE(wxODCB_STD_CONTROL_PAINT);
+    XRC_ADD_STYLE(wxODCB_DCLICK_CYCLES);
+    AddWindowStyles();
+}
+
+wxObject *wxOwnerDrawnComboBoxXmlHandler::DoCreateResource()
+{
+    if( m_class == wxT("wxOwnerDrawnComboBox"))
+    {
+        // find the selection
+        long selection = GetLong( wxT("selection"), -1 );
+
+        // need to build the list of strings from children
+        m_insideBox = true;
+        CreateChildrenPrivately(NULL, GetParamNode(wxT("content")));
+        wxString *strings = (wxString *) NULL;
+        if (strList.GetCount() > 0)
+        {
+            strings = new wxString[strList.GetCount()];
+            int count = strList.GetCount();
+            for (int i = 0; i < count; i++)
+                strings[i]=strList[i];
+        }
+
+        XRC_MAKE_INSTANCE(control, wxOwnerDrawnComboBox)
+
+        control->Create(m_parentAsWindow,
+                        GetID(),
+                        GetText(wxT("value")),
+                        GetPosition(), GetSize(),
+                        strList.GetCount(),
+                        strings,
+                        GetStyle(),
+                        wxDefaultValidator,
+                        GetName());
+
+        wxSize ButtonSize=GetSize(wxT("buttonsize"));
+
+        if (ButtonSize != wxDefaultSize)
+        control->SetButtonPosition(ButtonSize.GetWidth(), ButtonSize.GetHeight());
+
+        if (selection != -1)
+            control->SetSelection(selection);
+
+        SetupWindow(control);
+
+        if (strings != NULL)
+            delete[] strings;
+        strList.Clear();    // dump the strings
+
+        return control;
+    }
+    else
+    {
+        // on the inside now.
+        // handle <item>Label</item>
+
+        // add to the list
+        wxString str = GetNodeContent(m_node);
+        if (m_resource->GetFlags() & wxXRC_USE_LOCALE)
+            str = wxGetTranslation(str);
+        strList.Add(str);
+
+        return NULL;
+    }
+}
+
+bool wxOwnerDrawnComboBoxXmlHandler::CanHandle(wxXmlNode *node)
+{
+//  Avoid GCC bug - this fails on certain GCC 3.x builds for an unknown reason
+//  return (IsOfClass(node, wxT("wxOwnerDrawnComboBox")) ||
+//         (m_insideBox && node->GetName() == wxT("item")));
+
+    bool fOurClass = node->GetPropVal(wxT("class"), wxEmptyString) == wxT("wxOwnerDrawnComboBox");
+    return (fOurClass ||
+          (m_insideBox && node->GetName() == wxT("item")));
+
+}
+
+#endif // wxUSE_XRC && wxUSE_ODCOMBOBOX
Index: Trunk/XaraLX/wxXtra/odcombo.cpp
===================================================================
--- Trunk/XaraLX/wxXtra/odcombo.cpp	(revision 1416)
+++ Trunk/XaraLX/wxXtra/odcombo.cpp	(revision 1417)
@@ -49,12 +49,11 @@
 
 
 void wxVListBoxComboPopup::Init()
-/*                                           : wxVListBox(),
-                                             wxComboPopup(combo)*/
 {
     m_widestWidth = 0;
-    m_avgCharWidth = 0;
-    m_baseImageWidth = 0;
+    m_widestItem = -1;
+    m_widthsDirty = false;
+    m_findWidest = false;
     m_itemHeight = 0;
     m_value = -1;
     m_itemHover = -1;
@@ -98,7 +97,7 @@
 {
     if ( !(m_combo->GetWindowStyle() & wxODCB_STD_CONTROL_PAINT) )
     {
-        m_combo->DrawFocusBackground(dc,rect,0);
+        OnDrawBg(dc,rect,m_value,wxODCB_PAINTING_CONTROL);
         if ( m_value >= 0 )
         {
             OnDrawItem(dc,rect,m_value,wxODCB_PAINTING_CONTROL);
@@ -123,45 +122,56 @@
     OnDrawItem(dc,rect,(int)n,0);
 }
 
-wxCoord wxVListBoxComboPopup::OnMeasureItem(size_t WXUNUSED(n)) const
+wxCoord wxVListBoxComboPopup::OnMeasureItem(size_t n) const
 {
-    /*
-    int itemHeight = m_combo->OnMeasureListItem(n);
-    if ( itemHeight < 0 )
-        itemHeight = m_itemHeight;
-    */
-    return m_itemHeight;
+    wxOwnerDrawnComboBox* combo = (wxOwnerDrawnComboBox*) m_combo;
+
+    wxASSERT_MSG( combo->IsKindOf(CLASSINFO(wxOwnerDrawnComboBox)),
+                  wxT("you must subclass wxVListBoxComboPopup for drawing and measuring methods") );
+
+    wxCoord h = combo->OnMeasureItem(n);
+    if ( h < 0 )
+        h = m_itemHeight;
+    return h;
 }
 
-wxCoord wxVListBoxComboPopup::OnMeasureItemWidth(size_t WXUNUSED(n)) const
+wxCoord wxVListBoxComboPopup::OnMeasureItemWidth(size_t n) const
 {
-    //return OnMeasureListItemWidth(n);
-    return -1;
+    wxOwnerDrawnComboBox* combo = (wxOwnerDrawnComboBox*) m_combo;
+
+    wxASSERT_MSG( combo->IsKindOf(CLASSINFO(wxOwnerDrawnComboBox)),
+                  wxT("you must subclass wxVListBoxComboPopup for drawing and measuring methods") );
+
+    return combo->OnMeasureItemWidth(n);
 }
 
+void wxVListBoxComboPopup::OnDrawBg( wxDC& dc,
+                                     const wxRect& rect,
+                                     int item,
+                                     int flags ) const
+{
+    wxOwnerDrawnComboBox* combo = (wxOwnerDrawnComboBox*) m_combo;
+
+    wxASSERT_MSG( combo->IsKindOf(CLASSINFO(wxOwnerDrawnComboBox)),
+                  wxT("you must subclass wxVListBoxComboPopup for drawing and measuring methods") );
+
+    combo->OnDrawBackground(dc,rect,item,flags);
+}
+
 void wxVListBoxComboPopup::OnDrawBackground(wxDC& dc, const wxRect& rect, size_t n) const
 {
-    // we need to render selected and current items differently
-    if ( IsCurrent(n) )
-    {
-        m_combo->DrawFocusBackground( dc, rect, wxCONTROL_ISSUBMENU|wxCONTROL_SELECTED );
-    }
-    //else: do nothing for the normal items
+    OnDrawBg(dc,rect,(int)n,0);
 }
 
 // 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 & wxODCB_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 );
-    }
+    wxOwnerDrawnComboBox* combo = (wxOwnerDrawnComboBox*) m_combo;
+
+    wxASSERT_MSG( combo->IsKindOf(CLASSINFO(wxOwnerDrawnComboBox)),
+                  wxT("you must subclass wxVListBoxComboPopup for drawing and measuring methods") );
+
+    combo->OnDrawItem(dc,rect,item,flags);
 }
 
 void wxVListBoxComboPopup::DismissWithEvent()
@@ -227,16 +237,6 @@
     {
         value-=10;
     }
-    /*
-    else if ( keycode == WXK_END )
-    {
-        value = itemCount-1;
-    }
-    else if ( keycode == WXK_HOME )
-    {
-        value = 0;
-    }
-    */
     else
         return false;
 
@@ -294,12 +294,30 @@
 
 void wxVListBoxComboPopup::OnMouseMove(wxMouseEvent& event)
 {
+    event.Skip();
+
     // Move selection to cursor if it is inside the popup
-    int itemHere = GetItemAtPosition(event.GetPosition());
-    if ( itemHere >= 0 )
-        wxVListBox::SetSelection(itemHere);
 
-    event.Skip();
+    int y = event.GetPosition().y;
+    int fromBottom = GetClientSize().y - y;
+
+    // Since in any case we need to find out if the last item is only
+    // partially visible, we might just as well replicate the HitTest
+    // loop here.
+    const size_t lineMax = GetVisibleEnd();
+    for ( size_t line = GetVisibleBegin(); line < lineMax; line++ )
+    {
+        y -= OnGetLineHeight(line);
+        if ( y < 0 )
+        {
+            // Only change selection if item is fully visible
+            if ( (y + fromBottom) >= 0 )
+            {
+                wxVListBox::SetSelection((int)line);
+                return;
+            }
+        }
+    }
 }
 
 void wxVListBoxComboPopup::OnLeftClick(wxMouseEvent& WXUNUSED(event))
@@ -321,26 +339,6 @@
         event.Skip();
 }
 
-void wxVListBoxComboPopup::CheckWidth( int pos )
-{
-    wxCoord x = OnMeasureItemWidth(pos);
-
-    if ( x < 0 )
-    {
-        if ( !m_useFont.Ok() )
-            m_useFont = m_combo->GetFont();
-
-        wxCoord y;
-        m_combo->GetTextExtent(m_strings[pos], &x, &y, 0, 0, &m_useFont);
-        x += 4;
-    }
-
-    if ( m_widestWidth < x )
-    {
-        m_widestWidth = x;
-    }
-}
-
 void wxVListBoxComboPopup::Insert( const wxString& item, int pos )
 {
     // Need to change selection?
@@ -352,12 +350,11 @@
     }
 
     m_strings.Insert(item,pos);
+    m_widths.Insert(-1,pos);
+    m_widthsDirty = true;
 
     if ( IsCreated() )
         wxVListBox::SetItemCount( wxVListBox::GetItemCount()+1 );
-
-    // Calculate width
-    CheckWidth(pos);
 }
 
 int wxVListBoxComboPopup::Append(const wxString& item)
@@ -391,9 +388,15 @@
     wxASSERT(m_combo);
 
     m_strings.Empty();
+    m_widths.Empty();
 
+    m_widestWidth = 0;
+    m_widestItem = -1;
+
     ClearClientDatas();
 
+    m_value = wxNOT_FOUND;
+
     if ( IsCreated() )
         wxVListBox::SetItemCount(0);
 }
@@ -410,7 +413,7 @@
     m_clientDatas.Empty();
 }
 
-void wxVListBoxComboPopup::SetItemClientData( int n,
+void wxVListBoxComboPopup::SetItemClientData( unsigned int n,
                                               void* clientData,
                                               wxClientDataType clientDataItemsType )
 {
@@ -419,18 +422,19 @@
 
     m_clientDatas.SetCount(n+1,NULL);
     m_clientDatas[n] = clientData;
-    CheckWidth(n);
+
+    ItemWidthChanged(n);
 }
 
-void* wxVListBoxComboPopup::GetItemClientData(int n) const
+void* wxVListBoxComboPopup::GetItemClientData(unsigned int n) const
 {
-    if ( (int)m_clientDatas.GetCount() > n )
+    if ( m_clientDatas.GetCount() > n )
         return m_clientDatas[n];
 
     return NULL;
 }
 
-void wxVListBoxComboPopup::Delete( int item )
+void wxVListBoxComboPopup::Delete( unsigned int item )
 {
     // Remove client data, if set
     if ( m_clientDatas.GetCount() )
@@ -442,17 +446,21 @@
     }
 
     m_strings.RemoveAt(item);
+    m_widths.RemoveAt(item);
 
+    if ( (int)item == m_widestItem )
+        m_findWidest = true;
+
     if ( IsCreated() )
         wxVListBox::SetItemCount( wxVListBox::GetItemCount()-1 );
 }
 
-int wxVListBoxComboPopup::FindString(const wxString& s) const
+int wxVListBoxComboPopup::FindString(const wxString& s, bool bCase) const
 {
-    return m_strings.Index(s);
+    return m_strings.Index(s, bCase);
 }
 
-int wxVListBoxComboPopup::GetCount() const
+unsigned int wxVListBoxComboPopup::GetCount() const
 {
     return m_strings.GetCount();
 }
@@ -465,6 +473,7 @@
 void wxVListBoxComboPopup::SetString( int item, const wxString& str )
 {
     m_strings[item] = str;
+    ItemWidthChanged(item);
 }
 
 wxString wxVListBoxComboPopup::GetStringValue() const
@@ -476,9 +485,8 @@
 
 void wxVListBoxComboPopup::SetSelection( int item )
 {
-    // This seems to be necessary (2.5.3 w/ MingW atleast)
-    if ( item < -1 || item >= (int)m_strings.GetCount() )
-        item = -1;
+    wxCHECK_RET( item == wxNOT_FOUND || ((unsigned int)item < GetCount()),
+                 wxT("invalid index in wxVListBoxComboPopup::SetSelection") );
 
     m_value = item;
 
@@ -501,6 +509,95 @@
         wxVListBox::SetSelection(index);
 }
 
+void wxVListBoxComboPopup::CalcWidths()
+{
+    bool doFindWidest = m_findWidest;
+
+    // Measure items with dirty width.
+    if ( m_widthsDirty )
+    {
+        unsigned int i;
+        unsigned int n = m_widths.GetCount();
+        int dirtyHandled = 0;
+        wxArrayInt& widths = m_widths;
+
+        // I think using wxDC::GetTextExtent is faster than
+        // wxWindow::GetTextExtent (assuming same dc is used
+        // for all calls, as we do here).
+        wxClientDC dc(m_combo);
+        dc.SetFont(m_useFont);
+
+        for ( i=0; i<n; i++ )
+        {
+            if ( widths[i] < 0 )
+            {
+                wxCoord x = OnMeasureItemWidth(i);
+
+                if ( x < 0 )
+                {
+                    const wxString& text = m_strings[i];
+
+                    // To make sure performance won't suck in extreme scenarios,
+                    // we'll estimate length after some arbitrary number of items
+                    // have been checked precily.
+                    if ( dirtyHandled < 1024 )
+                    {
+                        wxCoord y;
+                        dc.GetTextExtent(text, &x, &y, 0, 0);
+                        x += 4;
+                    }
+                    else
+                    {
+                        x = text.length() * (dc.GetCharWidth()+1);
+                    }
+                }
+
+                widths[i] = x;
+
+                if ( x >= m_widestWidth )
+                {
+                    m_widestWidth = x;
+                    m_widestItem = (int)i;
+                }
+                else if ( (int)i == m_widestItem )
+                {
+                    // Width of previously widest item has been decreased, so
+                    // we'll have to check all to find current widest item.
+                    doFindWidest = true;
+                }
+
+                dirtyHandled++;
+            }
+        }
+
+        m_widthsDirty = false;
+    }
+
+    if ( doFindWidest )
+    {
+        unsigned int i;
+        unsigned int n = m_widths.GetCount();
+
+        int bestWidth = -1;
+        int bestIndex = -1;
+
+        for ( i=0; i<n; i++ )
+        {
+            int w = m_widths[i];
+            if ( w > bestWidth )
+            {
+                bestIndex = (int)i;
+                bestWidth = w;
+            }
+        }
+
+        m_widestWidth = bestWidth;
+        m_widestItem = bestIndex;
+
+        m_findWidest = false;
+    }
+}
+
 wxSize wxVListBoxComboPopup::GetAdjustedSize( int minWidth, int prefHeight, int maxHeight )
 {
     int height = 250;
@@ -531,6 +628,8 @@
     else
         height = 50;
 
+    CalcWidths();
+
     // Take scrollbar into account in width calculations
     int widestWidth = m_widestWidth + wxSystemSettings::GetMetric(wxSYS_VSCROLL_X);
     return wxSize(minWidth > widestWidth ? minWidth : widestWidth,
@@ -548,9 +647,11 @@
     {
         const wxString& item = choices.Item(i);
         m_strings.Add(item);
-        CheckWidth(i);
     }
 
+    m_widths.SetCount(n,-1);
+    m_widthsDirty = true;
+
     if ( IsCreated() )
         wxVListBox::SetItemCount(n);
 
@@ -560,7 +661,7 @@
 
     // Find initial selection
     wxString strValue = m_combo->GetValue();
-    if ( strValue.Length() )
+    if ( strValue.length() )
         m_value = m_strings.Index(strValue);
 }
 
@@ -569,15 +670,14 @@
 // ----------------------------------------------------------------------------
 
 
-BEGIN_EVENT_TABLE(wxOwnerDrawnComboBox, wxComboControl)
+BEGIN_EVENT_TABLE(wxOwnerDrawnComboBox, wxComboCtrl)
 END_EVENT_TABLE()
 
 
-IMPLEMENT_DYNAMIC_CLASS2(wxOwnerDrawnComboBox, wxComboControl, wxControlWithItems)
+IMPLEMENT_DYNAMIC_CLASS2(wxOwnerDrawnComboBox, wxComboCtrl, wxControlWithItems)
 
 void wxOwnerDrawnComboBox::Init()
 {
-    m_popupInterface = NULL;
 }
 
 bool wxOwnerDrawnComboBox::Create(wxWindow *parent,
@@ -589,7 +689,7 @@
                                   const wxValidator& validator,
                                   const wxString& name)
 {
-    return wxComboControl::Create(parent,id,value,pos,size,style,validator,name);
+    return wxComboCtrl::Create(parent,id,value,pos,size,style,validator,name);
 }
 
 wxOwnerDrawnComboBox::wxOwnerDrawnComboBox(wxWindow *parent,
@@ -601,7 +701,7 @@
                                            long style,
                                            const wxValidator& validator,
                                            const wxString& name)
-    : wxComboControl()
+    : wxComboCtrl()
 {
     Init();
 
@@ -655,26 +755,24 @@
 wxOwnerDrawnComboBox::~wxOwnerDrawnComboBox()
 {
     if ( m_popupInterface )
-        m_popupInterface->ClearClientDatas();
+        GetVListBoxComboPopup()->ClearClientDatas();
 }
 
-void wxOwnerDrawnComboBox::SetPopupControl( wxComboPopup* popup )
+void wxOwnerDrawnComboBox::DoSetPopupControl(wxComboPopup* popup)
 {
     if ( !popup )
     {
         popup = new wxVListBoxComboPopup();
     }
 
-    wxComboControl::SetPopupControl(popup);
+    wxComboCtrl::DoSetPopupControl(popup);
 
     wxASSERT(popup);
-    m_popupInterface = (wxVListBoxComboPopup*) popup;
 
     // Add initial choices to the wxVListBox
-    if ( !m_popupInterface->GetCount() )
+    if ( !GetVListBoxComboPopup()->GetCount() )
     {
-        //m_popupInterface->Populate(m_initChs.GetCount(),m_initChs.GetStrings());
-        m_popupInterface->Populate(m_initChs);
+        GetVListBoxComboPopup()->Populate(m_initChs);
         m_initChs.Clear();
     }
 }
@@ -687,56 +785,67 @@
 {
     EnsurePopupControl();
 
-    m_popupInterface->Clear();
+    GetVListBoxComboPopup()->Clear();
 
-    if (GetTextCtrl())
-        GetTextCtrl()->SetValue(wxEmptyString);
+    SetValue(wxEmptyString);
 }
 
-void wxOwnerDrawnComboBox::Delete(int n)
+void wxOwnerDrawnComboBox::Delete(wxIndex n)
 {
-    wxCHECK_RET( (n >= 0) && (n < GetCount()), _T("invalid index in wxOwnerDrawnComboBox::Delete") );
+    wxCHECK_RET( IsValid(n), _T("invalid index in wxOwnerDrawnComboBox::Delete") );
 
     if ( GetSelection() == (int) n )
         SetValue(wxEmptyString);
 
-    m_popupInterface->Delete(n);
+    GetVListBoxComboPopup()->Delete(n);
 }
 
-int wxOwnerDrawnComboBox::GetCount() const
+wxIndex wxOwnerDrawnComboBox::GetCount() const
 {
-    wxASSERT_MSG( m_popupInterface, wxT("no popup interface") );
-    return m_popupInterface->GetCount();
+    if ( !m_popupInterface )
+        return m_initChs.GetCount();
+
+    return GetVListBoxComboPopup()->GetCount();
 }
 
-wxString wxOwnerDrawnComboBox::GetString(int n) const
+wxString wxOwnerDrawnComboBox::GetString(wxIndex n) const
 {
-    wxCHECK_MSG( (n >= 0) && (n < GetCount()), wxEmptyString, _T("invalid index in wxOwnerDrawnComboBox::GetString") );
-    return m_popupInterface->GetString(n);
+    wxCHECK_MSG( IsValid(n), wxEmptyString, _T("invalid index in wxOwnerDrawnComboBox::GetString") );
+
+    if ( !m_popupInterface )
+        return m_initChs.Item(n);
+
+    return GetVListBoxComboPopup()->GetString(n);
 }
 
-void wxOwnerDrawnComboBox::SetString( int n, const wxString& s)
+void wxOwnerDrawnComboBox::SetString(wxIndex n, const wxString& s)
 {
-    wxCHECK_RET( (n >= 0) && (n < GetCount()), _T("invalid index in wxOwnerDrawnComboBox::SetString") );
-    m_popupInterface->SetString(n,s);
+    EnsurePopupControl();
+
+    wxCHECK_RET( IsValid(n), _T("invalid index in wxOwnerDrawnComboBox::SetString") );
+
+    GetVListBoxComboPopup()->SetString(n,s);
 }
 
-int wxOwnerDrawnComboBox::FindString(const wxString& s) const
+int wxOwnerDrawnComboBox::FindString(const wxString& s, bool bCase) const
 {
-    wxASSERT_MSG( m_popupInterface, wxT("no popup interface") );
-    return m_popupInterface->FindString(s);
+    if ( !m_popupInterface )
+        return m_initChs.Index(s, bCase);
+
+    return GetVListBoxComboPopup()->FindString(s, bCase);
 }
 
 void wxOwnerDrawnComboBox::Select(int n)
 {
-    wxCHECK_RET( (n >= -1) && (n < (int)GetCount()), _T("invalid index in wxOwnerDrawnComboBox::Select") );
     EnsurePopupControl();
 
-    m_popupInterface->SetSelection(n);
+    wxCHECK_RET( (n == wxNOT_FOUND) || IsValid(n), _T("invalid index in wxOwnerDrawnComboBox::Select") );
 
+    GetVListBoxComboPopup()->SetSelection(n);
+
     wxString str;
     if ( n >= 0 )
-        str = m_popupInterface->GetString(n);
+        str = GetVListBoxComboPopup()->GetString(n);
 
     // Refresh text portion in control
     if ( m_text )
@@ -749,140 +858,100 @@
 
 int wxOwnerDrawnComboBox::GetSelection() const
 {
-    wxASSERT( m_popupInterface );
-    return m_popupInterface->GetSelection();
+    if ( !m_popupInterface )
+        return m_initChs.Index(m_valueString);
+
+    return GetVListBoxComboPopup()->GetSelection();
 }
 
 int wxOwnerDrawnComboBox::DoAppend(const wxString& item)
 {
-    wxASSERT( m_popupInterface );
-    return m_popupInterface->Append(item);
+    EnsurePopupControl();
+    wxASSERT(m_popupInterface);
+
+    return GetVListBoxComboPopup()->Append(item);
 }
 
-int wxOwnerDrawnComboBox::DoInsert(const wxString& item, int pos)
+int wxOwnerDrawnComboBox::DoInsert(const wxString& item, wxIndex pos)
 {
+    EnsurePopupControl();
+
     wxCHECK_MSG(!(GetWindowStyle() & wxCB_SORT), -1, wxT("can't insert into sorted list"));
-    wxCHECK_MSG((pos>=0) && (pos<=GetCount()), -1, wxT("invalid index"));
+#if 0
+    wxCHECK_MSG(IsValidInsert(pos), -1, wxT("invalid index"));
+#endif
+    GetVListBoxComboPopup()->Insert(item,pos);
 
-    m_popupInterface->Insert(item,pos);
-
     return pos;
 }
 
-void wxOwnerDrawnComboBox::DoSetItemClientData(int n, void* clientData)
+void wxOwnerDrawnComboBox::DoSetItemClientData(wxIndex n, void* clientData)
 {
-    wxASSERT(m_popupInterface);
-    m_popupInterface->SetItemClientData(n,clientData,m_clientDataItemsType);
+    EnsurePopupControl();
+
+    GetVListBoxComboPopup()->SetItemClientData(n,clientData,m_clientDataItemsType);
 }
 
-void* wxOwnerDrawnComboBox::DoGetItemClientData(int n) const
+void* wxOwnerDrawnComboBox::DoGetItemClientData(wxIndex n) const
 {
-    wxASSERT(m_popupInterface);
-    return m_popupInterface->GetItemClientData(n);
+    if ( !m_popupInterface )
+        return NULL;
+
+    return GetVListBoxComboPopup()->GetItemClientData(n);
 }
 
-void wxOwnerDrawnComboBox::DoSetItemClientObject(int n, wxClientData* clientData)
+void wxOwnerDrawnComboBox::DoSetItemClientObject(wxIndex n, wxClientData* clientData)
 {
     DoSetItemClientData(n, (void*) clientData);
 }
 
-wxClientData* wxOwnerDrawnComboBox::DoGetItemClientObject(int n) const
+wxClientData* wxOwnerDrawnComboBox::DoGetItemClientObject(wxIndex n) const
 {
     return (wxClientData*) DoGetItemClientData(n);
 }
 
-#ifdef WXXTRA_COMBO_XML_HANDLERS
-IMPLEMENT_DYNAMIC_CLASS(wxOwnerDrawnComboBoxXmlHandler, wxXmlResourceHandler)
+// ----------------------------------------------------------------------------
+// wxOwnerDrawnComboBox item drawing and measuring default implementations
+// ----------------------------------------------------------------------------
 
-wxOwnerDrawnComboBoxXmlHandler::wxOwnerDrawnComboBoxXmlHandler()
-: wxXmlResourceHandler() , m_insideBox(false)
+void wxOwnerDrawnComboBox::OnDrawItem( wxDC& dc,
+                                       const wxRect& rect,
+                                       int item,
+                                       int flags ) const
 {
-    XRC_ADD_STYLE(wxCB_SIMPLE);
-    XRC_ADD_STYLE(wxCB_SORT);
-    XRC_ADD_STYLE(wxCB_READONLY);
-    XRC_ADD_STYLE(wxCB_DROPDOWN);
-    XRC_ADD_STYLE(wxODCB_STD_CONTROL_PAINT);
-    XRC_ADD_STYLE(wxCC_SPECIAL_DCLICK);
-    XRC_ADD_STYLE(wxCC_ALT_KEYS);
-    XRC_ADD_STYLE(wxCC_STD_BUTTON);
-    AddWindowStyles();
-}
-
-wxObject *wxOwnerDrawnComboBoxXmlHandler::DoCreateResource()
-{
-    if( m_class == wxT("wxOwnerDrawnComboBox"))
+    if ( flags & wxODCB_PAINTING_CONTROL )
     {
-        // find the selection
-        long selection = GetLong( wxT("selection"), -1 );
-
-        // need to build the list of strings from children
-        m_insideBox = true;
-        CreateChildrenPrivately(NULL, GetParamNode(wxT("content")));
-        wxString *strings = (wxString *) NULL;
-        if (strList.GetCount() > 0)
-        {
-            strings = new wxString[strList.GetCount()];
-            int count = strList.GetCount();
-            for (int i = 0; i < count; i++)
-                strings[i]=strList[i];
-        }
-
-        XRC_MAKE_INSTANCE(control, wxOwnerDrawnComboBox)
-
-        control->Create(m_parentAsWindow,
-                        GetID(),
-                        GetText(wxT("value")),
-                        GetPosition(), GetSize(),
-                        strList.GetCount(),
-                        strings,
-                        GetStyle(),
-                        wxDefaultValidator,
-                        GetName());
-
-        control->SetPopupControl(NULL);
-
-        wxSize ButtonSize=GetSize(wxT("buttonsize"));
-
-        if (ButtonSize != wxDefaultSize)
-            control->SetButtonPosition(ButtonSize.GetWidth(), ButtonSize.GetHeight());
-
-        if (selection != -1)
-            control->SetSelection(selection);
-
-        SetupWindow(control);
-
-        if (strings != NULL)
-            delete[] strings;
-        strList.Clear();    // dump the strings
-
-        return control;
+        dc.DrawText( GetValue(),
+                     rect.x + GetTextIndent(),
+                     (rect.height-dc.GetCharHeight())/2 + rect.y );
     }
     else
     {
-        // on the inside now.
-        // handle <item>Label</item>
-
-        // add to the list
-        wxString str = GetNodeContent(m_node);
-        if (m_resource->GetFlags() & wxXRC_USE_LOCALE)
-            str = wxGetTranslation(str);
-        strList.Add(str);
-
-        return NULL;
+        dc.DrawText( GetVListBoxComboPopup()->GetString(item), rect.x + 2, rect.y );
     }
 }
 
-bool wxOwnerDrawnComboBoxXmlHandler::CanHandle(wxXmlNode *node)
+wxCoord wxOwnerDrawnComboBox::OnMeasureItem( size_t WXUNUSED(item) ) const
 {
-// Avoid GCC bug
-//    return (IsOfClass(node, wxT("wxOwnerDrawnComboBox")) ||
-//           (m_insideBox && node->GetName() == wxT("item")));
-	bool fOurClass = node->GetPropVal(wxT("class"), wxEmptyString) == wxT("wxOwnerDrawnComboBox");
-    return (fOurClass ||
-           (m_insideBox && node->GetName() == wxT("item")));
+    return -1;
 }
 
+wxCoord wxOwnerDrawnComboBox::OnMeasureItemWidth( size_t WXUNUSED(item) ) const
+{
+    return -1;
+}
 
-#endif
+void wxOwnerDrawnComboBox::OnDrawBackground(wxDC& dc, const wxRect& rect, int item, int flags) const
+{
+    // we need to render selected and current items differently
+    if ( GetVListBoxComboPopup()->IsCurrent((size_t)item) )
+    {
+        DrawFocusBackground(dc,
+                            rect,
+                            (flags&wxODCB_PAINTING_CONTROL?0:wxCONTROL_ISSUBMENU) |
+                            wxCONTROL_SELECTED);
+    }
+    //else: do nothing for the normal items
+}
 
 #endif // wxXTRA_OWNERDRAWNCOMBOBOX
Index: Trunk/XaraLX/wxXtra/xh_odcombo.h
===================================================================
--- Trunk/XaraLX/wxXtra/xh_odcombo.h	(revision 0)
+++ Trunk/XaraLX/wxXtra/xh_odcombo.h	(revision 1417)
@@ -0,0 +1,38 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        wx/xrc/xh_odcombo.h
+// Purpose:     XML resource handler for wxOwnerDrawnComboBox
+// Author:      Alex Bligh - based on wx/xrc/xh_combo.h
+// Created:     2006/06/19
+// RCS-ID:      $Id: xh_odcombo.h,v 1.1 2006/06/20 12:26:05 ABX Exp $
+// Copyright:   (c) 2006 Alex Bligh
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WXXTRA_XH_ODCOMBO_H_
+#define _WXXTRA_XH_ODCOMBO_H_
+
+#include <wx/wx.h>
+
+#if wxUSE_ODCOMBOBOX
+#undef wxXTRA_XH_ODCOMBO
+#include <wx/xrc/xh_odcombo.h>
+#else
+#define wxXTRA_XH_ODCOMBO 1
+
+#include <wx/xrc/xmlres.h>
+
+class WXDLLIMPEXP_XRC wxOwnerDrawnComboBoxXmlHandler : public wxXmlResourceHandler
+{
+DECLARE_DYNAMIC_CLASS(wxOwnerDrawnComboBoxXmlHandler)
+public:
+    wxOwnerDrawnComboBoxXmlHandler();
+    virtual wxObject *DoCreateResource();
+    virtual bool CanHandle(wxXmlNode *node);
+private:
+    bool m_insideBox;
+    wxArrayString strList;
+};
+
+#endif // wxUSE_ODCOMBOBOX
+
+#endif // _WXXTA_XH_ODCOMBO_H_
Index: Trunk/XaraLX/wxXtra/odcombo.h
===================================================================
--- Trunk/XaraLX/wxXtra/odcombo.h	(revision 1416)
+++ Trunk/XaraLX/wxXtra/odcombo.h	(revision 1417)
@@ -29,6 +29,7 @@
 #include <wx/vlbox.h>
 #include "combo.h"
 
+
 //
 // New window styles for wxOwnerDrawnComboBox
 //
@@ -45,13 +46,13 @@
 
 
 //
-// Callback flags
+// Callback flags (see wxOwnerDrawnComboBox::OnDrawItem)
 //
 enum
 {
     // when set, we are painting the selected item in control,
     // not in the popup
-    wxODCB_PAINTING_CONTROL           = 0x0001
+    wxODCB_PAINTING_CONTROL         = 0x0001
 };
 
 
@@ -60,14 +61,15 @@
 //
 // Notes:
 //   wxOwnerDrawnComboBox uses this as its popup. However, it always derives
-//   from native wxComboControl. If you need to use this popup with
+//   from native wxComboCtrl. If you need to use this popup with
 //   wxGenericComboControl, then remember that vast majority of item manipulation
 //   functionality is implemented in the wxVListBoxComboPopup class itself.
 //
 // ----------------------------------------------------------------------------
 
 
-class WXDLLEXPORT wxVListBoxComboPopup : public wxVListBox, public wxComboPopup
+class WXDLLIMPEXP_ADV wxVListBoxComboPopup : public wxVListBox,
+                                             public wxComboPopup
 {
     friend class wxOwnerDrawnComboBox;
 public:
@@ -91,29 +93,18 @@
     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 Delete( unsigned int item );
+    void SetItemClientData(unsigned int n, void* clientData, wxClientDataType clientDataItemsType);
+    void *GetItemClientData(unsigned int n) const;
     void SetString( int item, const wxString& str );
     wxString GetString( int item ) const;
-    int GetCount() const;
-    int FindString(const wxString& s) const;
+    unsigned int GetCount() const;
+    int FindString(const wxString& s, bool bCase = false) const;
     int GetSelection() const;
 
     //void Populate( int n, const wxString choices[] );
@@ -125,8 +116,6 @@
     wxCoord GetTotalHeight() const { return EstimateTotalHeight(); }
     wxCoord GetLineHeight(int line) const { return OnGetLineHeight(line); }
 
-	int GetWidestItemWidth() { return m_widestWidth; }
-
 protected:
 
     // Called by OnComboDoubleClick and OnComboKeyEvent
@@ -134,21 +123,42 @@
 
     // sends combobox select event from the parent combo control
     void SendComboBoxEvent( int selection );
-    
+
     // gets value, sends event and dismisses
     void DismissWithEvent();
 
-    // Re-calculates width for given item
-    void CheckWidth( int pos );
+    // OnMeasureItemWidth will be called on next GetAdjustedSize.
+    void ItemWidthChanged(unsigned int item)
+    {
+        m_widths[item] = -1;
+        m_widthsDirty = true;
+    }
 
-    // wxVListBox implementation
+    // Callbacks for drawing and measuring items. Override in a derived class for
+    // owner-drawnness. Font, background and text colour have been prepared according
+    // to selection, focus and such.
+    //
+    // item: item index to be drawn, may be wxNOT_FOUND when painting combo control itself
+    //       and there is no valid selection
+    // flags: wxODCB_PAINTING_CONTROL is set if painting to combo control instead of list
+    // NOTE: If wxVListBoxComboPopup is used with wxComboCtrl class not derived from
+    //       wxOwnerDrawnComboBox, this method must be overridden.
+    virtual void OnDrawItem( wxDC& dc, const wxRect& rect, int item, int flags ) const;
+
+    // This is same as in wxVListBox
+    virtual wxCoord OnMeasureItem( size_t item ) const;
+
+    // Return item width, or -1 for calculating from text extent (default)
+    virtual wxCoord OnMeasureItemWidth( size_t item ) const;
+
+    // Draw item and combo control background. Flags are same as with OnDrawItem.
+    // NB: Can't use name OnDrawBackground because of virtual function hiding warnings.
+    virtual void OnDrawBg(wxDC& dc, const wxRect& rect, int item, int flags) const;
+
+    // Additional wxVListBox implementation (no need to override in derived classes)
     virtual void OnDrawItem(wxDC& dc, const wxRect& rect, 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);
@@ -156,27 +166,47 @@
     void OnKey(wxKeyEvent& event);
     void OnLeftClick(wxMouseEvent& event);
 
+    // Return the widest item width (recalculating it if necessary)
+    int GetWidestItemWidth() { CalcWidths(); return m_widestWidth; }
+
+    // Return the index of the widest item (recalculating it if necessary)
+    int GetWidestItem() { CalcWidths(); return m_widestItem; }
+
     wxArrayString           m_strings;
     wxArrayPtrVoid          m_clientDatas;
-    wxArrayInt              m_widths; // cached line widths
 
     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
-    int                     m_avgCharWidth;
-    int                     m_baseImageWidth; // how much per item drawn in addition to text
     int                     m_itemHeight; // default item height (calculate from font size
                                           // and used in the absence of callback)
     wxClientDataType        m_clientDataItemsType;
 
 private:
 
+    // Cached item widths (in pixels).
+    wxArrayInt              m_widths;
+
+    // Width of currently widest item.
+    int                     m_widestWidth;
+
+    // Index of currently widest item.
+    int                     m_widestItem;
+
+    // Measure some items in next GetAdjustedSize?
+    bool                    m_widthsDirty;
+
+    // Find widest item in next GetAdjustedSize?
+    bool                    m_findWidest;
+
     // has the mouse been released on this control?
-    bool m_clicked;
+    bool                    m_clicked;
 
+    // Recalculate widths if they are dirty
+    void CalcWidths();
+
     DECLARE_EVENT_TABLE()
 };
 
@@ -184,17 +214,18 @@
 // ----------------------------------------------------------------------------
 // wxOwnerDrawnComboBox: a generic wxComboBox that allows custom paint items
 // in addition to many other types of customization already allowed by
-// the wxComboControl.
+// the wxComboCtrl.
 // ----------------------------------------------------------------------------
 
-class WXDLLEXPORT wxOwnerDrawnComboBox : public wxComboControl, public wxItemContainer
+class WXDLLIMPEXP_ADV wxOwnerDrawnComboBox : public wxComboCtrl,
+                                             public wxItemContainer
 {
-    friend class wxComboPopupWindow;
-    friend class wxComboControlBase;
+    //friend class wxComboPopupWindow;
+    friend class wxVListBoxComboPopup;
 public:
 
     // ctors and such
-    wxOwnerDrawnComboBox() : wxComboControl() { Init(); }
+    wxOwnerDrawnComboBox() : wxComboCtrl() { Init(); }
 
     wxOwnerDrawnComboBox(wxWindow *parent,
                          wxWindowID id,
@@ -206,7 +237,7 @@
                          long style = 0,
                          const wxValidator& validator = wxDefaultValidator,
                          const wxString& name = wxComboBoxNameStr)
-        : wxComboControl()
+        : wxComboCtrl()
     {
         Init();
 
@@ -229,17 +260,17 @@
                          const wxPoint& pos,
                          const wxSize& size,
                          const wxArrayString& choices,
-                         long style = 0,
+                         long style,
                          const wxValidator& validator = wxDefaultValidator,
                          const wxString& name = wxComboBoxNameStr);
 
     bool Create(wxWindow *parent,
                 wxWindowID id,
-                const wxString& value = wxEmptyString,
-                const wxPoint& pos = wxDefaultPosition,
-                const wxSize& size = wxDefaultSize,
-                int n = 0,
-                const wxString choices[] = (const wxString *) NULL,
+                const wxString& value,
+                const wxPoint& pos,
+                const wxSize& size,
+                int n,
+                const wxString choices[],
                 long style = 0,
                 const wxValidator& validator = wxDefaultValidator,
                 const wxString& name = wxComboBoxNameStr);
@@ -256,37 +287,76 @@
 
     virtual ~wxOwnerDrawnComboBox();
 
-    // NULL popup can be used to indicate default interface
-    virtual void SetPopupControl( wxComboPopup* popup );
+    // Prevent app from using wxComboPopup
+    void SetPopupControl(wxVListBoxComboPopup* popup)
+    {
+        DoSetPopupControl(popup);
+    }
 
     // wxControlWithItems methods
     virtual void Clear();
-    virtual void Delete(int n);
-    virtual int GetCount() const;
-    virtual wxString GetString(int n) const;
-    virtual void SetString(int n, const wxString& s);
-    virtual int FindString(const wxString& s) const;
+    virtual void Delete(wxIndex n);
+    virtual wxIndex GetCount() const;
+    virtual wxString GetString(wxIndex n) const;
+    virtual void SetString(wxIndex n, const wxString& s);
+    virtual int FindString(const wxString& s, bool bCase /*= false*/) const;
+    virtual int FindString(const wxString& s) const {return FindString (s, false);}
     virtual void Select(int n);
     virtual int GetSelection() const;
-    void SetSelection(int n) { Select(n); }
+    virtual void SetSelection(int n) { Select(n); }
 
+
+    // Prevent a method from being hidden
+    virtual void SetSelection(long from, long to)
+    {
+        wxComboCtrl::SetSelection(from,to);
+    }
+
+    // Return the widest item width (recalculating it if necessary)
+    virtual int GetWidestItemWidth() { EnsurePopupControl(); return GetVListBoxComboPopup()->GetWidestItemWidth(); }
+
+    // Return the index of the widest item (recalculating it if necessary)
+    virtual int GetWidestItem() { EnsurePopupControl(); return GetVListBoxComboPopup()->GetWidestItem(); }
+
     wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST
 
 protected:
 
+    // Callback for drawing. Font, background and text colour have been
+    // prepared according to selection, focus and such.
+    // item: item index to be drawn, may be wxNOT_FOUND when painting combo control itself
+    //       and there is no valid selection
+    // flags: wxODCB_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;
+
+    // Callback for item height, or -1 for default
+    virtual wxCoord OnMeasureItem( size_t item ) const;
+
+    // Callback for item width, or -1 for default/undetermined
+    virtual wxCoord OnMeasureItemWidth( size_t item ) const;
+
+    // Callback for background drawing. Flags are same as with
+    // OnDrawItem.
+    virtual void OnDrawBackground( wxDC& dc, const wxRect& rect, int item, int flags ) const;
+
+    // NULL popup can be used to indicate default interface
+    virtual void DoSetPopupControl(wxComboPopup* popup);
+
     // clears all allocated client datas
     void ClearClientDatas();
 
+    wxVListBoxComboPopup* GetVListBoxComboPopup() const
+    {
+        return (wxVListBoxComboPopup*) m_popupInterface;
+    }
+
     virtual int DoAppend(const wxString& item);
-    virtual int DoInsert(const wxString& item, int pos);
-    virtual void DoSetItemClientData(int n, void* clientData);
-    virtual void* DoGetItemClientData(int n) const;
-    virtual void DoSetItemClientObject(int n, wxClientData* clientData);
-    virtual wxClientData* DoGetItemClientObject(int n) const;
+    virtual int DoInsert(const wxString& item, wxIndex pos);
+    virtual void DoSetItemClientData(wxIndex n, void* clientData);
+    virtual void* DoGetItemClientData(wxIndex n) const;
+    virtual void DoSetItemClientObject(wxIndex n, wxClientData* clientData);
+    virtual wxClientData* DoGetItemClientObject(wxIndex n) const;
 
-    // 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;
@@ -300,21 +370,6 @@
     DECLARE_DYNAMIC_CLASS(wxOwnerDrawnComboBox)
 };
 
-
-#endif // wxUSE_OWNERDRAWNCOMBOBOX
-
-#ifdef WXXTRA_COMBO_XML_HANDLERS
-class WXDLLIMPEXP_XRC wxOwnerDrawnComboBoxXmlHandler : public wxXmlResourceHandler
-{
-DECLARE_DYNAMIC_CLASS(wxOwnerDrawnComboBoxXmlHandler)
-public:
-    wxOwnerDrawnComboBoxXmlHandler();
-    virtual wxObject *DoCreateResource();
-    virtual bool CanHandle(wxXmlNode *node);
-private:
-    bool m_insideBox;
-    wxArrayString strList;
-};
 #endif
 
 #endif
Index: Trunk/XaraLX/wxXtra/Makefile.am
===================================================================
--- Trunk/XaraLX/wxXtra/Makefile.am	(revision 1416)
+++ Trunk/XaraLX/wxXtra/Makefile.am	(revision 1417)
@@ -8,7 +8,7 @@
 # the application source, library search path, and link libraries
 libwxXtra_a_SOURCES = \
 	framemanager.cpp floatpane.cpp dockart.cpp \
-	doublebuffer.cpp cwfrompoint.cpp combo.cpp combog.cpp odcombo.cpp \
+	doublebuffer.cpp cwfrompoint.cpp combo.cpp combog.cpp odcombo.cpp xh_odcombo.cpp\
 	platform.cpp advsplash.cpp treebook.cpp xh_treebk.cpp
 
 # make sure this does NOT have our include files in the path
Index: Trunk/XaraLX/wxOil/camresource.cpp
===================================================================
--- Trunk/XaraLX/wxOil/camresource.cpp	(revision 1416)
+++ Trunk/XaraLX/wxOil/camresource.cpp	(revision 1417)
@@ -1449,9 +1449,9 @@
 #if !defined(EXCLUDE_FROM_XARLIB)
 	wxXmlResource::Get()->AddHandler(new wxCamArtControlXmlHandler);
 	wxXmlResource::Get()->AddHandler(new wxCamDrawControlXmlHandler);
-#ifdef WXXTRA_COMBO_XML_HANDLERS
+#ifdef wxXTRA_XH_ODCOMBO
 	wxXmlResource::Get()->AddHandler(new wxOwnerDrawnComboBoxXmlHandler);
-	wxXmlResource::Get()->AddHandler(new wxComboControlXmlHandler);
+//	wxXmlResource::Get()->AddHandler(new wxComboControlXmlHandler);
 #endif
 #if WXXTRA_TREEBOOK
 	wxXmlResource::Get()->AddHandler(new wxTreebookXmlHandler);


Xara