123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430 |
- $PBExportHeader$u_vc_statusbar.sru
- $PBExportComments$状态栏对象 - 可视定制用户对象
- forward
- global type u_vc_statusbar from userobject
- end type
- type rect from structure within u_vc_statusbar
- end type
- end forward
- type RECT from structure
- long left
- long top
- long right
- long bottom
- end type
- global type u_vc_statusbar from userobject
- integer width = 850
- integer height = 72
- userobjects objecttype = externalvisual!
- long backcolor = 0
- string classname = "msctls_statusbar32"
- string libraryname = "comctl32.dll"
- string text = "none"
- long style = 1174405120
- end type
- global u_vc_statusbar u_vc_statusbar
- type prototypes
- function long SendMessageLong( long hWindow, uint Msg, ulong wParam, Ref long Parts[] ) Library 'user32' alias for 'SendMessageA'
- function long SendMessageString( long hWindow, uint Msg, ulong wParam, Ref string szText ) Library 'user32' alias for 'SendMessageA;Ansi'
- function long SendMessageRect( long hWindow, uint Msg, ulong wParam, Ref RECT lpRect ) Library 'user32' alias for 'SendMessageA;Ansi'
- end prototypes
- type variables
- // Status Bar Messages
- Constant Private Long WM_USER = 1024
- Constant Private Long SB_SETTEXT = (WM_USER+1)
- Constant Private Long SB_GETTEXT = (WM_USER+2)
- Constant Private Long SB_GETTEXTLENGTH = (WM_USER+3)
- Constant Private Long SB_SETPARTS = (WM_USER+4)
- Constant Private Long SB_GETPARTS = (WM_USER+6)
- Constant Private Long SB_GETBORDERS = (WM_USER+7)
- Constant Private Long SB_SETMINHEIGHT = (WM_USER+8)
- Constant Private Long SB_SIMPLE = (WM_USER+9)
- Constant Private Long SB_GETRECT = (WM_USER+10)
- // Status Bar Types
- Constant Private Long SBT_NOBORDERS = 256
- Constant Private Long SBT_POPOUT = 512
- Constant Private Long SBT_RTLREADING = 1024
- Constant Private Long SBT_OWNERDRAW = 4096
- end variables
- forward prototypes
- public subroutine of_gettext (readonly integer aipart, ref string astext)
- public function long of_getparts (ref long alparts[])
- public function boolean of_setparts (long alparts[])
- public function boolean of_settext (readonly integer aipart, string astext)
- public function boolean of_setsimple (readonly boolean absimple)
- public subroutine of_setminheight (readonly long alMinHeight)
- public function integer of_gettextlength (readonly long alpart)
- public function boolean of_getrect (readonly long alPart, ref long alTop, ref long alLeft, ref long alRight, ref long alBottom)
- public function boolean of_getborders (ref long alHorizontalWidth, ref long alVerticalWidth, integer alSeperatorWidth)
- end prototypes
- public subroutine of_gettext (readonly integer aipart, ref string astext);//===================================================================
- // Function: uo_StatusBar::of_GetText()
- //-------------------------------------------------------------------
- // Description:The SB_GETTEXT message retrieves the text from the
- // specified part of a status window.
- //-------------------------------------------------------------------
- // Parameters: wParam = (WPARAM) iPart
- // lParam = (LPARAM) (LPSTR) szText
- //
- // iPart
- // Zero-based index of the part from which to retrieve text.
- // szText
- // Pointer to the buffer that receives the text.
- // This parameter is a null-terminated string.
- //-------------------------------------------------------------------
- // Returns: Returns a 32-bit value that consists of two 16-bit values.
- // The low word specifies the length, in characters, of the text.
- // The high word specifies the type of operation used to
- // draw the text. The type can be one of the following values:
- //
- // VALUE MEANING
- // -------------- ------------------------------------------------
- // 0 The text is drawn with a border to appear lower
- // than the plane of the window.
- // SBT_NOBORDERS The text is drawn without borders.
- // SBT_POPOUT The text is drawn with a border to appear higher
- // than the plane of window.
- // SBT_RTLREADING Displays text using right-to-left reading order
- // on Hebrew or Arabic systems.
- //
- // If the text has the SBT_OWNERDRAW drawing type, this message
- // returns the 32-bit value associated with the text instead of
- // the length and operation type.
- //-------------------------------------------------------------------
- // ?1997 Microsoft Corporation. All rights reserved.
- //===================================================================
- // Allocate space for buffer
- asText = Space(255)
- SendMessageString( Handle(This), SB_GETTEXT, aiPart, asText )
- RETURN
- end subroutine
- public function long of_getparts (ref long alparts[]);//===================================================================
- // Function: uo_StatusBar::of_GetParts()
- //-------------------------------------------------------------------
- // Description:The SB_GETPARTS message retrieves a count of the
- // parts in a status window. The message also retrieves
- // the coordinate of the right edge of the specified
- // number of parts.
- //-------------------------------------------------------------------
- // Parameters: wParam = (WPARAM) nParts
- // lParam = (LPARAM) (LPINT) aRightCoord
- //
- // nParts
- // Number of parts for which to retrieve coordinates.
- // If this parameter is greater than the number of parts in the
- // window, the message retrieves coordinates for existing parts only.
- // aRightCoord
- // Pointer to an integer array that has the same number of elements
- // as parts specified by nParts. Each element in the array receives
- // the client coordinate of the right edge of the corresponding part.
- // If an element is set to - 1, the position of the right edge for
- // that part extends to the right edge of the window. To retrieve
- // the current number of parts, set this parameter to zero.
- //-------------------------------------------------------------------
- // Returns: Returns the number of parts in the window if successful,
- // or zero otherwise.
- //-------------------------------------------------------------------
- // ?1997 Microsoft Corporation. All rights reserved.
- //===================================================================
- long llCountParts, llParts[]
- llCountParts = SendMessageLong( Handle(This), SB_GETPARTS, 255, llParts[] )
- IF llCountParts > 0 THEN
- alParts = llParts
- END IF
- RETURN llCountParts
- end function
- public function boolean of_setparts (long alparts[]);//===================================================================
- // Function: uo_StatusBar::of_SetParts()
- //-------------------------------------------------------------------
- // Description:The SB_SETPARTS message sets the number of parts
- // in a status window and the coordinate of the right
- // edge of each part.
- //-------------------------------------------------------------------
- // Parameters: wParam = (WPARAM) nParts
- // lParam = (LPARAM) (LPINT) aWidths
- //
- // nParts
- // Number of parts to set. The number of parts cannot be greater
- // than 255.
- // aWidths
- // Pointer to an integer array that has the same number of
- // elements as parts specified by nParts. Each element in the
- // array specifies the position, in client coordinates, of the
- // right edge of the corresponding part. If an element is - 1,
- // the position of the right edge for that part extends to the
- // right edge of the window.
- //-------------------------------------------------------------------
- // Returns: If the operation succeeds, the return value is TRUE.
- // If the operation fails, the return value is FALSE.
- //-------------------------------------------------------------------
- // ?1997 Microsoft Corporation. All rights reserved.
- //===================================================================
- long llCountParts
- boolean lbSetParts = FALSE
- llCountParts = UpperBound( alParts[] )
- IF llCountParts > 0 THEN
- lbSetParts = (SendMessageLong( Handle(This), SB_SETPARTS, llCountParts, alParts[] ) <> 0)
- END IF
- RETURN lbSetParts
- end function
- public function boolean of_settext (readonly integer aipart, string astext);//===================================================================
- // Function: uo_StatusBar::of_SetText()
- //-------------------------------------------------------------------
- // Description:The SB_SETTEXT message sets the text in the specified
- // part of a status window.
- // The message invalidates the portion of the window that
- // has changed, causing it to display the new text when
- // the window next receives the WM_PAINT message.
- //-------------------------------------------------------------------
- // Parameters: wParam = (WPARAM) iPart | uType
- // lParam = (LPARAM) (LPSTR) szText
- //
- // iPart
- // Zero-based index of the part to set. If this value is 255,
- // the status window is assumed to be a simple window having only
- // one part.
- // uType
- // Type of drawing operation.
- // This parameter can be one of the following values:
- //
- // VALUE MEANING
- // -------------- --------------------------------------------------
- // 0 The text is drawn with a border to appear lower
- // than the plane of the window.
- // SBT_NOBORDERS The text is drawn without borders.
- // SBT_OWNERDRAW The text is drawn by the parent window.
- // SBT_POPOUT The text is drawn with a border to appear higher
- // than the plane of the window.
- // SBT_RTLREADING Displays text using right-to-left reading order
- // on Hebrew or Arabic systems.
- // szText
- // Pointer to a null-terminated string that specifies the text to set.
- // If uType is SBT_OWNERDRAW, this parameter represents 32 bits of
- // data. The parent window must interpret the data and draw the text
- // when it receives the WM_DRAWITEM message.
- //-------------------------------------------------------------------
- // Returns: If the operation succeeds, the return value is TRUE.
- // If the operation fails, the return value is FALSE.
- //-------------------------------------------------------------------
- // ?1997 Microsoft Corporation. All rights reserved.
- //===================================================================
- RETURN (SendMessageString( Handle(This), SB_SETTEXT, aiPart, asText ) <> 0)
- end function
- public function boolean of_setsimple (readonly boolean absimple);//===================================================================
- // Function: uo_StatusBar::of_SetSimple()
- //-------------------------------------------------------------------
- // Description:The SB_SIMPLE message specifies whether a status
- // window displays simple text or displays all window
- // parts set by a previous SB_SETPARTS message.
- //
- // NOTE: If the status window is being changed from nonsimple to
- // simple, or vice versa, the window is immediately redrawn.
- //-------------------------------------------------------------------
- // Parameters: wParam = (WPARAM) (BOOL) fSimple
- // lParam = 0
- //
- //fSimple
- // Display type flag. If this parameter is TRUE, the window
- // displays simple text. If it is FALSE, it displays
- // multiple parts.
- //-------------------------------------------------------------------
- // Returns: Returns TRUE if set was successful.
- // Returns FALSE if an error occurs.
- //-------------------------------------------------------------------
- // ?1997 Microsoft Corporation. All rights reserved.
- //===================================================================
- long llSimple
- // Convert boolean to 'C' style boolean (NON-ZERO = TRUE)
- IF abSimple THEN
- llSimple = 1
- ELSE
- llSimple = 0
- END IF
- RETURN (Send( Handle(This), SB_SIMPLE, llSimple, 0 ) > 0)
- end function
- public subroutine of_setminheight (readonly long alMinHeight);//===================================================================
- // Function: uo_StatusBar::of_SetMinHeight()
- //-------------------------------------------------------------------
- // Description:The SB_SETMINHEIGHT message sets the minimum height
- // of a status window抯 drawing area.
- //
- // NOTE: The minimum height is the sum of wParam and twice the width,
- // in pixels, of the vertical border of the status window.
- // An application must send the WM_SIZE message to the status
- // window to redraw the window. The wParam and lParam parameters
- // of the WM_SIZE message should be set to zero.
- //-------------------------------------------------------------------
- // Parameters: wParam = (WPARAM) minHeight
- // lParam = 0
- //
- //minHeight
- // Minimum height, in pixels, of the window.
- //-------------------------------------------------------------------
- // Returns: <none>
- //-------------------------------------------------------------------
- // ?1997 Microsoft Corporation. All rights reserved.
- //===================================================================
- Send( Handle(This), SB_SETMINHEIGHT, alMinHeight, 0 )
- RETURN
- end subroutine
- public function integer of_gettextlength (readonly long alpart);//===================================================================
- // Function: uo_StatusBar::of_GetTextLength()
- //-------------------------------------------------------------------
- // Description:The SB_GETTEXTLENGTH message retrieves the length,
- // in characters, of the text from the specified part
- // of a status window.
- //-------------------------------------------------------------------
- // Parameters: wParam = (WPARAM) iPart
- // lParam = 0
- //
- // iPart
- // Zero-based index of the part from which to retrieve text.
- //-------------------------------------------------------------------
- // Returns: Returns a 32-bit value that consists of two 16-bit values.
- // The low word specifies the length, in characters, of the text.
- // The high word specifies the type of operation used to draw
- // the text. The type can be one of the following values:
- //
- // VALUE MEANING
- // -------------- --------------------------------------------------
- // 0 The text is drawn with a border to appear lower
- // than the plane of the window.
- // SBT_NOBORDERS The text is drawn without borders.
- // SBT_OWNERDRAW The text is drawn by the parent window.
- // SBT_POPOUT The text is drawn with a border to appear higher
- // than the plane of the window.
- // SBT_RTLREADING Displays text using right-to-left reading order
- // on Hebrew or Arabic systems.
- //-------------------------------------------------------------------
- // ?1997 Microsoft Corporation. All rights reserved.
- //===================================================================
- long llLength
- llLength = Send( Handle(This), SB_GETTEXTLENGTH, alPart, 0 )
- RETURN IntLow( llLength )
- end function
- public function boolean of_getrect (readonly long alPart, ref long alTop, ref long alLeft, ref long alRight, ref long alBottom);//===================================================================
- // Function: uo_StatusBar::of_GetRect()
- //-------------------------------------------------------------------
- // Description:The SB_GETRECT message retrieves the bounding
- // rectangle of a part in a status window.
- //-------------------------------------------------------------------
- // Parameters: wParam = (WPARAM) iPart
- // lParam = (LPARAM) (LPRECT) lprc
- //
- // iPart
- // Zero-based index of the part whose bounding rectangle is to be
- // retrieved.
- // lprc
- // Pointer to a RECT structure that receives the bounding rectangle.
- //-------------------------------------------------------------------
- // Returns: If the operation succeeds, the return value is TRUE.
- // If the operation fails, the return value is FALSE.
- //-------------------------------------------------------------------
- // ?1997 Microsoft Corporation. All rights reserved.
- //===================================================================
- boolean lbGetRect = FALSE
- RECT lRECT
- lbGetRect = ( SendMessageRect( Handle(This), SB_GETRECT, alPart, lRECT ) <> 0 )
- IF lbGetRect THEN
- alTop = lRECT.Top
- alLeft = lRECT.Left
- alRight = lRECT.Right
- alBottom = lRECT.Bottom
- END IF
- RETURN lbGetRect
- end function
- public function boolean of_getborders (ref long alHorizontalWidth, ref long alVerticalWidth, integer alSeperatorWidth);//===================================================================
- // Function: uo_StatusBar::of_GetParts()
- //-------------------------------------------------------------------
- // Description:The SB_GETBORDERS message retrieves the current
- // widths of the horizontal and vertical borders of a
- // status window.
- //
- // NOTE: The borders determine the spacing between the outside edge
- // of the window and the rectangles within the window that
- // contain text.
- // The borders also determine the spacing between rectangles.
- //-------------------------------------------------------------------
- // Parameters: wParam = 0
- // lParam = (LPARAM) (LPINT) aBorders;
- //
- // aBorders
- // Pointer to an integer array that has three elements.
- // The first element receives the width of the horizontal border,
- // the second receives the width of the vertical border,
- // and the third receives the width of the border between rectangles.
- //-------------------------------------------------------------------
- // Returns: If the operation succeeds, the return value is TRUE.
- // If the operation fails, the return value is FALSE.
- //-------------------------------------------------------------------
- // ?1997 Microsoft Corporation. All rights reserved.
- //===================================================================
- long llBorders[]
- boolean lbGetBorders = FALSE
- // Initialise Unbounded array to correct size.
- llBorders[3] = 0
- llBorders[2] = 0
- llBorders[1] = 0
- lbGetBorders = ( SendMessageLong( Handle(This), SB_GETBORDERS, 0, llBorders[] ) <> 0)
- IF lbGetBorders THEN
- alHorizontalWidth = llBorders[1]
- alVerticalWidth = llBorders[2]
- alSeperatorWidth = llBorders[3]
- END IF
- RETURN lbGetBorders
- end function
- on u_vc_statusbar.create
- end on
- on u_vc_statusbar.destroy
- end on
|