spacecraft
16-2-2005 16:33:00 |
/*****************************************************************
*
* Project.....: The art of C++,
CStyleable.
* Application.: CStyle.dll.
* Module......: IStyleable.h.
* Description.: Device interface for
visual c++, the new style !
* Compiler....: MS Visual C++.
* Written by..: DEAD MAN.
* Environment.: Windows XP.
* Site........:
http://www.directx.nl
* http://www.planar.nl
* http://www.datasilicon.nl
* Email.......: spamfilter@directx.nl
*
* Please donate money to me if you like
it !!!
*
******************************************************************/
#ifndef _IStyleable_Included_
#define _IStyleable_Included_
#ifdef DRIVER_EXPORTS
#define DRIVER_API __declspec(dllexport)
#else
#define DRIVER_API __declspec(dllimport)
#pragma comment(lib,"cstyle.lib")
#endif
//***************************************************
//** Create a device, where:
//***************************************************
//*- lpReserved = IT_RESERVED.
//*- return = handle to device on
success.
//* = IT_NOTHING on failure.
//*
//***************************************************
DRIVER_API HANDLE StyleCreateDevice
(
VOID* lpReserved
);
//***************************************************
//** Initialize the device, where:
//***************************************************
//*- hDevice = handle to device.
//*- eventWindow = handle to even window.
//*- stylePath = a path on hard drive.
//*- styleSource = a filename title to
source.
//*- return = IT_SUCCESS on success.
//* = failure otherwize.
//***************************************************
//* Please note this,
//* Any color RGB(255,0,255) is
transparent for
//* bitmap backgrounds, the style-device
does not
//* exist at such points, so you really
look
//* through it and see what is below at
these
//* points. Evidently, you can create
any kind of
//* shape for the device.
//***************************************************
DRIVER_API LRESULT
StyleInitializeFromStylePath
(
HANDLE hDevice,
HWND eventWindow,
LPCSTR stylePath,
LPCSTR styleSource
);
//***************************************************
//** Retrieve the style-source-file,
where:
//***************************************************
//*- hDevice = handle to device.
//*- sz_stylepath = pointer to string
buffer.
//*- sz_stylesource_title = pointer to
string buffer.
//*- sz_stylesource_file = pointer to
string buffer.
//*- return = IT_SUCCESS on success.
//* = failure otherwize.
//***************************************************
//* Please note this,
//* sz_stylepath, sz_style_source_title
and
//* sz_stylesource_file can be NULL!
//***************************************************
DRIVER_API LRESULT
StyleRetrieveStyleSource
(
HANDLE hDevice,
LPSTR sz_stylepath,
LPSTR sz_stylesource_title,
LPSTR sz_stylesource_file
);
//***************************************************
//** Send a command to the driver, where:
//***************************************************
//*- hDevice = handle to device.
//*- message = driver message.
//*- wparam = message parameter WPARAM.
//*- lparam = message parameter LPARAM.
//*- return = LRESULT depending on
request.
//*
//***************************************************
DRIVER_API LRESULT StyleDriverCommand
(
HANDLE hDevice,
UINT message,
WPARAM wparam,
LPARAM lparam
);
// center the device on screen!
#define STYLE_COMMAND_CENTERDEVICE
0xA350
// if there is a message send it!
// wait until at least 1 window message
is send.
// (In while loops this prevents the
messageque being blocked during scope.
// without wasting CPU power when there
is nothing to do!)
#define STYLE_COMMAND_EVENT_SYNCHRONIZE
0xA351
// if there is a message send it!
// (In while loops this prevents the
messageque being blocked during scope.)
// you can do many tasks thusso use
sleep if you have'got nothing to do!!
#define STYLE_COMMAND_EVENT_ASYNCHRONIZE
0xA352
// Allow z level change! where wparam =
TRUE or FALSE.
#define STYLE_COMMAND_ALLOW_ZLEVELCHANGE
0xA353
// Bring a device and its childs or
masters into view.
#define STYLE_COMMAND_BRINGDEVICE_INTOVIEW
0xA354
//***************************************************
//** Determine whether device window
moves, where:
//***************************************************
//*- hDevice = handle to device.
//*- result = TRUE when moving.
//* = FALSE when not moving.
//*
//***************************************************
DRIVER_API BOOL StyleIsWindowMoving
(
HANDLE hDevice
);
//***************************************************
//** Create a style-device slave-device,
where:
//***************************************************
//*- hDevice = handle to parent device.
//*- lpReserved = IT_RESERVED.
//*- slaveCreationFlags = IT_FLAGS.
//*- szSlaveName = Name of slave defined
in
//* style-source-file associated
//*- with hDevice.
//*- return = handle to device on
success.
//* = IT_NOTHING on failure.
//*
//***************************************************
DRIVER_API HANDLE StyleSlaveCreateDevice
(
HANDLE hDevice,
VOID* lpReserved,
UINT slaveCreationFlags,
LPCSTR szSlaveName
);
//***************************************************
//** Retrieve handle to window from
device, where:
//***************************************************
//*- hDevice = handle to parent device.
//*- return = handle to window on
success.
//* = IT_NOTHING on failure.
//*
//***************************************************
DRIVER_API HWND StyleGetWindowHandle
(
HANDLE hDevice
);
//***************************************************
//** Set the caption for an item from
device, where:
//***************************************************
//*- hDevice = handle to device.
//* if NULL all devices!!!
//*- return = IT_SUCCESS
//*- on item updated.
//* = IT_NOTFOUND
//* if no item found.
//*
//***************************************************
DRIVER_API LRESULT
StyleSetDlgItemCaption
(
HANDLE hDevice,
LPCSTR szItemName,
LPCSTR szText,
UINT cbText
);
DRIVER_API LRESULT
StyleGetDlgItemCaption
(
HANDLE hDevice,
LPCSTR szItemName,
LPSTR szText,
UINT cbText
);
//***************************************************
//** Set the value for a slider item
from device, where:
//***************************************************
//*- hDevice = handle to device.
//* if NULL all devices!!!
//*- return = IT_SUCCESS
//*- on item updated.
//* = IT_NOTFOUND
//* if no item found.
//* = IT_OVERRIDE
//* if user slides!
//*
//***************************************************
DRIVER_API LRESULT
StyleSliderSetValueLong
(
HANDLE hDevice,
LPCSTR szItemName,
LONG value,
BOOL bRedrawSlider
);
//***************************************************
//** Get the value for a slider item
from device, where:
//***************************************************
//*- hDevice = handle to device.
//* must not be NULL!!!
//*- return = IT_SUCCESS
//*- on *value updated.
//* = IT_NOTFOUND
//* if no item found.
//*
//***************************************************
DRIVER_API LRESULT
StyleSliderGetValueLong
(
HANDLE hDevice,
LPCSTR szItemName,
LONG* value
);
//***************************************************
//** On callback in event window
determine
//** wParam equals szObjectName.
//***************************************************
//*- wParam = (WPARAM) inside
window-procedure.
//*- return = TRUE on match.
//* = FALSE otherwize.
//*
//***************************************************
DRIVER_API BOOL IsStyleObject
(
WPARAM wParam,
LPCSTR szObjectName
);
//***************************************************
//*** Messages send to event window !!!
//***************************************************
//*- no comments, under construction.
//*-
//***************************************************
#define STL_WM_MOVE 0xA201
// Where you unable to resize with
driver 0x001 ?
// If you see the WM_SYSCOMMAND
description,
// the sizing of a window is a
syscommand!!!
// I did not noticed it because i
implemented
// STL_WM_SYSCOMMAND, however i fixed
this bug
// so even if no STL_WM_SYSCOMMAND is
listened for,
// resizing is possible.
//***************************************************
//*** Important, know this!!!
//***************************************************
//*- wparam = See WM_SYSCOMMAND.
//*- lparam = See WM_SYSCOMMAND.
//*- return = EAT_SYSCOMMAND to stop
further processing!
// (e.g. on SC_SIZE or SC_MOVE eat it,
// and sizing or moving is imposible~!!
// (by user!)
#define EAT_SYSCOMMAND 1
//* = IT_SUCCESS otherwise!
//***************************************************
#define STL_WM_SYSCOMMAND 0xA202
#define STL_WM_SIZE 0xA203
#define STL_WM_CLOSE 0xA204
#define STL_WM_PAINT 0xA205
#define STL_WM_MOUSEMOVE 0xA206
#define STL_WM_NOTIFY 0xA207
#define STL_WM_PARENTNOTIFY 0xA208
//***************************************************
//***************************************************
//*** Button messages send to event
window !!!
//***************************************************
//*- wparam =(LPCSTR)szNameOfButton;
//*- lparam =(HANDLE)hDevice;
//***************************************************
#define STL_BUTTON_MouseOver 0xA301
#define STL_BUTTON_MouseDownLeft 0xA302
#define STL_BUTTON_MouseUpLeft 0xA303
#define STL_BUTTON_MouseDownRight 0xA304
#define STL_BUTTON_MouseUpRight 0xA305
//***************************************************
//*** Slave messages send to event
window !!!
//***************************************************
//*- wparam =(LPCSTR)szNameOfButton;
//*- lparam =(HANDLE)hDevice;
//***************************************************
#define STL_SLAVE_MouseOver 0xA321
#define STL_SLAVE_MouseDownLeft 0xA322
#define STL_SLAVE_MouseUpLeft 0xA323
#define STL_SLAVE_MouseDownRight 0xA324
#define STL_SLAVE_MouseUpRight 0xA325
//***************************************************
//*** Slider messages send to event
window !!!
//***************************************************
//*- wparam =(LPCSTR)szNameOfButton;
//*- lparam =(HANDLE)hDevice;
//***************************************************
#define STL_SLIDER_MouseOver 0xA341
#define STL_SLIDER_MouseDownLeft 0xA342
#define STL_SLIDER_MouseUpLeft 0xA343
#define STL_SLIDER_MouseDownRight 0xA344
#define STL_SLIDER_MouseUpRight 0xA345
#define STL_SLIDER_ValueChange 0xA346
//***************************************************
//*** Alignment flags for slave-device
creation.
//***************************************************
//*- Flags overruled by
style-source-file slave
//*- declaration !!!
//***************************************************
//*** Slave must folow its leader.
#define Alignment_FollowTheLeader 1
//*** (left/right) above.
#define Alignment_AboveTheLeader 4
#define Alignment_LeftAboveTheLeader 8
#define Alignment_RightAboveTheLeader 16
//*** (left/right) below.
#define Alignment_BelowTheLeader 32
#define Alignment_LeftBelowTheLeader 64
#define Alignment_RightBelowTheLeader
128
//*** (topleft/bottomleft/left) beside.
#define Alignment_LeftBesideTheLeader
256
#define Alignment_TopLeftBesideTheLeader
512
#define Alignment_BottomLeftBesideTheLeader
1024
//*** (topright/bottomright/right)
beside.
#define Alignment_RightBesideTheLeader
2048
#define Alignment_TopRightBesideTheLeader
4096
#define Alignment_BottomRightBesideTheLeader
8192
//*** Leader must follow its slave.
#define Alignment_FollowMe 16384
//*** Let the leader resize like its
slave.
#define Alignment_LeaderResizeLikeMe
32768
#define Alignment_LeaderResizeWidthLikeMe
65536
#define Alignment_LeaderResizeHeightLikeMe
131072
//*** Placement flags within a device
for controls
//*** like buttons, text, and
slave-device-buttons.
#define Placement_PlaceFromRight 262144
#define Placement_PlaceFromBottom 524288
//*** Slave exists under (in z-level)
the leader.
#define Alignment_UnderTheLeader 1048576
//*** Resize slave-device like
leader-device.
#define Alignment_ResizeWidthLikeLeader
2097152
//*** Slave-device retains its z-level
regarding leader-device.
#define Alignment_LeaderUnderSiege
4194304
//*
#endif _IStyleable_Included_
|