cleanup - reformatting
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37336 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: treectrl.cpp
|
// Name: src/mac/carbon/treectrl.cpp
|
||||||
// Purpose: wxTreeCtrl. See also Robert's generic wxTreeCtrl.
|
// Purpose: wxTreeCtrl. See also Robert's generic wxTreeCtrl.
|
||||||
// Author: Stefan Csomor
|
// Author: Stefan Csomor
|
||||||
// Modified by:
|
// Modified by:
|
||||||
@@ -15,9 +15,11 @@
|
|||||||
#include "wx/treebase.h"
|
#include "wx/treebase.h"
|
||||||
#include "wx/stubs/treectrl.h"
|
#include "wx/stubs/treectrl.h"
|
||||||
|
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxTreeCtrl, wxControl)
|
IMPLEMENT_DYNAMIC_CLASS(wxTreeCtrl, wxControl)
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxTreeItem, wxObject)
|
IMPLEMENT_DYNAMIC_CLASS(wxTreeItem, wxObject)
|
||||||
|
|
||||||
|
|
||||||
wxTreeCtrl::wxTreeCtrl()
|
wxTreeCtrl::wxTreeCtrl()
|
||||||
{
|
{
|
||||||
m_imageListNormal = NULL;
|
m_imageListNormal = NULL;
|
||||||
@@ -25,35 +27,33 @@ wxTreeCtrl::wxTreeCtrl()
|
|||||||
m_textCtrl = NULL;
|
m_textCtrl = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxTreeCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
|
bool wxTreeCtrl::Create(wxWindow *parent,
|
||||||
long style, const wxValidator& validator, const wxString& name)
|
wxWindowID id, const wxPoint& pos, const wxSize& size,
|
||||||
|
long style, const wxValidator& validator, const wxString& name)
|
||||||
{
|
{
|
||||||
SetName(name);
|
|
||||||
SetValidator(validator);
|
|
||||||
|
|
||||||
m_imageListNormal = NULL;
|
m_imageListNormal = NULL;
|
||||||
m_imageListState = NULL;
|
m_imageListState = NULL;
|
||||||
m_textCtrl = NULL;
|
m_textCtrl = NULL;
|
||||||
|
|
||||||
m_windowStyle = style;
|
SetName(name);
|
||||||
|
SetValidator(validator);
|
||||||
SetParent(parent);
|
SetParent(parent);
|
||||||
|
|
||||||
|
m_windowStyle = style;
|
||||||
|
|
||||||
m_windowId = (id == -1) ? NewControlId() : id;
|
m_windowId = (id == -1) ? NewControlId() : id;
|
||||||
|
|
||||||
if (parent) parent->AddChild(this);
|
if (parent)
|
||||||
|
parent->AddChild(this);
|
||||||
|
|
||||||
// TODO create tree control
|
// TODO: create tree control
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxTreeCtrl::~wxTreeCtrl()
|
wxTreeCtrl::~wxTreeCtrl()
|
||||||
{
|
{
|
||||||
if (m_textCtrl)
|
delete m_textCtrl;
|
||||||
{
|
|
||||||
delete m_textCtrl;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes
|
// Attributes
|
||||||
@@ -77,26 +77,20 @@ void wxTreeCtrl::SetIndent(int indent)
|
|||||||
wxImageList *wxTreeCtrl::GetImageList(int which) const
|
wxImageList *wxTreeCtrl::GetImageList(int which) const
|
||||||
{
|
{
|
||||||
if ( which == wxIMAGE_LIST_NORMAL )
|
if ( which == wxIMAGE_LIST_NORMAL )
|
||||||
{
|
|
||||||
return m_imageListNormal;
|
return m_imageListNormal;
|
||||||
}
|
|
||||||
else if ( which == wxIMAGE_LIST_STATE )
|
else if ( which == wxIMAGE_LIST_STATE )
|
||||||
{
|
|
||||||
return m_imageListState;
|
return m_imageListState;
|
||||||
}
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxTreeCtrl::SetImageList(wxImageList *imageList, int which)
|
void wxTreeCtrl::SetImageList(wxImageList *imageList, int which)
|
||||||
{
|
{
|
||||||
if ( which == wxIMAGE_LIST_NORMAL )
|
if ( which == wxIMAGE_LIST_NORMAL )
|
||||||
{
|
|
||||||
m_imageListNormal = imageList;
|
m_imageListNormal = imageList;
|
||||||
}
|
|
||||||
else if ( which == wxIMAGE_LIST_STATE )
|
else if ( which == wxIMAGE_LIST_STATE )
|
||||||
{
|
|
||||||
m_imageListState = imageList;
|
m_imageListState = imageList;
|
||||||
}
|
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,7 +103,7 @@ long wxTreeCtrl::GetNextItem(long item, int code) const
|
|||||||
bool wxTreeCtrl::ItemHasChildren(long item) const
|
bool wxTreeCtrl::ItemHasChildren(long item) const
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
long wxTreeCtrl::GetChild(long item) const
|
long wxTreeCtrl::GetChild(long item) const
|
||||||
@@ -151,20 +145,20 @@ long wxTreeCtrl::GetRootItem() const
|
|||||||
bool wxTreeCtrl::GetItem(wxTreeItem& info) const
|
bool wxTreeCtrl::GetItem(wxTreeItem& info) const
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxTreeCtrl::SetItem(wxTreeItem& info)
|
bool wxTreeCtrl::SetItem(wxTreeItem& info)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxTreeCtrl::GetItemState(long item, long stateMask) const
|
int wxTreeCtrl::GetItemState(long item, long stateMask) const
|
||||||
{
|
{
|
||||||
wxTreeItem info;
|
wxTreeItem info;
|
||||||
|
|
||||||
info.m_mask = wxTREE_MASK_STATE ;
|
info.m_mask = wxTREE_MASK_STATE;
|
||||||
info.m_stateMask = stateMask;
|
info.m_stateMask = stateMask;
|
||||||
info.m_itemId = item;
|
info.m_itemId = item;
|
||||||
|
|
||||||
@@ -178,7 +172,7 @@ bool wxTreeCtrl::SetItemState(long item, long state, long stateMask)
|
|||||||
{
|
{
|
||||||
wxTreeItem info;
|
wxTreeItem info;
|
||||||
|
|
||||||
info.m_mask = wxTREE_MASK_STATE ;
|
info.m_mask = wxTREE_MASK_STATE;
|
||||||
info.m_state = state;
|
info.m_state = state;
|
||||||
info.m_stateMask = stateMask;
|
info.m_stateMask = stateMask;
|
||||||
info.m_itemId = item;
|
info.m_itemId = item;
|
||||||
@@ -190,13 +184,14 @@ bool wxTreeCtrl::SetItemImage(long item, int image, int selImage)
|
|||||||
{
|
{
|
||||||
wxTreeItem info;
|
wxTreeItem info;
|
||||||
|
|
||||||
info.m_mask = wxTREE_MASK_IMAGE ;
|
info.m_mask = wxTREE_MASK_IMAGE;
|
||||||
info.m_image = image;
|
info.m_image = image;
|
||||||
if ( selImage > -1)
|
if ( selImage > -1)
|
||||||
{
|
{
|
||||||
info.m_selectedImage = selImage;
|
info.m_selectedImage = selImage;
|
||||||
info.m_mask |= wxTREE_MASK_SELECTED_IMAGE;
|
info.m_mask |= wxTREE_MASK_SELECTED_IMAGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
info.m_itemId = item;
|
info.m_itemId = item;
|
||||||
|
|
||||||
return SetItem(info);
|
return SetItem(info);
|
||||||
@@ -206,11 +201,12 @@ wxString wxTreeCtrl::GetItemText(long item) const
|
|||||||
{
|
{
|
||||||
wxTreeItem info;
|
wxTreeItem info;
|
||||||
|
|
||||||
info.m_mask = wxTREE_MASK_TEXT ;
|
info.m_mask = wxTREE_MASK_TEXT;
|
||||||
info.m_itemId = item;
|
info.m_itemId = item;
|
||||||
|
|
||||||
if (!GetItem(info))
|
if (!GetItem(info))
|
||||||
return wxString("");
|
return wxEmptyString;
|
||||||
|
|
||||||
return info.m_text;
|
return info.m_text;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -218,7 +214,7 @@ void wxTreeCtrl::SetItemText(long item, const wxString& str)
|
|||||||
{
|
{
|
||||||
wxTreeItem info;
|
wxTreeItem info;
|
||||||
|
|
||||||
info.m_mask = wxTREE_MASK_TEXT ;
|
info.m_mask = wxTREE_MASK_TEXT;
|
||||||
info.m_itemId = item;
|
info.m_itemId = item;
|
||||||
info.m_text = str;
|
info.m_text = str;
|
||||||
|
|
||||||
@@ -229,11 +225,12 @@ long wxTreeCtrl::GetItemData(long item) const
|
|||||||
{
|
{
|
||||||
wxTreeItem info;
|
wxTreeItem info;
|
||||||
|
|
||||||
info.m_mask = wxTREE_MASK_DATA ;
|
info.m_mask = wxTREE_MASK_DATA;
|
||||||
info.m_itemId = item;
|
info.m_itemId = item;
|
||||||
|
|
||||||
if (!GetItem(info))
|
if (!GetItem(info))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return info.m_data;
|
return info.m_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -241,7 +238,7 @@ bool wxTreeCtrl::SetItemData(long item, long data)
|
|||||||
{
|
{
|
||||||
wxTreeItem info;
|
wxTreeItem info;
|
||||||
|
|
||||||
info.m_mask = wxTREE_MASK_DATA ;
|
info.m_mask = wxTREE_MASK_DATA;
|
||||||
info.m_itemId = item;
|
info.m_itemId = item;
|
||||||
info.m_data = data;
|
info.m_data = data;
|
||||||
|
|
||||||
@@ -251,10 +248,10 @@ bool wxTreeCtrl::SetItemData(long item, long data)
|
|||||||
bool wxTreeCtrl::GetItemRect(long item, wxRect& rect, bool textOnly) const
|
bool wxTreeCtrl::GetItemRect(long item, wxRect& rect, bool textOnly) const
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxTextCtrl* wxTreeCtrl::GetEditControl() const
|
wxTextCtrl * wxTreeCtrl::GetEditControl() const
|
||||||
{
|
{
|
||||||
return m_textCtrl;
|
return m_textCtrl;
|
||||||
}
|
}
|
||||||
@@ -263,7 +260,7 @@ wxTextCtrl* wxTreeCtrl::GetEditControl() const
|
|||||||
bool wxTreeCtrl::DeleteItem(long item)
|
bool wxTreeCtrl::DeleteItem(long item)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxTreeCtrl::ExpandItem(long item, int action)
|
bool wxTreeCtrl::ExpandItem(long item, int action)
|
||||||
@@ -284,17 +281,18 @@ bool wxTreeCtrl::ExpandItem(long item, int action)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
wxFAIL_MSG("unknown action in wxTreeCtrl::ExpandItem");
|
wxFAIL_MSG(wxT("unknown action in wxTreeCtrl::ExpandItem");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool bOk = FALSE; // TODO expand item
|
// TODO: expand item
|
||||||
|
bool bOk = false;
|
||||||
|
|
||||||
// May not send messages, so emulate them
|
// May not send messages, so emulate them
|
||||||
if ( bOk ) {
|
if ( bOk )
|
||||||
|
{
|
||||||
wxTreeEvent event(wxEVT_NULL, m_windowId);
|
wxTreeEvent event(wxEVT_NULL, m_windowId);
|
||||||
event.m_item.m_itemId = item;
|
event.m_item.m_itemId = item;
|
||||||
event.m_item.m_mask =
|
event.m_item.m_mask = event.m_item.m_stateMask = 0xFFFF; // get all
|
||||||
event.m_item.m_stateMask = 0xffff; // get all
|
|
||||||
GetItem(event.m_item);
|
GetItem(event.m_item);
|
||||||
|
|
||||||
bool bIsExpanded = (event.m_item.m_state & wxTREE_STATE_EXPANDED) != 0;
|
bool bIsExpanded = (event.m_item.m_state & wxTREE_STATE_EXPANDED) != 0;
|
||||||
@@ -303,11 +301,15 @@ bool wxTreeCtrl::ExpandItem(long item, int action)
|
|||||||
event.SetEventObject(this);
|
event.SetEventObject(this);
|
||||||
|
|
||||||
// @@@ return values of {EXPAND|COLLAPS}ING event handler is discarded
|
// @@@ return values of {EXPAND|COLLAPS}ING event handler is discarded
|
||||||
event.SetEventType(bIsExpanded ? wxEVT_COMMAND_TREE_ITEM_EXPANDING
|
event.SetEventType(
|
||||||
|
bIsExpanded
|
||||||
|
? wxEVT_COMMAND_TREE_ITEM_EXPANDING
|
||||||
: wxEVT_COMMAND_TREE_ITEM_COLLAPSING);
|
: wxEVT_COMMAND_TREE_ITEM_COLLAPSING);
|
||||||
GetEventHandler()->ProcessEvent(event);
|
GetEventHandler()->ProcessEvent(event);
|
||||||
|
|
||||||
event.SetEventType(bIsExpanded ? wxEVT_COMMAND_TREE_ITEM_EXPANDED
|
event.SetEventType(
|
||||||
|
bIsExpanded
|
||||||
|
? wxEVT_COMMAND_TREE_ITEM_EXPANDED
|
||||||
: wxEVT_COMMAND_TREE_ITEM_COLLAPSED);
|
: wxEVT_COMMAND_TREE_ITEM_COLLAPSED);
|
||||||
GetEventHandler()->ProcessEvent(event);
|
GetEventHandler()->ProcessEvent(event);
|
||||||
}
|
}
|
||||||
@@ -321,8 +323,8 @@ long wxTreeCtrl::InsertItem(long parent, wxTreeItem& info, long insertAfter)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
long wxTreeCtrl::InsertItem(long parent, const wxString& label, int image, int selImage,
|
long wxTreeCtrl::InsertItem(long parent, const wxString& label,
|
||||||
long insertAfter)
|
int image, int selImage, long insertAfter)
|
||||||
{
|
{
|
||||||
wxTreeItem info;
|
wxTreeItem info;
|
||||||
info.m_text = label;
|
info.m_text = label;
|
||||||
@@ -343,22 +345,22 @@ long wxTreeCtrl::InsertItem(long parent, const wxString& label, int image, int s
|
|||||||
bool wxTreeCtrl::SelectItem(long item)
|
bool wxTreeCtrl::SelectItem(long item)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxTreeCtrl::ScrollTo(long item)
|
bool wxTreeCtrl::ScrollTo(long item)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxTreeCtrl::DeleteAllItems()
|
bool wxTreeCtrl::DeleteAllItems()
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxTextCtrl* wxTreeCtrl::EditLabel(long item, wxClassInfo* textControlClass)
|
wxTextCtrl * wxTreeCtrl::EditLabel(long item, wxClassInfo* textControlClass)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -368,7 +370,7 @@ wxTextCtrl* wxTreeCtrl::EditLabel(long item, wxClassInfo* textControlClass)
|
|||||||
bool wxTreeCtrl::EndEditLabel(bool cancel)
|
bool wxTreeCtrl::EndEditLabel(bool cancel)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
long wxTreeCtrl::HitTest(const wxPoint& point, int& flags)
|
long wxTreeCtrl::HitTest(const wxPoint& point, int& flags)
|
||||||
@@ -380,13 +382,13 @@ long wxTreeCtrl::HitTest(const wxPoint& point, int& flags)
|
|||||||
bool wxTreeCtrl::SortChildren(long item)
|
bool wxTreeCtrl::SortChildren(long item)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxTreeCtrl::EnsureVisible(long item)
|
bool wxTreeCtrl::EnsureVisible(long item)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tree item structure
|
// Tree item structure
|
||||||
@@ -405,8 +407,8 @@ wxTreeItem::wxTreeItem()
|
|||||||
// Tree event
|
// Tree event
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxTreeEvent, wxCommandEvent)
|
IMPLEMENT_DYNAMIC_CLASS(wxTreeEvent, wxCommandEvent)
|
||||||
|
|
||||||
wxTreeEvent::wxTreeEvent(wxEventType commandType, int id):
|
wxTreeEvent::wxTreeEvent(wxEventType commandType, int id)
|
||||||
wxCommandEvent(commandType, id)
|
: wxCommandEvent(commandType, id)
|
||||||
{
|
{
|
||||||
m_code = 0;
|
m_code = 0;
|
||||||
m_oldItem = 0;
|
m_oldItem = 0;
|
||||||
|
Reference in New Issue
Block a user