📄 compstui.h
字号:
// pData =Pointer to the name of item
// IconID=Icon resource ID for the item
// lParam=ignored by the common UI
//
// * Only SINGLE selection is supported, to do a multiple selction use
// multiple OPTITEM and create a header for it
//
// * an OTLBCBS_SORT style can be specified in the OPTTYPE's LBCBStyle
// field, and the listbox or combobox will be sorted according to the
// item's string.
//
// * OPTITEM's 'Sel' is the selection index between Low/High range
//
// * for TVOT_LISTBOX, TVOT_COMBOBOX, when it get received the keyboard
// focus then common UI will call callback function (only if
// OPTIF_CALLBACK bit set) with reason of CPSUICB_REASON_LBCB_ACTIVE,
// this give caller a chance to modify following structure flags/pdata
// which associate with the current OPTITEM. The caller's callback
// function can ONLY modify the flags/data specified here.
//
// OPTTYPE pointed by the pOptType from OPTITEM
//
// Style: OTS_LBCB_SORT
// OTS_LBCB_INCL_ITEM_NONE
//
// OPTPARAMs pointed by the pOptParam from the OPTTYPE
//
// Flags: OPTPF_HIDE
// OPTPF_DISABLED
//
// pData: change string name
//
//
// * The TVOT_COMBOBOX typically only used in the tree-view if there is
// only one selection available for that item, when there is only one
// item then dropdown list will not enabled by the common UI
//
//
//
// TVOT_EDITBOX:
// Count = 2
// pOptParam[0]=Pointer to the text of postfix and ICONS
// pOptParam[1]=Pointer to the help line text above the control and
// IconID = Edit buffer sie in character pointed by pSel
// this is including the NULL terminator.
// lParam = ignored.
//
// BegCtrlID = editBox group Box ID
// BegCtrlID+1= editBox static title ID
// BegCtrlID+2= editbox ID
// BegCtrlID+3= editbox icon control ID
// BegCtrlID+4= editbox postfix ID
// BegCtrlID+5= editbox help ID
// BegCtrlID+6= Extended Check Box/Push Button control ID
// BegCtrlID+7= Extended Check Box/Push Button Icon control ID
//
// * Style field is ignored
//
// * pSel in the OPTITEM is the pointer to the editing string, the pSel
// must pointed to a buffer eqaul or larger than the count of the buffer
// (pOptParam[1]->IconID) size
//
//
// TVOT_PUSHBUTTON:
// Count = 1
//
// BegCtrlID = push button group box ID
// BegCtrlID+1= push button static text ID (Not used by common UI)
// BegCtrlID+2= push button ID
// BegCtrlID+3= push button icon control ID
// BegCtrlID+4= Extended Check Box/Push Button control ID
// BegCtrlID+5= Extended Check Box/Push Button Icon control ID
//
//
// PUSHBUTTON_TYPE_xxx specified the action and content of pData in the
// pOptParam[0] as describe in the following
//
// PUSHBUTTON_TYPE_DLGPROC
//
// This push button is designed to bring up caller's dialog box
//
// pOptParam[0].pData = Caller's DLGPROC
// pOptParam[0].Style = PUSHBUTTON_TYPE_DLGPROC
// pOptParam[0].IconID = Icon resource ID
// pOptParam[0].lParam = Caller's DIALOG resource template ID
// or handle to the DLGTEMPLATE depends
// on the OPTPF_USE_HDLGTEMPLATE flag
//
//
// The 'lParam' passed to the DLGPROC's WM_INITDIALOG is the
// CPSUICBPARAM structure pointer, and the reason field is set
// to CPSUICB_REASON_DLGPROC.
//
//
// PUSHBUTTON_TYPE_CALLBACK
//
// This push button is designed to have caller process the item
// which cannot accomplished with the dialog box along.
//
// pOptParam[0].pData = CPSUICALLBACK function pointer
// pOptParam[0].Style = PUSHBUTTON_TYPE_CALLBACK
// pOptParam[0].IconID = Icon resource ID
// pOptParam[0].lParam = Not Used;
//
// Durning the callback the Reason field in CPSUICBPARAM will
// set to CPSUICB_REASON_PUSHBUTTON.
//
// ** If pOptParam[0].pData callback function is NULL then common
// UI will call the pfnCallBack pointer set in the
// COMPROPSHEETUI structure if it is not NULL
//
// ** The callback function should put the result of the callback
// in the pSel/Sel of OPTITEM associate with the push button
//
// PUSHBUTTON_TYPE_HTCLRADJ
//
// This push button is designed to bring up halftone color
// adjustment dialog box.
//
// pOptParam[0].pData = pointer to COLORADJUSTMENT structure
// pOptParam[0].Style = PUSHBUTTON_TYPE_HTCLRADJ
// pOptParam[0].IconID = Icon resource ID
// pOptParam[0].lParam = Not Used;
//
//
// PUSHBUTTON_TYPE_HTSETUP
//
// This push button is designed to bring up device halftone
// setup dialog box.
//
// pOptParam[0].pData = pointer to DEVHTADJDATA structure
// pOptParam[0].Style = PUSHBUTTON_TYPE_HTSETUP
// pOptParam[0].IconID = Icon resource ID
// pOptParam[0].lParam = Not Used;
//
//
// * 'Sel' field in the OPTITEM for the PUSHBUTTON is the last returned
// LONG result from the called dialog box or funcitons. The result
// only valid if OPTIF_CHANGEONCE flag is set. The common UI will set
// OPTIF_CHANGEONCE if push button ever pushed.
//
// * Since common UI donot know the meaning of the return value and
// content of the called parameter, it is up to the caller to use
// callback function to determine the returned result.
//
// * When returned from the push button except push botton type
// PUSHBUTTON_TYPE_CALLBACK common ui will call the callback function
// if the OPTIF_CALLBACK flat is set. The callback reason is set to
// CPSUICB_REASON_SEL_CHANGED.
//
// * If the passed in CPSUIF_UPDATE_PERMISSION Flags in the COMPROPSHEETUI
// is clear then the callback function must ONLY display the dialog box
// and not changed any OPTITEM data if OTS_PUSH_ENABLE_ALWAYS
// flag is set in the OPTTYPE
//
//
// TVOT_CHKBOX:
// Count = 1
//
// pOptparam[0].Style = CHKBOXS_FALSE_TRUE False/True
// CHKBOXS_NO_YES, No/YES
// CHKBOXS_OFF_ON, Off/ON
// CHKBOXS_FALSEPDATA False/pData
// CHKBOXS_NO_PDATA No/pData
// CHKBOXS_OFF_PDATA Off/pData
// CHKBOXS_NONE_PDATA None/pData
// pOptParam[0].pData = Only used if Style is CHKBOXS_NONE_PDATA
// pOptParam[0].IconID = Icon resource ID
// pOptParam[0].lParam = Ignored
//
//
// BegCtrlID = check box group ID
// BegCtrlID+1= Check Box static text (not used by common UI)
// BegCtrlID+2= check box button ID
// BegCtrlID+3= check box icon control ID
// BegCtrlID+4= Extended Check Box/Push Button control ID
// BegCtrlID+5= Extended Check Box/Push Button Icon control ID
//
//
// * BegCtrlID only used if the OPTITEM/OPTTYPE is belong to the the DLGPAGE
// which has non-common UI dialog box template (DlgTemplateID in the DLGPAGE
// is not standard DP_STD_xxx common ui dialog box template). The common
// UI used this ID to managed caller's dialog boxes item's selections and
// initialization.
//
// * for each item, it has group box ID (BegCtrlID) and static text ctronl ID
// (BegCtrlID + 1). The common UI will set the text in one of these two
// control ID in followng seauence.
//
// 1) If group box control ID's window (BegCtrlID) is exist and the
// OPTITEM's flag OPTIF_NO_GROUPBOX_NAME is not set then common UI will
// set the pName from OPTITEM to the group box.
//
// 2) If the group box name is not set and static control ID's window
// (BegCtrlID + 1) is exist then common UI will set the pName from
// OPTITEM to the static text control.
//
// * for TVOT_TRACKBAR and TVOT_SCROLLBAR, if pName in the OPTITEM is set to
// either group box or static text control then common UI will also append
// the current selection position of trackbar or scroll bar to the pName.
//
// * If multiple OPTITEMs using the same POPTPARAM and need different
// BegCtrlID for each control then then a separate OPTTYPE structure should
// be generated but POPTPARAM pointed to the same OPTPARAM[]
//
// * If a BegCtrlID+N is not used then skip that ID in your dialog box
// template
//
//
#define CHKBOXS_FALSE_TRUE 0
#define CHKBOXS_NO_YES 1
#define CHKBOXS_OFF_ON 2
#define CHKBOXS_FALSE_PDATA 3
#define CHKBOXS_NO_PDATA 4
#define CHKBOXS_OFF_PDATA 5
#define CHKBOXS_NONE_PDATA 6
#define PUSHBUTTON_TYPE_DLGPROC 0
#define PUSHBUTTON_TYPE_CALLBACK 1
#define PUSHBUTTON_TYPE_HTCLRADJ 2
#define PUSHBUTTON_TYPE_HTSETUP 3
#define MAX_RES_STR_CHARS 160
//
// Common Printer UI's LPTSTR
//
// All string pointer in common printer UI structures can be either a real
// memory pointer or a string resource ID. These are applied to LPTSTR type.
//
// The LPTSTR is defined to identify that the pointer can be a real string
// pointer or a resource ID (either common printer UI provided ID or caller's
// own resource ID). common UI using following logic to get the final string.
//
// LPTSTR pData;
//
// if ((pData & ~(ULONG_PTR)0xFFFF) != 0) then pData is a NULL terminated
// string pointer
//
// ELSE
//
// (pData & (ULONG_PTR)0xFFFF) = Resource ID
//
// if (Resource ID is within the common UI string resource ID range)
// then it load the string from common UI DLL
//
// ELSE
//
// it load string from caller's resource
//
//
// * You can use MAKEINTRESOURCE(StrResID) to set this field
//
// * The MAX characters loaded by the common UI from the resource is defined
// as MAX_RES_STR_CHARS
//
// * You cannot use LPTSTR as resource ID for the TVOT_EDITBOX style's
// pSel in the OPTITEM, this pointer must be a real buffer pointer
//
//
//
// ICONs
//
// Common UI using two types of Icons, One is 32x32 and the other is 16x16
// plus if any monochrome icon with 32x32 and 16x16 sizes.
//
// The 16x16 icon when displayed on the screen is using 16x17 pixel space,
// this is ensure that downware adjacent icon is not crowded together.
//
// In common UI, if you need to passed a ICON ID, it can either passed a
// common UI's predefined ID or caller's own ICON resource ID.
//
//
// * You can use to imagedit or any other Window icon editor to create the
// icon, each icon file should have one unique icon resource ID which is
// not overlay with the standard common UI IDI_CPSUI_xxx identifier. For
// each icon file, its should have both 32x32 and 16x16 size icon on
// different display. (ie. monochrome).
//
// Common UI will try to load the correct size of icon from the icon
// resource, but it will stretch them if the size is not found.
//
//
//
// Flags for the OPTTYPE
//
//
#define OPTPF_HIDE 0x01
#define OPTPF_DISABLED 0x02
#define OPTPF_ICONID_AS_HICON 0x04
#define OPTPF_OVERLAY_WARNING_ICON 0x08
#define OPTPF_OVERLAY_STOP_ICON 0x10
#define OPTPF_OVERLAY_NO_ICON 0x20
#define OPTPF_USE_HDLGTEMPLATE 0x40
typedef struct _OPTPARAM {
WORD cbSize; // size of this structure
BYTE Flags; // OPTPF_xxxx flags
BYTE Style; // style use in this structure
LPTSTR pData; // pointer to the data
ULONG_PTR IconID; // iconID;
LPARAM lParam; // parameter used
ULONG_PTR dwReserved[2]; // reserved dword, must be 0
} OPTPARAM, *POPTPARAM;
//
// OPTPARAM
//
// The OPTPARAM structure is used to describe each slectable item in the
// common UI such as 'letter', 'legal' in the form slection list box
//
// cbSize - size of this structure
//
// Flags - defined as OPTPF_xxxx
//
// OPTPF_HIDE
//
// Specified hide this listed selection item and not
// availabe for user to select. This only available to
// following TVOT_xxx types
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -