Click here to Skip to main content
15,881,863 members
Articles / Desktop Programming / WTL

The Spring Computing Windows Controls

Rate me:
Please Sign up or sign in to vote.
4.27/5 (4 votes)
27 Sep 20014 min read 85.5K   2K   32  
A set of Win32 Windows controls.
///////////////////////////////////////////////////////////////////////////////
// SpringCtrl.h - interface for the Spring Computing Windows Controls
// version 0.1
//
// Maxime Labelle

#ifndef _INC_SPRING_CONTROLS
#define _INC_SPRING_CONTROLS

#ifdef __cplusplus
extern "C" {
#endif

#ifdef SPRINGCTRL_EXPORTS
#define SPRINGCTRLAPI __declspec(dllexport)
#else
#define SPRINGCTRLAPI __declspec(dllimport)
#endif

#ifndef RC_INVOKED
#ifndef _SPRINGCTRL_NOFORCE_LIBS

#ifndef _SPRINGCTRLDLL
    #pragma comment(lib, "springctl32.lib")
#endif // _SPRINGCTRLDLL

#endif // _CTL_NOFORCE_LIBS
#endif // RC_INVOKED

SPRINGCTRLAPI void WINAPI InitWindowsControls(void);

///////////////////////////////////////////////////////////////////////////////
// Notification ranges

#define CBN_FIRST			0U - 00U	// CaptionBar Control
#define CBN_LAST			0U - 09U

#define SCN_FIRST			0U - 10U	// Shortcut Control
#define SCN_LAST			0U - 11U

///////////////////////////////////////////////////////////////////////////////
// CaptionBarControl

#define CAPTIONBARCLASSNAMEW	L"CaptionBarWindow32"
#define CAPTIONBARCLASSNAMEA	"CaptionBarWindow32"

#ifdef _UNICODE
	#define CAPTIONBARCLASSNAME	CAPTIONBARCLASSNAMEW
#else
	#define CAPTIONBARCLASSNAME	CAPTIONBARCLASSNAMEA
#endif

// CaptionBarControl structures

typedef struct tagNMCBTOGGLE
{
	NMHDR	hdr;
	RECT	rc;	// bounds of the toggle button in screen coordinates
} NMCBTOGGLE, * LPNMCBTOGGLE;

// CaptionBarControl window styles

#define CBS_STATIC				0x0000
#define CBS_PUSHBUTTON			0x0100
#define CBS_TOGGLEBUTTON		0x0200
#define CBS_ICONLEFT			0x0000
#define CBS_ICONRIGHT			0x0400

// CaptionBarControl messages

#define CBM_GETBITMAP			(WM_USER +  1)	// (HBITMAP) = (WPARAM) 0, (LPARAM) 0
#define CBM_GETBKCOLOR			(WM_USER +  2)	// (COLORREF) = (WPARAM) 0, (LPARAM) 0
#define CBM_GETTEXTCOLOR		(WM_USER +  3)	// (COLORREF) = (WPARAM) 0, (LPARAM) 0
#define CBM_GETTRANSPARENTCOLOR	(WM_USER +  4)	// (COLORREF) = (WPARAM) 0, (LPARAM) 0
#define CBM_GETSTATE			(WM_USER +  5)	// (BOOL) = (WPARAM) 0, (LPARAM) 0
#define CBM_SETBITMAP			(WM_USER +  6)	// (HBITMAP) = (WPARAM)(HBITMAP)hBitmap, (LPARAM) 0
#define CBM_SETBKCOLOR			(WM_USER +  7)  // (WPARAM)(COLORREF)rgbBack
#define CBM_SETTEXTCOLOR		(WM_USER +  8)  // (WPARAM)(COLORREF)rgbText
#define CBM_SETTRANSPARENTCOLOR	(WM_USER +  9)  // (WPARAM)(COLORREF)rgbTransparent
#define CBM_SETSTATE			(WM_USER + 10)	// (WPARAM)(BOOL)bPushed

// CaptionBarControl notifications

#define CBN_AUTOSIZE			(CBN_FIRST -  1)
#define CBN_PUSHED				(CBN_FIRST -  2)
#define CBN_TOGGLED				(CBN_FIRST -  3)	// (LPARAM)(LPNMTOGGLE)lpnmh

///////////////////////////////////////////////////////////////////////////////
// ShortcutControl

#define SHORTCUTCLASSNAMEW		L"ShortcutWindow32"
#define SHORTCUTCLASSNAMEA		"ShortcutWindow32"

#ifdef _UNICODE
	#define SHORTCUTCLASSNAME	SHORTCUTCLASSNAMEW
#else
	#define SHORTCUTCLASSNAME	SHORTCUTCLASSNAMEA
#endif

// Shortcut Control Window Styles

#define SCS_ANIMATION			0x0100

// Shortcut Control Structures

#define SCPIM_TEXT				0x0001
#define SCPIM_CHILD				0x0002
#define SCPIM_LPARAM			0x0004

typedef struct tagSHORTCUTPANEINFOA
{
	UINT	cbSize;
	UINT	mask;
	LPSTR	pszText;
	UINT	cchTextMax;
	HWND	hwndChild;
	LPARAM	lParam;
} SHORTCUTPANEINFOA, * LPSHORTCUTPANEINFOA;

typedef SHORTCUTPANEINFOA const* LPCSHORTCUTPANEINFOA;

typedef struct tagSHORTCUTPANEINFOW
{
	UINT	cbSize;
	UINT	mask;
	LPWSTR	pszText;
	UINT	cchTextMax;
	HWND	hwndChild;
	LPARAM	lParam;
} SHORTCUTPANEINFOW, * LPSHORTCUTPANEINFOW;

typedef SHORTCUTPANEINFOW const* LPCSHORTCUTPANEINFOW;

#ifdef _UNICODE
#define SHORTCUTPANEINFO		SHORTCUTPANEINFOW
#define LPSHORTCUTPANEINFO		LPSHORTCUTPANEINFOW
#define LPCSHORTCUTPANEINFO		LPCSHORTCUTPANEINFOW
#else
#define SHORTCUTPANEINFO		SHORTCUTPANEINFOA
#define LPSHORTCUTPANEINFO		LPSHORTCUTPANEINFOA
#define LPCSHORTCUTPANEINFO		LPCSHORTCUTPANEINFOA
#endif

#define SCHT_NOWHERE	0x0001
#define SCHT_HEADER		0x0002
#define SCHT_CHILD		0x0003

typedef struct tagSCHITTESTINFO
{
	POINT	pt;
	UINT	flag;
	UINT	uIndex;
} SCHITTESTINFO, * LPSCHITTESTINFO;

// Shortcut Control Messages

#define SCM_DELETEPANE			(WM_USER +  1)	// (BOOL) = (WPARAM)(UINT)uIndex, (LPARAM)0
#define SCM_EDITLABEL			(WM_USER +  2)	// (WPARAM)(UINT)uIndex, (LPARAM)0
#define SCM_GETCURRENTPANE		(WM_USER +  3)	// (UINT) = (WPARAM)0, (LPARAM)0
#define SCM_GETPANECOUNT		(WM_USER +  4)	// (UINT) = (WPARAM)0, (LPARAM)0
#define SCM_GETPANEINFOA		(WM_USER +  5)	// (BOOL) = (WPARAM)(UINT)uIndex, (LPARAM)(LPSHORTCUTPANEINFOA)lpspi
#define SCM_GETPANEINFOW		(WM_USER +  6)	// (BOOL) = (WPARAM)(UINT)uIndex, (LPARAM)(LPSHORTCUTPANEINFOW)lpspi

#ifdef _UNICODE
#define SCM_GETPANEINFO			SCM_GETPANEINFOW
#else
#define SCM_GETPANEINFO			SCM_GETPANEINFOA
#endif

#define SCM_HITTEST				(WM_USER +  7)	// (UINT) = (WPARAM)0, (LPARAM)(LPSCHITTESTINFO)lpsci

#define SCM_INSERTPANEA			(WM_USER +  8)	// (BOOL) = (WPARAM)(UINT)uIndex, (LPARAM)(LPCSHORTCUTPANEINFOA)lpcspi
#define SCM_INSERTPANEW			(WM_USER +  9)	// (BOOL) = (WPARAM)(UINT)uIndex, (LPARAM)(LPCSHORTCUTPANEINFOW)lpcspi

#ifdef _UNICODE
#define SCM_INSERTPANE			SCM_INSERTPANEW
#else
#define SCM_INSERTPANE			SCM_INSERTPANEA
#endif

#define SCM_SETCURRENTPANE		(WM_USER + 10)	// (BOOL) = (WPARAM)(UINT)uIndex, (LPARAM)0

#define SCM_SETPANEINFOA		(WM_USER + 11)	// (BOOL) = (WPARAM)(UINT)uIndex, (LPARAM)(LPCSHORTCUTPANEINFOA)lpcspi
#define SCM_SETPANEINFOW		(WM_USER + 12)	// (BOOL) = (WPARAM)(UINT)uIndex, (LPARAM)(LPCSHORTCUTPANEINFOW)lpcspi

#ifdef _UNICODE
#define SCM_SETPANEINFO			SCM_SETPANEINFOW
#else
#define SCM_SETPANEINFO			SCM_SETPANEINFOA
#endif

// Shortcut Control Notifications

#define SCN_PANESELECTED		(SCN_FIRST - 1)

#ifdef __cplusplus
}
#endif

#endif // _INC_SPRING_CONTROLS

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
Web Developer
France France
Coming soon...

Comments and Discussions