Click here to Skip to main content
15,897,187 members
Articles / Desktop Programming / MFC

ClassLib, A C++ class library

Rate me:
Please Sign up or sign in to vote.
4.80/5 (32 votes)
25 May 2005CPOL8 min read 402.9K   11.5K   141  
C++ class library.
#ifndef _BROWSER_H_
#define _BROWSER_H_
//
// browser.h
//
// (C) Copyright 2001 Jan van den Baard.
//     All Rights Reserved.
//

#include "../controls/edit.h"
#include "../controls/button.h"
#include "../../coords/rect.h"

// A ClsEdit derived class which enables the user
// to enter text and push a selection button for
// dialog selection.
class ClsBrowser : public ClsEdit
{
	_NO_COPY( ClsBrowser );
public:
	// Constructor.
	ClsBrowser();

	// Destructor.
	virtual ~ClsBrowser();

	// Implementation.
	BOOL Attach( HWND hWnd, BOOL bDestroy = FALSE );
	void GetBrowserRect( LPRECT lpRect )
	{ if ( lpRect ) *lpRect = GetButtonRect(); }
	void AcceptDrops( BOOL bAcceptDrop = TRUE );

protected:
	// Overidables.
	virtual void OnBrowserClicked() = 0;
	virtual void OnFileDropped( HDROP hDrop ) = 0;
	virtual LRESULT WindowProc( UINT uMsg, WPARAM wParam, LPARAM lParam );
	virtual void GetButtonSize( ClsDC *pDC, ClsSize& sButtonSize );
	virtual void RenderButton( ClsDC *pDC, ClsRect rcClip );

	// Helpers.
	ClsRect GetButtonRect();
	BOOL CursorOnButton();
	void InternalRenderButton( ClsDC *pDC );

	// Data.
	BOOL	m_bHasCapture;
	BOOL	m_bDown;
	BOOL	m_bRectValid;
	BOOL	m_bClicked;
	BOOL	m_bAcceptDrop;
	int	m_nButtonWidth;
	ClsRect	m_ButtonRect;
	HANDLE	m_hTheme;
};

#endif // _BROWSER_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, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
Netherlands Netherlands
I have been programming for a hobby since 1985. I have started programming on the C= 64. After that I migrated to the C= Amiga which I traded in for a PC back in 1997 I believe. Back in 2000 I decided to lose a hobby and start developing software for a living.

Currently I am working mainly in developing software for building security and access control systems.

Comments and Discussions