home *** CD-ROM | disk | FTP | other *** search
- //---------------------------------------------------------------------------
- // MULTI.h
- //---------------------------------------------------------------------------
-
- //---------------------------------------------------------------------------
- // Helpful Macros
- //---------------------------------------------------------------------------
- #define OFFSETIN( struc, field ) ( (USHORT)&( ((struc *)0)->field ) )
-
-
- //---------------------------------------------------------------------------
- // Resource ID's
- //---------------------------------------------------------------------------
- // Toolbox bitmap resource IDs.
- //---------------------------------------------------------------------------
- #define IDBMP_MULTI 8000
- #define IDBMP_MULTIDOWN 8001
- #define IDBMP_MULTIMONO 8003
- #define IDBMP_MULTIEGA 8006
-
-
- //---------------------------------------------------------------------------
- // MULTI control data and structs
- //---------------------------------------------------------------------------
- /* Count and Text are both holding areas shared by the custom
- properties implemented within MultiListBox
- */
- typedef struct tagMULTI
- {
- int hwnd; /* all property data space should be declared here */
- /* For MULTI, the only property that is custom is */
- /* the hwnd property (was not supplied as std in VB1) */
- } MULTI;
-
- typedef MULTI FAR * PMULTI;
-
- #define MULTIDEREF(hctl) ((PMULTI)VBDerefControl(hctl))
-
-
- //---------------------------------------------------------------------------
- // Control Procedure
- //---------------------------------------------------------------------------
- LONG FAR PASCAL _export MultiCtlProc(HCTL, HWND, USHORT, USHORT, LONG);
-
-
- #ifndef RC_INVOKED
- /* IT IS IMPORTANT THAT the declarations of space (vs pointers) be invoked once
- during the compile. I set a CTL_DATA precompiler flag to indicate when just
- before the INCLUDE "multi.h" in my control processing (multi.c)*/
- #ifdef CTL_DATA
- //---------------------------------------------------------------------------
- // Property list
- //---------------------------------------------------------------------------
- // Define the consecutive indicies for the properties
- // These values are indices into the property table
- /* for VB2/3 implementations, update the list to reflect the more recent
- standard properties. This list was standard for VB version 1
- */
- //---------------------------------------------------------------------------
- #define IPROP_MULTI_NAME 0x0000
- #define IPROP_MULTI_INDEX 0x0001
- #define IPROP_MULTI_PARENT 0x0002
- #define IPROP_MULTI_BACKCOLOR 0x0003
- #define IPROP_MULTI_LEFT 0x0004
- #define IPROP_MULTI_TOP 0x0005
- #define IPROP_MULTI_WIDTH 0x0006
- #define IPROP_MULTI_HEIGHT 0x0007
- #define IPROP_MULTI_ENABLED 0x0008
- #define IPROP_MULTI_VISIBLE 0x0009
- #define IPROP_MULTI_MOUSEPOINTER 0x000A
- #define IPROP_MULTI_FONTNAME 0x000B
- #define IPROP_MULTI_FONTSIZE 0x000C
- #define IPROP_MULTI_FONTBOLD 0x000D
- #define IPROP_MULTI_FONTITALIC 0x000E
- #define IPROP_MULTI_FONTSTRIKE 0x000F
- #define IPROP_MULTI_FONTUNDER 0x0010
- #define IPROP_MULTI_DRAG 0x0011
- #define IPROP_MULTI_DRAGICON 0x0012
- #define IPROP_MULTI_TABINDEX 0x0013
- #define IPROP_MULTI_TABSTOP 0x0014
- #define IPROP_MULTI_TAG 0x0015
-
- /* custom properties begin below */
- /* for each custom property, must */
- /* define a property info structure */
- #define IPROP_MULTI_SELCOUNT 0x0016 /* get returns select count */
- #define IPROP_MULTI_LISTCOUNT 0x0017 /* get returns list count */
- #define IPROP_MULTI_FIREBACK 0x0018 /* change fires select dump */
- #define IPROP_MULTI_LIST 0x0019 /* array property : whole list */
- #define IPROP_MULTI_SELLIST 0x001A /* array property : selections */
- #define IPROP_MULTI_LISTDATA 0x001B /* array of list data items */
- #define IPROP_MULTI_HWND 0x001C /* hwnd of window */
- #define IPROP_MULTI_CARET 0x001D /* caret location */
-
- /* PROPINFO structures provide VB with information on the property name,
- data type, get-able, setable, and show in property window information.
- PROPINFO P_Selcount =
- {
- "SelCount",
- DT_SHORT | PF_fGetMsg | PF_fSetMsg | PF_fNoShow,
- 0
- };
-
- PROPINFO P_Listcount =
- {
- "ListCount",
- DT_SHORT | PF_fGetMsg | PF_fSetMsg | PF_fNoShow,
- 0
- };
-
- PROPINFO P_Caret =
- {
- "Caret",
- DT_SHORT | PF_fGetMsg | PF_fSetMsg | PF_fNoShow,
- 0
- };
-
- PROPINFO P_Hwnd =
- {
- "Hwnd",
- DT_SHORT | PF_fGetMsg | PF_fNoShow | PF_fNoRuntimeW,
- 0
- };
- /* setting fillback at run-time will cause the custom event to fire in sequence */
- PROPINFO P_Fillback =
- {
- "FillBack",
- DT_SHORT | PF_fSetMsg | PF_fNoShow,
- 0
- };
- /* the PF_fPropArray flag tells VB if its an array type property */
- PROPINFO P_List =
- {
- "List",
- DT_HSZ | PF_fSetMsg | PF_fPropArray | PF_fGetMsg | PF_fNoShow,
- 0
- };
-
- PROPINFO P_SelList =
- {
- "SelList",
- DT_HSZ | PF_fGetMsg | PF_fSetMsg | PF_fPropArray | PF_fNoShow,
- 0
- };
-
- PROPINFO P_Listdata =
- {
- "ListData",
- DT_LONG | PF_fSetMsg | PF_fPropArray | PF_fGetMsg | PF_fNoShow,
- 0
- };
- /* finally, the property table for the control. The names below MUST
- appear in the same order (index value wise) as the IPROP defines above */
- PPROPINFO proplistMulti[] =
- {
- PPROPINFO_STD_CTLNAME,
- PPROPINFO_STD_INDEX,
- PPROPINFO_STD_PARENT,
- PPROPINFO_STD_BACKCOLOR,
- PPROPINFO_STD_LEFT,
- PPROPINFO_STD_TOP,
- PPROPINFO_STD_WIDTH,
- PPROPINFO_STD_HEIGHT,
- PPROPINFO_STD_ENABLED,
- PPROPINFO_STD_VISIBLE,
- PPROPINFO_STD_MOUSEPOINTER,
- PPROPINFO_STD_FONTNAME,
- PPROPINFO_STD_FONTSIZE,
- PPROPINFO_STD_FONTBOLD,
- PPROPINFO_STD_FONTITALIC,
- PPROPINFO_STD_FONTSTRIKE,
- PPROPINFO_STD_FONTUNDER,
- PPROPINFO_STD_DRAGMODE,
- PPROPINFO_STD_DRAGICON,
- PPROPINFO_STD_TABINDEX,
- PPROPINFO_STD_TABSTOP,
- PPROPINFO_STD_TAG,
- &P_Selcount,
- &P_Listcount,
- &P_Fillback,
- &P_List,
- &P_SelList,
- &P_Listdata,
- &P_Hwnd,
- &P_Caret,
- NULL
- };
- #endif // CTL_DATA
-
-
-
- //---------------------------------------------------------------------------
- // Event procedure parameter prototypes
- //---------------------------------------------------------------------------
- /* more stuff for inclusion only once */
- #ifdef CTL_DATA
- /* descriptive word arrays which tell VB the data types to be passed */
- /* to the event procedures. Remember, pointers are passed in the */
- /* actual code (see multi.c params[3,4].) */
- WORD Parms_3[] = {ET_SD, ET_I2, ET_I4};
-
- /*WORD Parms_4[] = {ET_SD, ET_I2, ET_I2, ET_I4}; */
-
- /* click is standard : commented out, still here for example sake */
- /*EVENTINFO Event_Click =
- {
- "Click",
- 4,
- 8,
- Parms_4,
- "Selection as string, Offset as integer, Selected as integer, DataVal as long"
- }; */
- /* my custom event, SelectDump, will be called with three parameters (a string, a short, a long)
- as I've defined my PARMS_3 array (ET_SD is string data, I2 = 2 byte int, I4 is 4 byte int)
- The EVENTINFO structure is the prototype that defines the name of the event (e.g. XX_Selectdump)
- the number of args (the third value is ALWAYS double the second arg and REQUIRED),
- as well as the text for the automatic declaration list for the subroutine
- */
- EVENTINFO Event_SelectDump =
- {
- "SelectDump",
- 3,
- 6,
- Parms_3,
- "Selection as string, Offset as integer, DataVal as long"
- };
- #endif // CTL_DATA
- //---------------------------------------------------------------------------
- // Event list
- //---------------------------------------------------------------------------
- // Define the consecutive indicies for the events
- // These defines are indices into the eventlistMulti table below
- // Event tables are kept in ALPHABETIC ORDER (MUST)
- //---------------------------------------------------------------------------
- #define EVENT_MULTI_SELECTDUMP 9
-
- #ifdef CTL_DATA
- PEVENTINFO eventlistMulti[] =
- {
- PEVENTINFO_STD_CLICK,
- PEVENTINFO_STD_DBLCLICK,
- PEVENTINFO_STD_DRAGDROP,
- PEVENTINFO_STD_DRAGOVER,
- PEVENTINFO_STD_GOTFOCUS,
- PEVENTINFO_STD_KEYDOWN,
- PEVENTINFO_STD_KEYPRESS,
- PEVENTINFO_STD_KEYUP,
- PEVENTINFO_STD_LOSTFOCUS,
- &Event_SelectDump,
- NULL
- };
- #endif // CTL_DATA
-
-
- //---------------------------------------------------------------------------
- // Model struct
- //---------------------------------------------------------------------------
- // Define the control model (using the event and property structures).
- //---------------------------------------------------------------------------
- #ifdef CTL_DATA
- MODEL modelPush =
- {
- VB_VERSION, // VB version being used
- MODEL_fFocusOk | MODEL_fArrows, // MODEL flags
- (PCTLPROC)MultiCtlProc, // Control procedure
- CS_VREDRAW | CS_HREDRAW, // Class style
- WS_CHILD | LBS_EXTENDEDSEL | LBS_STANDARD, // Default Window style
- sizeof(MULTI), // cbCtlExtra for MULTI structure
- IDBMP_MULTI, // Palette bitmap ID
- "Multi", // Default control name
- "MultiList", // Visual Basic class name
- "Listbox", // Parent class name
- proplistMulti, // Properties list
- eventlistMulti // Events list
- };
- #endif // CTL_DATA
-
- #endif // RC_INVOKED
-
- //---------------------------------------------------------------------------