Click here to Skip to main content
15,895,965 members
Articles / Desktop Programming / MFC

Be Sweet - a set of visual source code browsers

Rate me:
Please Sign up or sign in to vote.
4.85/5 (35 votes)
1 Jul 20038 min read 184.4K   4.9K   122  
A set of source code and project browsers to compliment Visual Studio.
/**
/*   Copyright (c) 2003by  Marco Welti
/*
/*   This document is  bound by the  QT Public License
/*   (http://www.trolltech.com/licenses/qpl.html).
/*   See License.txt for more information.
/*
/*
/*
/*   ALL RIGHTS RESERVED.  
/* 
/*   THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
/*   OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
/*   WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
/*   ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
/*   DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
/*   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
/*   GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
/*   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
/*   WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
/*   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
/*   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/* 
/***********************************************************************/

#if !defined(AFX_HIERARCHYBROWSERRENDERER_H__1896A006_5434_47A8_A950_0461CA7EA852__INCLUDED_)
#define AFX_HIERARCHYBROWSERRENDERER_H__1896A006_5434_47A8_A950_0461CA7EA852__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// HierarchyBrowserRenderer.h : header file
//

#include <Model/MetaModel/MetaModel.h>

#include <Renderer/MFC/3rdParty/BtnST.h>
#include <Renderer/MFC/3rdParty/xySplitterWnd.h>
#include <Renderer/MFC/Base/CustomDialog.h>
#include <Utilities/smart_ptr.h>


/////////////////////////////////////////////////////////////////////////////
// HierarchyBrowserRenderer dialog
class BCMenu;
class HierarchyBrowser;

enum HierarchyViewType { eFullHierarchy, eSubtypesOnly, eSupertypesOnly };

class HierarchyBrowserRenderer : public RaisableDialog
{
private:
  CButtonST mShowTypeHierarchy;
  CButtonST mShowSubtypeHierarchy;
  CButtonST mShowSupertypeHierarchy;
  CButtonST mPreviousHierarchies;

  CButtonST mLockHierarchy;
  CButtonST mShowInheritedMembers;

  CySplitterWnd mSplitter;

  HierarchyBrowser *mController;

public:
  void show();
  void render();

  void setHistory(const std::list<smart_ptr<Inheritable> > &);
  void setOutlineDescriptor(const Inheritable &);

protected:
  void mouseClicked(const MouseEvent&);

private:
  CTreeCtrl& getHierarchyPanel() { return mHierarchyRenderer; }
  HierarchyBrowser& getController() { return *mController; };
  
  void render(const std::list<smart_ptr<MetaObject> >&, HTREEITEM);

  bool emulateRadioButton(CButtonST& check, CButtonST &uc1, CButtonST &cu2);
  HierarchyViewType getSelectedHierachyType();
  
  void onShowTypeHierarchy();
  void onShowSubtypeHierarchy();
  void onShowSupertypeHierarchy();
  void onLockHierarchy();
  void onShowInheritedMembers();
  
  void setupHierarchyView();
  void setupMemberView();

  
  size_t getStyle();
  int getSelectedIcon(const MetaObject&);

  BCMenu* getSubMenu(size_t pos);
  MouseEvent makeMouseEvent(CWnd*, NMHDR*);

  afx_msg void onHistory(UINT);

public:
	HierarchyBrowserRenderer(HierarchyBrowser *controller, CWnd* pParent = NULL);

	//{{AFX_DATA(HierarchyBrowserRenderer)
	enum { IDD = IDD_HIERARCHY_BROWSER_PANEL };
	CStatic	mOutlineIcon;
	CTreeCtrl	mHierarchyRenderer;
	//}}AFX_DATA


	//{{AFX_VIRTUAL(HierarchyBrowserRenderer)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX); 
	//}}AFX_VIRTUAL

protected:

	//{{AFX_MSG(HierarchyBrowserRenderer)
	virtual BOOL OnInitDialog();
	afx_msg void onExpandHierarchy(NMHDR* pNMHDR, LRESULT* pResult);
  afx_msg void onFocusOn();
  afx_msg void onFocusOnX();
  afx_msg void mouseClickedHierarchy(NMHDR* pNMHDR, LRESULT* pResult);
	//}}AFX_MSG

	DECLARE_MESSAGE_MAP()
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_HIERARCHYBROWSERRENDERER_H__1896A006_5434_47A8_A950_0461CA7EA852__INCLUDED_)

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Switzerland Switzerland
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions