Click here to Skip to main content
Click here to Skip to main content
Articles » Database » Database » General » Downloads
 
Add your own
alternative version
Go to top

Database Visualization

, 31 May 2006
This article aims to create a simple tool for visualizing database tables and relations, a database map to refer to.
src.zip
src
msado15.tlh
msado15.tli
QueryBuilder.dsp
QueryBuilder.dsw
QueryBuilder.exe
QueryBuilder.clw
res
QueryBuilder.ico
logo.bmp
msado15.tlh
msado15.tli
Manifest
default1.bin
ListIcons.bmp
wingraphviz.zip
WinGraphViz
WinGraphviz_v1.02.25s.cab
WinGraphviz_v1.02.24.msi
WinGraphviz_v1.02.24.cab
WinGraphviz_v1.02.20.msi
WinGraphviz_v1.02.20.cab
dotguide.pdf
//*-
//
// MODULE NAME:   ListBoxEx.h
//
// DESCRIPTION:   CListBoxEx class declaration
//
// AUTHOR     :   Copyright (C) Stefano Passiglia, December 1999
//                passig@geocities.com
//                You can reuse and redistribute this code, provided this header is
//                kept as is.
//
//+*/

#ifndef _LISTBOXEX_H
#define _LISTBOXEX_H

#if _MSC_VER > 1000
#   pragma once
#endif // _MSC_VER > 1000


//
// Include Files
//
#include "stdafx.h"

//
// Constant definitions.
//

#define __BMP_WIDTH  66
#define __BMP_HEIGHT 20
#define __BMP_BTNWID 22

#define __BTN_DEL     0
#define __BTN_UP      1
#define __BTN_DOWN    2
#define __BMP_NUMBTN  3

// Listbox styles
#define LBEX_STYLE\
   WS_CHILD | WS_VISIBLE | WS_VSCROLL|\
   LBS_EXTENDEDSEL | LBS_NOINTEGRALHEIGHT | LBS_HASSTRINGS |\
   LBS_NOTIFY | LBS_WANTKEYBOARDINPUT | LBS_DISABLENOSCROLL |\
   LBS_OWNERDRAWFIXED

// Listbox extended styles
#define LBEX_EXSTYLE\
   WS_EX_CLIENTEDGE


// Listbox editing mode
#define LBEX_EDITBUTTON    0x4000L     // If set, shows a "..." button near the edit box


//
// Type definitions.
//
// None.


//
// Function declarations.
//
// None.

//
// Class declarations.
//

class CListBoxExBuddy;

class CListBoxEx : public CDragListBox
{
   DECLARE_DYNCREATE( CListBoxEx )

public:
             
   // Constructor/Destructor
   CListBoxEx();
   virtual ~CListBoxEx();
   
public:
	
   void AllowDrag( BOOL bAllowDrag = TRUE )
   {
      m_bAllowDrag = bAllowDrag;
   };

   // Item methods
   int MoveItemUp( int iItem );
   int MoveItemDown( int iItem );
   void SwapItems( int iFirstItem, int iSecondItem );
   
   void SetItem( int iItem, LPCTSTR szItemText, DWORD dwItemData );
   void SetItemText( int iItem, LPCTSTR szItemText );

public:

   // Data members

   // Overrides
   // ClassWizard generated virtual function overrides
   //{{AFX_VIRTUAL(CListBoxEx)
public:
   virtual BOOL OnChildNotify(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pLResult);
protected:
   virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
   virtual void PreSubclassWindow();
   virtual void MeasureItem( LPMEASUREITEMSTRUCT lpMeasureItemStruct );
   virtual void DrawItem( LPDRAWITEMSTRUCT lpDrawItemStruct );   
   virtual void DrawInsert( int nIndex );
   //}}AFX_VIRTUAL
   
   void DrawSeparator( int nIndex );

   // Generated message map functions
protected:
   //{{AFX_MSG(CListBoxEx)
   afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
   afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
   afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
   afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
   afx_msg void OnSysKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
   afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
	//}}AFX_MSG

   DECLARE_MESSAGE_MAP()

private:

   CListBoxExBuddy *m_pBuddy;

   int              m_iSelected;
   BOOL             m_bAllowDrag;
}; // class CListBoxEx



class CListBoxExBuddy: public CWnd
{
public:

   CListBoxExBuddy();
   virtual ~CListBoxExBuddy();
   
public:
   
   void SetListbox( CListBoxEx *pListBox ) 
   { 
      m_pListBoxEx = pListBox; 
   };

   // Overrides
   // ClassWizard generated virtual function overrides
   //{{AFX_VIRTUAL(CListBoxExBuddy)
protected:
   virtual void PreSubclassWindow();
   virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
   //}}AFX_VIRTUAL
   
   // Generated message map functions
protected:
   //{{AFX_MSG(CListBoxExBuddy)
   afx_msg void OnPaint();
   afx_msg void OnMouseMove(UINT nFlags, CPoint point);
   afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
   afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
   afx_msg void OnSize(UINT nType, int cx, int cy);
   afx_msg void OnNcMouseMove(UINT nHitTest, CPoint point);
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	//}}AFX_MSG
   DECLARE_MESSAGE_MAP()

private:

   void CreateTooltips();
   void SetTipText( UINT nID, LPTSTR szTipText );

   int FindButton( const CPoint & point );
   void InvalidateButton( int iIndex, BOOL bUpdateWindow = TRUE );
   void DoClick( int iIndex );

private:

   CListBoxEx   *m_pListBoxEx;

   CBitmap       m_ButtonBitmap;

   UINT          m_iButton;
   BOOL          m_bButtonPressed;
   CRect        *m_arcButtons;

   CToolTipCtrl  m_ToolTip;

}; // class CListBoxExBuddy



/////////////////////////////////////////////////////////////////////////////

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

#endif // !defined(_LISTBOXEX_H)

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

Share

About the Author

VGirish
Founder
India India
No Biography provided

| Advertise | Privacy | Mobile
Web02 | 2.8.140916.1 | Last Updated 31 May 2006
Article Copyright 2006 by VGirish
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid