]> git.saurik.com Git - wxWidgets.git/blobdiff - src/palmos/treectrl.cpp
Fixed linking errors related to wxAnyButton in wxUniv.
[wxWidgets.git] / src / palmos / treectrl.cpp
index f8e143d9494f1d8108f0b72f94a4d150f3c6596d..b7f12e18c015aa6a77f327f51a365380edee9d3f 100644 (file)
@@ -1,10 +1,10 @@
 /////////////////////////////////////////////////////////////////////////////
 // Name:        src/palmos/treectrl.cpp
 // Purpose:     wxTreeCtrl
-// Author:      William Osborne
+// Author:      William Osborne - minimal working wxPalmOS port
 // Modified by:
 // Created:     10/13/04
-// RCS-ID:      $Id
+// RCS-ID:      $Id$
 // Copyright:   (c) William Osborne
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 // headers
 // ----------------------------------------------------------------------------
 
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
-    #pragma implementation "treectrl.h"
-#endif
-
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
 
 #if wxUSE_TREECTRL
 
-#include "wx/palmos/private.h"
+#include "wx/treectrl.h"
 
-// Set this to 1 to be _absolutely_ sure that repainting will work for all
-// comctl32.dll versions
-#define wxUSE_COMCTL32_SAFELY 0
+#ifndef WX_PRECOMP
+    #include "wx/dynarray.h"
+    #include "wx/log.h"
+    #include "wx/app.h"
+    #include "wx/settings.h"
+#endif
 
-#include "wx/app.h"
-#include "wx/log.h"
-#include "wx/dynarray.h"
 #include "wx/imaglist.h"
-#include "wx/settings.h"
-#include "wx/msw/treectrl.h"
-#include "wx/msw/dragimag.h"
-
-#include "wx/palmos/wrapcctl.h"
 
 // macros to hide the cast ugliness
 // --------------------------------
 // wxWin macros
 // ----------------------------------------------------------------------------
 
-#if wxUSE_EXTENDED_RTTI
-WX_DEFINE_FLAGS( wxTreeCtrlStyle )
-
-wxBEGIN_FLAGS( wxTreeCtrlStyle )
-    // new style border flags, we put them first to
-    // use them for streaming out
-    wxFLAGS_MEMBER(wxBORDER_SIMPLE)
-    wxFLAGS_MEMBER(wxBORDER_SUNKEN)
-    wxFLAGS_MEMBER(wxBORDER_DOUBLE)
-    wxFLAGS_MEMBER(wxBORDER_RAISED)
-    wxFLAGS_MEMBER(wxBORDER_STATIC)
-    wxFLAGS_MEMBER(wxBORDER_NONE)
-
-    // old style border flags
-    wxFLAGS_MEMBER(wxSIMPLE_BORDER)
-    wxFLAGS_MEMBER(wxSUNKEN_BORDER)
-    wxFLAGS_MEMBER(wxDOUBLE_BORDER)
-    wxFLAGS_MEMBER(wxRAISED_BORDER)
-    wxFLAGS_MEMBER(wxSTATIC_BORDER)
-    wxFLAGS_MEMBER(wxBORDER)
-
-    // standard window styles
-    wxFLAGS_MEMBER(wxTAB_TRAVERSAL)
-    wxFLAGS_MEMBER(wxCLIP_CHILDREN)
-    wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW)
-    wxFLAGS_MEMBER(wxWANTS_CHARS)
-    wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE)
-    wxFLAGS_MEMBER(wxALWAYS_SHOW_SB )
-    wxFLAGS_MEMBER(wxVSCROLL)
-    wxFLAGS_MEMBER(wxHSCROLL)
-
-    wxFLAGS_MEMBER(wxTR_EDIT_LABELS)
-    wxFLAGS_MEMBER(wxTR_NO_BUTTONS)
-    wxFLAGS_MEMBER(wxTR_HAS_BUTTONS)
-    wxFLAGS_MEMBER(wxTR_TWIST_BUTTONS)
-    wxFLAGS_MEMBER(wxTR_NO_LINES)
-    wxFLAGS_MEMBER(wxTR_FULL_ROW_HIGHLIGHT)
-    wxFLAGS_MEMBER(wxTR_LINES_AT_ROOT)
-    wxFLAGS_MEMBER(wxTR_HIDE_ROOT)
-    wxFLAGS_MEMBER(wxTR_ROW_LINES)
-    wxFLAGS_MEMBER(wxTR_HAS_VARIABLE_ROW_HEIGHT)
-    wxFLAGS_MEMBER(wxTR_SINGLE)
-    wxFLAGS_MEMBER(wxTR_MULTIPLE)
-    wxFLAGS_MEMBER(wxTR_EXTENDED)
-    wxFLAGS_MEMBER(wxTR_DEFAULT_STYLE)
-
-wxEND_FLAGS( wxTreeCtrlStyle )
-
-IMPLEMENT_DYNAMIC_CLASS_XTI(wxTreeCtrl, wxControl,"wx/treectrl.h")
-
-wxBEGIN_PROPERTIES_TABLE(wxTreeCtrl)
-    wxEVENT_PROPERTY( TextUpdated , wxEVT_COMMAND_TEXT_UPDATED , wxCommandEvent )
-    wxEVENT_RANGE_PROPERTY( TreeEvent , wxEVT_COMMAND_TREE_BEGIN_DRAG , wxEVT_COMMAND_TREE_STATE_IMAGE_CLICK , wxTreeEvent )
-    wxPROPERTY_FLAGS( WindowStyle , wxTreeCtrlStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
-wxEND_PROPERTIES_TABLE()
-
-wxBEGIN_HANDLERS_TABLE(wxTreeCtrl)
-wxEND_HANDLERS_TABLE()
-
-wxCONSTRUCTOR_5( wxTreeCtrl , wxWindow* , Parent , wxWindowID , Id , wxPoint , Position , wxSize , Size , long , WindowStyle )
-#else
-IMPLEMENT_DYNAMIC_CLASS(wxTreeCtrl, wxControl)
-#endif
-
 // ----------------------------------------------------------------------------
 // constants
 // ----------------------------------------------------------------------------
@@ -222,8 +149,9 @@ void wxTreeCtrl::DoSetItem(wxTreeViewItem* tvItem)
 {
 }
 
-size_t wxTreeCtrl::GetCount() const
+unsigned int wxTreeCtrl::GetCount() const
 {
+    // TODO
     return 0;
 }
 
@@ -292,7 +220,7 @@ bool wxTreeCtrl::SetForegroundColour(const wxColour &colour)
 
 wxString wxTreeCtrl::GetItemText(const wxTreeItemId& item) const
 {
-    return wxString;
+    return wxString(wxT(""));
 }
 
 void wxTreeCtrl::SetItemText(const wxTreeItemId& item, const wxString& text)
@@ -427,11 +355,7 @@ bool wxTreeCtrl::IsBold(const wxTreeItemId& item) const
 
 wxTreeItemId wxTreeCtrl::GetRootItem() const
 {
-    // Root may be real (visible) or virtual (hidden).
-    if ( GET_VIRTUAL_ROOT() )
-        return TVI_ROOT;
-
-    return wxTreeItemId(TreeView_GetRoot(GetHwnd()));
+    return wxTreeItemId();
 }
 
 wxTreeItemId wxTreeCtrl::GetSelection() const
@@ -456,22 +380,6 @@ wxTreeItemId wxTreeCtrl::GetNextChild(const wxTreeItemId& WXUNUSED(item),
     return 0;
 }
 
-#if WXWIN_COMPATIBILITY_2_4
-
-wxTreeItemId wxTreeCtrl::GetFirstChild(const wxTreeItemId& item,
-                                       long& cookie) const
-{
-    return 0;
-}
-
-wxTreeItemId wxTreeCtrl::GetNextChild(const wxTreeItemId& WXUNUSED(item),
-                                      long& cookie) const
-{
-    return 0;
-}
-
-#endif // WXWIN_COMPATIBILITY_2_4
-
 wxTreeItemId wxTreeCtrl::GetLastChild(const wxTreeItemId& item) const
 {
     return 0;
@@ -533,19 +441,6 @@ wxTreeItemId wxTreeCtrl::DoInsertItem(const wxTreeItemId& parent,
     return 0;
 }
 
-// for compatibility only
-#if WXWIN_COMPATIBILITY_2_4
-
-wxTreeItemId wxTreeCtrl::InsertItem(const wxTreeItemId& parent,
-                                    const wxString& text,
-                                    int image, int selImage,
-                                    long insertAfter)
-{
-    return 0;
-}
-
-#endif // WXWIN_COMPATIBILITY_2_4
-
 wxTreeItemId wxTreeCtrl::AddRoot(const wxString& text,
                                  int image, int selectedImage,
                                  wxTreeItemData *data)
@@ -589,7 +484,6 @@ wxTreeItemId wxTreeCtrl::AppendItem(const wxTreeItemId& parent,
 
 void wxTreeCtrl::Delete(const wxTreeItemId& item)
 {
-    return 0;
 }
 
 // delete all children (but don't delete the item itself)
@@ -621,12 +515,6 @@ void wxTreeCtrl::Toggle(const wxTreeItemId& item)
 {
 }
 
-#if WXWIN_COMPATIBILITY_2_4
-void wxTreeCtrl::ExpandItem(const wxTreeItemId& item, int action)
-{
-}
-#endif
-
 void wxTreeCtrl::Unselect()
 {
 }
@@ -691,6 +579,7 @@ bool wxTreeCtrl::GetBoundingRect(const wxTreeItemId& item,
 // sorting stuff
 // ----------------------------------------------------------------------------
 
+/*
 // this is just a tiny namespace which is friend to wxTreeCtrl and so can use
 // functions such as IsDataIndirect()
 class wxTreeSortHelper
@@ -699,15 +588,9 @@ public:
     static int CALLBACK Compare(LPARAM data1, LPARAM data2, LPARAM tree);
 
 private:
-    static wxTreeItemId GetIdFromData(wxTreeCtrl *tree, LPARAM item)
+    static wxTreeItemId GetIdFromData(LPARAM lParam)
     {
-        wxTreeItemData *data = (wxTreeItemData *)item;
-        if ( tree->IsDataIndirect(data) )
-        {
-            data = ((wxTreeItemIndirectData *)data)->GetData();
-        }
-
-        return data->GetId();
+        return ((wxTreeItemParam*)lParam)->GetItem();
     }
 };
 
@@ -723,7 +606,7 @@ int CALLBACK wxTreeSortHelper::Compare(LPARAM pItem1,
     return tree->OnCompareItems(GetIdFromData(tree, pItem1),
                                 GetIdFromData(tree, pItem2));
 }
-
+*/
 int wxTreeCtrl::OnCompareItems(const wxTreeItemId& item1,
                                const wxTreeItemId& item2)
 {
@@ -734,41 +617,6 @@ void wxTreeCtrl::SortChildren(const wxTreeItemId& item)
 {
     wxCHECK_RET( item.IsOk(), wxT("invalid tree item") );
 
-    // rely on the fact that TreeView_SortChildren does the same thing as our
-    // default behaviour, i.e. sorts items alphabetically and so call it
-    // directly if we're not in derived class (much more efficient!)
-    if ( GetClassInfo() == CLASSINFO(wxTreeCtrl) )
-    {
-        TreeView_SortChildren(GetHwnd(), HITEM(item), 0);
-    }
-    else
-    {
-        TV_SORTCB tvSort;
-        tvSort.hParent = HITEM(item);
-        tvSort.lpfnCompare = wxTreeSortHelper::Compare;
-        tvSort.lParam = (LPARAM)this;
-        TreeView_SortChildrenCB(GetHwnd(), &tvSort, 0 /* reserved */);
-    }
-}
-
-// ----------------------------------------------------------------------------
-// implementation
-// ----------------------------------------------------------------------------
-
-bool wxTreeCtrl::MSWCommand(WXUINT cmd, WXWORD id)
-{
-    return false;
-}
-
-WXLRESULT wxTreeCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
-{
-    return 0;
-}
-
-// process WM_NOTIFY Windows message
-bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
-{
-    return false;
 }
 
 // ----------------------------------------------------------------------------
@@ -788,4 +636,3 @@ int wxTreeCtrl::GetState(const wxTreeItemId& node)
 }
 
 #endif // wxUSE_TREECTRL
-