ClassTree

This is the tree view for classes. It extends the wxTreeCtrl to handle drag and drop in a more suitable manner. It provides methods to help methods and variables figure out were their parents are and how they can fit into the class in a reasonable way (ie a method can not be put inside a method but a variable can).



public:

ClassTree( wxWindow* pParent, ClassObjectPtr pClass, int Style, ClassDialogView* pParentDialog=NULL)

~ClassTree( )

static const int ID_THIS=1112

void PaintToDC( wxDC& DC)

this is a pretty huge one. It took a fair amount of fighting with wxWindows to make this happen. The idea is I need to paint to any DC. Specifically when generating an image for the HTML docs I need to paint to a memory DC. I imagine it will come in handy for printing as well. I HATE that it was so freaking difficult to make this happen. I ended up figuring it out by copying the wx source and dropping it in here.

std::list GetFullPath( const wxTreeItemId& Item)

gets the full path to the passed in Item. The Item is the last entry in the path.

TreeView* GetNodeOrAncestorView( const wxTreeItemId& ID)

TreeView* GetContainingView( TreeView* pPossibleParent, TreeView* pChildView)

TreeView* GetParentView( TreeView* pChildView)

bool OnDropText( wxCoord x, wxCoord y, const wxString& StringData)

ClassObjectPtr GetClass( ) const

bool EmbeddedInDialog( ) const

void SetUpdateRegion( const wxRect& Rect)

When you want to draw this thing to a specific DC you will need to first blow away the update region. You can use this function to do it. Only required in Linux, becomes a noop in Windows.

protected:


private:

static const int ID_TIMER=1113

void OnMouseMove( wxMouseEvent& Event)

void OnLeftDown( wxMouseEvent& Event)

The default behavior is to expand or contract the tree. I would prefer to have it bring up the info.

void OnLeftDoubleClick( wxMouseEvent& Event)

The default behavior is to expand or contract the tree. I would prefer to have it bring up the info.

void OnTreeMenu( wxTreeEvent& Event)

void OnTreeViewMenuEvent( wxCommandEvent& Event)

void OnTreeBeginDrag( wxTreeEvent& Event)

void OnTimer( wxTimerEvent& Event)

void OnBeginLabelEdit( wxTreeEvent& Event)

void OnEndLabelEdit( wxTreeEvent& Event)

ClassObjectPtr m_pClass

static bool m_DropSuccess

This one is a hack. What's going on is that despite what the docs say, I can't signal an error from within the OnDropText function. So I need some kind of flag. I have to make it static because neither member of the action has access to the other.

ClassDialogView* m_pParentDialog

TreeView* m_pContextMenuSource

The source of the current shown context menu. Needed because when a choice is made from the context menu we need to know which object in the tree we're referring to. In Windows the item is NOT selected so we can't use GetSelection.

wxTreeItemId m_ContextMenuSourceID

pairs with the m_pContextMenuSource. This is the actual ID that was clicked on. Could be useful if the user clicks on public/private/protected, which doesn't have a view.

wxTimer m_Timer

std::string m_TipText

wxPoint m_TipPosition

DECLARE_EVENT_TABLE()