• Welcome to Powerbasic Museum 2020-B.
 

News:

Forum in repository mode. No new members allowed.

Main Menu

(Phoenix) ButtonStrip Control

Started by Theo Gottwald, May 19, 2007, 03:38:20 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Theo Gottwald

'###############################################################################
' BEGIN phnx_BtnStrip_Class32
'###############################################################################

' Grid item masks (dwMask member of structures)
%BIF_STATE       = &H1          ' the dwStateMask and dwState members must be filled in
%BIF_FONT        = &H2          ' the tlf member must be filled in
%BIF_TEXT        = &H4          ' the pszText and cchTextMax members must be filled in
%BIF_ALIGN       = &H8          ' the bImageOnRight member must be filled in
%BIF_IMAGE       = &H10         ' the iImage member must be filled in
%BIF_LPARAM      = &H20         ' the lParam member must be filled in
%BIF_COLOR       = &H40         ' the dwTextColor and dwBackColor members must be filled in
%BIF_SIZE        = &H80         ' the wSize member must be filled in
%BIF_ALL         = %BIF_STATE OR %BIF_FONT OR %BIF_TEXT OR %BIF_ALIGN OR _
                   %BIF_IMAGE OR %BIF_LPARAM OR %BIF_COLOR OR %BIF_SIZE

' Grid item states
%BIS_SELECTED    = &H00000002
%BIS_DISABLED    = &H00000020
%BIS_HOTTRACK    = &H00000080
%BIS_SHADOWED    = &H00000400
%BIS_FOCUSED     = &H00000800

%BTNTIPSIZE      = 2048

TYPE BTNSTRIPITEM   ' bsi
  wSize           AS WORD         ' width/height of item
  dwMask          AS DWORD        ' attributes of item being requested or set
  dwStateMask     AS DWORD        ' state of item being requested or set
  dwState         AS DWORD        ' state of item
  pszText         AS ASCIIZ PTR   ' item text
  cchTextMax      AS LONG         ' maximum size of buffer receiving text
  iImage          AS LONG         ' index of image in normal imagelist
  bImageOnRight   AS BYTE         ' image right of text flag
  bDefaultFont    AS BYTE         ' use default font flag
  tlf             AS LOGFONT      ' font attributes
  dwTextColor     AS DWORD        ' text color
  dwBackColor     AS DWORD        ' background color
  lParam          AS LONG         ' application-defined value
END TYPE

' Used by the BCN_HOTITEMCHANGE notification message
TYPE BTNSTRIPHOTITEM    ' bshi
  hdr             AS NMHDR
  iBtn            AS LONG           ' zero-based index of button
  fLeaving        AS LONG           ' TRUE if mouse is leaving the item
END TYPE

' Used by the BSN_SETFOCUS/BSN_KILLFOCUS notification messages
TYPE BTNSTRIPCONTROLFOCUS   ' bscf
  hdr             AS NMHDR
  hWndFocus       AS DWORD          ' handle of window gaining or losing the input focus
END TYPE

' Used by the BSN_SELCHANGING/BCN_SELCHANGED notification messages
TYPE BTNSTRIPITEMFOCUS      ' bsif
  hdr             AS NMHDR
  iBtnOld         AS LONG           ' zero-based index of old item
  iBtnNew         AS LONG           ' zero-based ndex of new item
END TYPE

' phnx_BtnStrip_Class32 styles
' ----------------------------
%BSS_VERTMASK                               = &H0001??
' This is not a style.  It is used to test for a vertical button strip control.

%BSS_TOOLTIPS                               = &H0002??
' The button strip control creates a tooltip control when it is created.  The
' tooltip control always uses the LPSTR_TEXTCALLBACK flag even
' even when it is assigned via the BSM_SETTOOLTIPS message.

%BSS_FOCUSRECT                              = &H0004??
' The selected item displays a focus rectangle when the control has the focus.

%BSS_EQUALSIZE                              = &H0008??
' The buttons in the button strip control have the same size.

%BSS_LEFTVERT                               = &H0021??
' Creates a vertical button strip control with text running from bottom to top.

%BSS_RIGHTVERT                              = &H0041??
' Creates a vertical button strip control with text running from top to bottom.

' phnx_BtnStrip_Class32 messages
' ------------------------------
%BSM_INSERTITEM                             = %WM_USER + &H0064??
' Purpose: Sent to insert an item in a button strip control.
' wParam:  Position at which to insert new item
' lParam:  Number of items to insert
' Return:  The return value is TRUE if successful, FALSE otherwise.

%BSM_DELETEITEM                             = %WM_USER + &H0065??
' Purpose: Sent to delete an item from a button strip control.
' wParam:  zero-based index of item to delete
' lParam:  number of buttons to delete
' Return:  The return value is TRUE if successful, FALSE otherwise.

%BSM_SETCURSEL                              = %WM_USER + &H0066??
' Purpose: Sent to select a button in the button strip control.  The control does not send
'          BSN_SELCHANGING or BSN_SELCHANGED notification message when a
'          button is selected using this message.
' wParam:  index of the button to select
' lParam:  N/A
' Return:  Index of the previously selected button if successful or -1.

%BSM_GETCURSEL                              = %WM_USER + &H0067??
' Purpose: Sent to retrieve the index of the currently selected button.
' wParam:  N/A
' lParam:  N/A
' Return:  Index of currently selected button or -1 on failure.

%BSM_SETCURFOCUS                            = %WM_USER + &H0068??
' Purpose: Sent to select a button in the button strip control.  The control sends
'          BSN_SELCHANGING or BSN_SELCHANGED notification message
'          when a button is selected using this message.
' wParam:  index of the button to select
' lParam:  N/A
' Return:  Index of currently selected button or -1 on failure.

%BSM_SETITEM                                = %WM_USER + &H0069??
' Purpose: Sets the attributes of a button.
' wParam:  zero-based index of button to set
' lParam:  address of BTNSTRIPITEM structure
' Return:  TRUE if successful, FALSE on failure.

%BSM_GETITEM                                = %WM_USER + &H006A??
' Purpose: Retrieves the attributes of a button.
' wParam:  index of button to retrieve
' lParam:  address of BTNSTRIPITEM structure
' Return:  TRUE if successful, FALSE on failure.

%BSM_SETIMAGELIST                           = %WM_USER + &H006B??
' Purpose: Assigns an imagelist to the control.
' wParam:  N/A
' lParam:  handle to the image list to assign
' Return:  The handle to the image list previously associated with the control if successful, or NULL otherwise.

%BSM_GETIMAGELIST                           = %WM_USER + &H006C??
' Purpose: Retrieves the image list associated with a grid control.
' wParam:  N/A
' lParam:  N/A
' Return:  Handle to the image list associated with the grid control or NULL.

%BSM_SETTEXTCOLOR                           = %WM_USER + &H006D??
' Purpose: Sent to set the default text color of buttons in a button strip control.
'          Set lParam to &HFFFFFFFF??? to use the default color.
' wParam:  N/A
' lParam:  new text color
' Return:  The previous text color.

%BSM_GETTEXTCOLOR                           = %WM_USER + &H006E??
' Purpose: Sent to retrieve the default text color of buttons in a button strip control.
' wParam:  N/A
' lParam:  N/A
' Return:  The return value is the current default text color.

%BSM_SETBACKCOLOR                           = %WM_USER + &H006F??
' Purpose: Sent to set the default back color of buttons in a button strip control.control.
'          Set lParam to &HFFFFFFFF??? to use the default color.
' wParam:  N/A
' lParam:  new back color
' Return:  The return value is the previous back color.

%BSM_GETBACKCOLOR                           = %WM_USER + &H0070??
' Purpose: Sent to retrieve the default back color of buttons in a button strip control. a grid control.
' wParam:  N/A
' lParam:  N/A
' Return:  The return value is the current back color.

%BSM_GETBUTTONCOUNT                         = %WM_USER + &H0071??
' Purpose: Retrieves the number of buttons in a button strip control.
' wParam:  N/A
' lParam:  N/A
' Return:  The return value is the number of buttons in the control.

%BSM_GETITEMRECT                            = %WM_USER + &H0072??
' Purpose: Retrieves the bounding rectangle of the specified button.
' wParam:  index of button
' lParam:  address of RECT structure to receive coordinates
' Return:  Returns TRUE if successful, or FALSE otherwise.

%BSM_HITTEST                                = %WM_USER + &H0073??
' Purpose: Sent to determine which item of the button strip control, if any, is at a specified position.
' wParam:  N/A
' lParam:  address of POINTAPI structure with location to test in client coordinates
' Return:  The return value is the index of the button at the specified location or -1.

%BSM_SETTOOLTIPS                            = %WM_USER + &H0074??
' Purpose: Sent to associate a tooltip control with the button strip condrol.
' wParam:  handle to the tooltip control
' lParam:  N/A
' Return:  No return value.

%BSM_GETTOOLTIPS                            = %WM_USER + &H0075??
' Purpose: Sent to retrieve the handle to the tooltip control, if any, associated
'          with the button strip control.
' wParam:  N/A
' lParam:  N/A
' Return:  Returns the handle to the tooltip control or NULL if the button strip control has no associated tooltip.

' phnx_BtnStrip_Class32 notifications
' -----------------------------------
%BSN_SELCHANGING                            = %WM_USER + &H0064??
' Purpose: Sent to a button strip control's parent window when the selected button is about to change.
'          This notification is sent when the change is initiated by the user.  It is not sent when the
'          selected button is changed via the BSM_SETCURSEL message.
' wParam:  identifier of control
' lParam:  address of BTNSTRIPITEMFOCUS structure
' Return:  Return TRUE to prevent the change, or FALSE to allow the change.

%BSN_SELCHANGED                             = %WM_USER + &H0065??
' Purpose: Sent to a button strip control' parent window when the selected button has changed.
'          This notification is sent when the change is initiated by the user.  It is not sent when
'          the selected button is changed via the BSM_SETCURSEL message.
' wParam:  identifier of control
' lParam:  address of BTNSTRIPITEMFOCUS structure
' Return:  No return value.

%BSN_SETFOCUS                               = %WM_USER + &H0066??
' Purpose: Sent when the control gains the input focus. The hWndFocus
'          member of the BTNSTRIPCONTROLFOCUS structure identifies the
'          window that has lost the keyboard focus (may be NULL).
' wParam:  identifier of control
' lParam:  address of BTNSTRIPCONTROLFOCUS structure
' Return:  No return value.

%BSN_KILLFOCUS                              = %WM_USER + &H0067??
' Purpose: Sent when the control is about to lose the input focus. The hWndFocus
'          member of the BTNSTRIPCONTROLFOCUS structure identifies the window
'          receives the keyboard focus (may be NULL).
' wParam:  identifier of control.
' lParam:  address of BTNSTRIPCONTROLFOCUS structure
' Return:  No return value.

%BSN_HOTITEMCHANGE                          = %WM_USER + &H0069??
' Purpose: Sent by the button strip control when the mouse enters or leaves an item.
' wParam:  identifier of control
' lParam:  address of BTNSTRIPHOTITEM structure
' Return:  No return value.

DECLARE FUNCTION InitButtonStrip LIB "BTNSTRIP.DLL" ALIAS "InitButtonStrip" () AS LONG

'###############################################################################
' END phnx_BtnStrip_Class32
'###############################################################################