2007-09-12 19:27 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)

* source/rtl/tget.prg
     ! :HitTest() crash fix.
     ! :HitTest() made more compatible.
     + Added proper wrappers for undocumented C5.3 vars.
     + Added support for Caption.
     + Added support for C5.3 color handling (it's quite ugly, 
       but it's on by default).
     ; Some snippets from xhb but heavily fixed.

   * source/rtl/scrollbr.prg
   * source/rtl/tpopup.prg
   * source/rtl/radiogrp.prg
   * source/rtl/listbox.prg
   * source/rtl/checkbox.prg
   * source/rtl/tget.prg
   * source/rtl/ttopbar.prg
   * source/rtl/pushbtn.prg
   * source/rtl/radiobtn.prg
     % __GUIColor() -> hb_ColorSelect()
This commit is contained in:
Viktor Szakats
2007-09-12 17:35:50 +00:00
parent 633ce223f1
commit cc3cf4897a
10 changed files with 219 additions and 110 deletions

View File

@@ -8,6 +8,27 @@
2002-12-01 13:30 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
2007-09-12 19:27 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* source/rtl/tget.prg
! :HitTest() crash fix.
! :HitTest() made more compatible.
+ Added proper wrappers for undocumented C5.3 vars.
+ Added support for Caption.
+ Added support for C5.3 color handling (it's quite ugly,
but it's on by default).
; Some snippets from xhb but heavily fixed.
* source/rtl/scrollbr.prg
* source/rtl/tpopup.prg
* source/rtl/radiogrp.prg
* source/rtl/listbox.prg
* source/rtl/checkbox.prg
* source/rtl/tget.prg
* source/rtl/ttopbar.prg
* source/rtl/pushbtn.prg
* source/rtl/radiobtn.prg
% __GUIColor() -> hb_ColorSelect()
2007-09-12 13:55 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/source/rtl/hbgtcore.c
* changed default UNSELECTED collor from W/N to N/W
@@ -17,7 +38,7 @@
* source/rtl/tbrowse.prg
! Fixed to assign SetColor() in New() rather than in INIT.
(INIT value gets evaluated and stored on first class usage,
not on every instantiantion.)
not on every instantiation.)
* source/rtl/tget.prg
* tests/rto_get.prg

View File

@@ -201,9 +201,9 @@ METHOD display() CLASS CHECKBOX
DispBegin()
DispOutAt( ::nRow, ::nCol + 1, iif( ::lBuffer, SubStr( cStyle, 2, 1 ), SubStr( cStyle, 3, 1 ) ),;
__GUIColor( ::cColorSpec, iif( ::lHasFocus, 2, 1 ) ) )
hb_ColorIndex( ::cColorSpec, iif( ::lHasFocus, 1, 0 ) ) )
SetColor( __GUIColor( ::cColorSpec, 3 ) )
SetColor( hb_ColorIndex( ::cColorSpec, 2 ) )
DispOutAt( ::nRow, ::nCol, Left( cStyle, 1 ) )
DispOutAt( ::nRow, ::nCol + 2, Right( cStyle, 1 ) )
@@ -217,13 +217,13 @@ METHOD display() CLASS CHECKBOX
ENDIF
IF ::lHasFocus
SetColor( __GUIColor( ::cColorSpec, 4 ) )
SetColor( hb_ColorIndex( ::cColorSpec, 3 ) )
ENDIF
DispOutAt( ::nCapRow, ::nCapCol, cCaption )
IF !::lHasFocus .AND. nPos != 0
DispOutAt( ::nCapRow, ::nCapCol + nPos - 1, SubStr( cCaption, nPos, 1 ), __GUIColor( ::cColorSpec, 4 ) )
DispOutAt( ::nCapRow, ::nCapCol + nPos - 1, SubStr( cCaption, nPos, 1 ), hb_ColorIndex( ::cColorSpec, 3 ) )
ENDIF
ENDIF
@@ -283,7 +283,7 @@ METHOD colorSpec( cColorSpec ) CLASS CHECKBOX
IF cColorSpec != NIL
::cColorSpec := _eInstVar( Self, "COLORSPEC", cColorSpec, "C", 1001,;
{|| !Empty( __GUIColor( cColorSpec, 4 ) ) .AND. Empty( __GUIColor( cColorSpec, 5 ) ) } )
{|| !Empty( hb_ColorIndex( cColorSpec, 3 ) ) .AND. Empty( hb_ColorIndex( cColorSpec, 4 ) ) } )
ENDIF
RETURN ::cColorSpec
@@ -350,10 +350,10 @@ METHOD New( nRow, nCol, cCaption ) CLASS CHECKBOX
::cColorSpec := "W/N,W+/N,W/N,W+/N"
ELSE
cColor := SetColor()
::cColorSpec := __GUIColor( cColor, CLR_UNSELECTED + 1 ) + "," +;
__GUIColor( cColor, CLR_ENHANCED + 1 ) + "," +;
__GUIColor( cColor, CLR_STANDARD + 1 ) + "," +;
__GUIColor( cColor, CLR_BACKGROUND + 1 )
::cColorSpec := hb_ColorIndex( cColor, CLR_UNSELECTED ) + "," +;
hb_ColorIndex( cColor, CLR_ENHANCED ) + "," +;
hb_ColorIndex( cColor, CLR_STANDARD ) + "," +;
hb_ColorIndex( cColor, CLR_BACKGROUND )
ENDIF
RETURN Self

View File

@@ -248,14 +248,14 @@ METHOD display() CLASS LISTBOX
IF ::lHasFocus
cHotBox := ::cHotBox
cColor3 := __GUIColor( ::cColorSpec, 3 )
cColor4 := __GUIColor( ::cColorSpec, 4 )
cColorAny := iif( ::lIsOpen, __GUIColor( ::cColorSpec, 2 ), __GUIColor( ::cColorSpec, 4 ) )
cColor3 := hb_ColorIndex( ::cColorSpec, 2 )
cColor4 := hb_ColorIndex( ::cColorSpec, 3 )
cColorAny := iif( ::lIsOpen, hb_ColorIndex( ::cColorSpec, 1 ), hb_ColorIndex( ::cColorSpec, 3 ) )
ELSE
cHotBox := ::cColdBox
cColor3 := __GUIColor( ::cColorSpec, 1 )
cColor4 := __GUIColor( ::cColorSpec, 2 )
cColorAny := __GUIColor( ::cColorSpec, 2 )
cColor3 := hb_ColorIndex( ::cColorSpec, 0 )
cColor4 := hb_ColorIndex( ::cColorSpec, 1 )
cColorAny := hb_ColorIndex( ::cColorSpec, 1 )
ENDIF
DispBegin()
@@ -268,7 +268,7 @@ METHOD display() CLASS LISTBOX
iif( ::nValue == 0, Space( nSize - 1 ), PadR( ::aItems[ ::nValue ][ _ITEM_cTEXT ], nSize - 1 ) ),;
cColorAny )
DispOut( ::cStyle, __GUIColor( ::cColorSpec, 8 ) )
DispOut( ::cStyle, hb_ColorIndex( ::cColorSpec, 7 ) )
nEnd--
ENDIF
@@ -276,7 +276,7 @@ METHOD display() CLASS LISTBOX
IF ::lIsOpen
IF !Empty( cHotBox )
SetColor( __GUIColor( ::cColorSpec, 5 ) )
SetColor( hb_ColorIndex( ::cColorSpec, 4 ) )
Scroll( nTop, nLeft, ::nBottom, ::nRight )
DispBox( nTop, nLeft, ::nBottom, ::nRight, cHotBox )
@@ -309,10 +309,10 @@ METHOD display() CLASS LISTBOX
cCaption := Stuff( cCaption, nPos, 1, "" )
ENDIF
DispOutAt( ::nCapRow, ::nCapCol - 1, cCaption, __GUIColor( ::cColorSpec, 6 ) )
DispOutAt( ::nCapRow, ::nCapCol - 1, cCaption, hb_ColorIndex( ::cColorSpec, 5 ) )
IF nPos != 0
DispOutAt( ::nCapRow, ::nCapCol + nPos - 2, SubStr( cCaption, nPos, 1 ), __GUIColor( ::cColorSpec, 7 ) )
DispOutAt( ::nCapRow, ::nCapCol + nPos - 2, SubStr( cCaption, nPos, 1 ), hb_ColorIndex( ::cColorSpec, 6 ) )
ENDIF
ENDIF
@@ -916,8 +916,8 @@ METHOD colorSpec( cColorSpec ) CLASS LISTBOX
IF cColorSpec != NIL
::cColorSpec := _eInstVar( Self, "COLORSPEC", cColorSpec, "C", 1001,;
iif( ::lDropDown,;
{|| !Empty( __GUIColor( cColorSpec, 8 ) ) .AND. Empty( __GUIColor( cColorSpec, 9 ) ) },;
{|| !Empty( __GUIColor( cColorSpec, 7 ) ) .AND. Empty( __GUIColor( cColorSpec, 8 ) ) } ) )
{|| !Empty( hb_ColorIndex( cColorSpec, 7 ) ) .AND. Empty( hb_ColorIndex( cColorSpec, 8 ) ) },;
{|| !Empty( hb_ColorIndex( cColorSpec, 6 ) ) .AND. Empty( hb_ColorIndex( cColorSpec, 7 ) ) } ) )
ENDIF
RETURN ::cColorSpec
@@ -1088,13 +1088,13 @@ METHOD New( nTop, nLeft, nBottom, nRight, lDropDown )
::cColorSpec := "W/N,W+/N,W+/N,N/W,W/N,W/N,W+/N,W/N"
ELSE
cColor := SetColor()
::cColorSpec := __GUIColor( cColor, CLR_UNSELECTED + 1 ) + "," +;
__GUIColor( cColor, CLR_UNSELECTED + 1 ) + "," +;
__GUIColor( cColor, CLR_UNSELECTED + 1 ) + "," +;
__GUIColor( cColor, CLR_ENHANCED + 1 ) + "," +;
__GUIColor( cColor, CLR_BORDER + 1 ) + "," +;
__GUIColor( cColor, CLR_STANDARD + 1 ) + "," +;
__GUIColor( cColor, CLR_BACKGROUND + 1 )
::cColorSpec := hb_ColorIndex( cColor, CLR_UNSELECTED ) + "," +;
hb_ColorIndex( cColor, CLR_UNSELECTED ) + "," +;
hb_ColorIndex( cColor, CLR_UNSELECTED ) + "," +;
hb_ColorIndex( cColor, CLR_ENHANCED ) + "," +;
hb_ColorIndex( cColor, CLR_BORDER ) + "," +;
hb_ColorIndex( cColor, CLR_STANDARD ) + "," +;
hb_ColorIndex( cColor, CLR_BACKGROUND )
ENDIF
RETURN Self

View File

@@ -219,11 +219,11 @@ METHOD display() CLASS PUSHBUTTON
DispBegin()
IF ::lBuffer
SetColor( __GUIColor( ::cColorSpec, 3 ) )
SetColor( hb_ColorIndex( ::cColorSpec, 2 ) )
ELSEIF ::lHasFocus
SetColor( __GUIColor( ::cColorSpec, 2 ) )
SetColor( hb_ColorIndex( ::cColorSpec, 1 ) )
ELSE
SetColor( __GUIColor( ::cColorSpec, 1 ) )
SetColor( hb_ColorIndex( ::cColorSpec, 0 ) )
ENDIF
IF ( nPos := At( "&", cCaption ) ) == 0
@@ -251,7 +251,7 @@ METHOD display() CLASS PUSHBUTTON
DispOutAt( nRow, nCol, cCaption )
IF nPos != 0
DispOutAt( nRow, nCol + nPos - 1, SubStr( cCaption, nPos, 1 ), __GUIColor( ::cColorSpec, 4 ) )
DispOutAt( nRow, nCol + nPos - 1, SubStr( cCaption, nPos, 1 ), hb_ColorIndex( ::cColorSpec, 3 ) )
ENDIF
ENDIF
@@ -295,7 +295,7 @@ METHOD colorSpec( cColorSpec ) CLASS PUSHBUTTON
IF cColorSpec != NIL
::cColorSpec := _eInstVar( Self, "COLORSPEC", cColorSpec, "C", 1001,;
{|| !Empty( __GUIColor( cColorSpec, 4 ) ) .AND. Empty( __GUIColor( cColorSpec, 6 ) ) } )
{|| !Empty( hb_ColorIndex( cColorSpec, 3 ) ) .AND. Empty( hb_ColorIndex( cColorSpec, 5 ) ) } )
ENDIF
RETURN ::cColorSpec
@@ -365,10 +365,10 @@ METHOD New( nRow, nCol, cCaption ) CLASS PUSHBUTTON
::cColorSpec := "W/N,N/W,W+/N,W+/N"
ELSE
cColor := SetColor()
::cColorSpec := __GUIColor( cColor, CLR_UNSELECTED + 1 ) + "," +;
__GUIColor( cColor, CLR_ENHANCED + 1 ) + "," +;
__GUIColor( cColor, CLR_STANDARD + 1 ) + "," +;
__GUIColor( cColor, CLR_BACKGROUND + 1 )
::cColorSpec := hb_ColorIndex( cColor, CLR_UNSELECTED ) + "," +;
hb_ColorIndex( cColor, CLR_ENHANCED ) + "," +;
hb_ColorIndex( cColor, CLR_STANDARD ) + "," +;
hb_ColorIndex( cColor, CLR_BACKGROUND )
ENDIF
RETURN Self

View File

@@ -166,7 +166,7 @@ METHOD display() CLASS RADIOBUTTN
DispBegin()
SetColor( iif( ::lBuffer, __GUIColor( ::cColorSpec, 4 ), __GUIColor( ::cColorSpec, 2 ) ) )
SetColor( iif( ::lBuffer, hb_ColorIndex( ::cColorSpec, 3 ), hb_ColorIndex( ::cColorSpec, 1 ) ) )
SetPos( ::nRow, ::nCol )
DispOut( Left( cStyle, 1 ) )
DispOut( iif( ::lBuffer, SubStr( cStyle, 2, 1 ), SubStr( cStyle, 3, 1 ) ) )
@@ -181,10 +181,10 @@ METHOD display() CLASS RADIOBUTTN
cOldCaption := Stuff( cOldCaption, nPos, 1, "" )
ENDIF
DispOutAt( ::nCapRow, ::nCapCol, cOldCaption, __GUIColor( ::cColorSpec, 5 ) )
DispOutAt( ::nCapRow, ::nCapCol, cOldCaption, hb_ColorIndex( ::cColorSpec, 4 ) )
IF nPos != 0
DispOutAt( ::nCapRow, ::nCapCol + nPos - 1, SubStr( cOldCaption, nPos, 1 ), iif( ::lHasfocus, __GUIColor( ::cColorSpec, 7 ), __GUIColor( ::cColorSpec, 6 ) ) )
DispOutAt( ::nCapRow, ::nCapCol + nPos - 1, SubStr( cOldCaption, nPos, 1 ), iif( ::lHasfocus, hb_ColorIndex( ::cColorSpec, 6 ), hb_ColorIndex( ::cColorSpec, 5 ) ) )
ENDIF
ENDIF
@@ -292,7 +292,7 @@ METHOD colorSpec( cColorSpec ) CLASS RADIOBUTTN
IF cColorSpec != NIL
::cColorSpec := _eInstVar( Self, "COLORSPEC", cColorSpec, "C", 1001,;
{|| !Empty( __GUIColor( cColorSpec, 7 ) ) .AND. Empty( __GUIColor( cColorSpec, 8 ) ) } )
{|| !Empty( hb_ColorIndex( cColorSpec, 6 ) ) .AND. Empty( hb_ColorIndex( cColorSpec, 7 ) ) } )
ENDIF
RETURN ::cColorSpec
@@ -356,13 +356,13 @@ METHOD New( nRow, nCol, cCaption, cData ) CLASS RADIOBUTTN
::cColorSpec := "W/N,W+/N,W+/N,N/W,W/N,W/N,W+/N"
ELSE
cColor := SetColor()
::cColorSpec := __GUIColor( cColor, CLR_UNSELECTED + 1 ) + "," +;
__GUIColor( cColor, CLR_UNSELECTED + 1 ) + "," +;
__GUIColor( cColor, CLR_ENHANCED + 1 ) + "," +;
__GUIColor( cColor, CLR_ENHANCED + 1 ) + "," +;
__GUIColor( cColor, CLR_STANDARD + 1 ) + "," +;
__GUIColor( cColor, CLR_STANDARD + 1 ) + "," +;
__GUIColor( cColor, CLR_BACKGROUND + 1 )
::cColorSpec := hb_ColorIndex( cColor, CLR_UNSELECTED ) + "," +;
hb_ColorIndex( cColor, CLR_UNSELECTED ) + "," +;
hb_ColorIndex( cColor, CLR_ENHANCED ) + "," +;
hb_ColorIndex( cColor, CLR_ENHANCED ) + "," +;
hb_ColorIndex( cColor, CLR_STANDARD ) + "," +;
hb_ColorIndex( cColor, CLR_STANDARD ) + "," +;
hb_ColorIndex( cColor, CLR_BACKGROUND )
ENDIF
RETURN Self

View File

@@ -181,7 +181,7 @@ METHOD display() CLASS RADIOGROUP
cUnSelBox := ::cHotBox
ENDIF
SetColor( __GUIColor( ::cColorSpec, 1 ) )
SetColor( hb_ColorIndex( ::cColorSpec, 0 ) )
IF !Empty( cSelBox )
DispBox( ::nTop, ::nLeft, ::nBottom, ::nRight, cSelBox )
@@ -199,10 +199,10 @@ METHOD display() CLASS RADIOGROUP
ENDIF
ENDIF
DispOutAt( ::nCapRow, ::nCapCol, cCaption, __GUIColor( ::cColorSpec, 2 ) )
DispOutAt( ::nCapRow, ::nCapCol, cCaption, hb_ColorIndex( ::cColorSpec, 1 ) )
IF nPos != 0
DispOutAt( ::nCapRow, ::nCapCol + nPos - 1, SubStr( cCaption, nPos, 1 ), __GUIColor( ::cColorSpec, 3 ) )
DispOutAt( ::nCapRow, ::nCapCol + nPos - 1, SubStr( cCaption, nPos, 1 ), hb_ColorIndex( ::cColorSpec, 2 ) )
ENDIF
ENDIF
@@ -551,7 +551,7 @@ METHOD colorSpec( cColorSpec ) CLASS RADIOGROUP
IF cColorSpec != NIL
::cColorSpec := _eInstVar( Self, "COLORSPEC", cColorSpec, "C", 1001,;
{|| !Empty( __GUIColor( cColorSpec, 3 ) ) .AND. Empty( __GUIColor( cColorSpec, 4 ) ) } )
{|| !Empty( hb_ColorIndex( cColorSpec, 2 ) ) .AND. Empty( hb_ColorIndex( cColorSpec, 3 ) ) } )
ENDIF
RETURN ::cColorSpec
@@ -641,9 +641,9 @@ METHOD New( nTop, nLeft, nBottom, nRight ) CLASS RADIOGROUP
::cColorSpec := "W/N,W/N,W+/N"
ELSE
cColor := SetColor()
::cColorSpec := __GUIColor( cColor, CLR_BORDER + 1 ) + "," + ;
__GUIColor( cColor, CLR_STANDARD + 1 ) + "," + ;
__GUIColor( cColor, CLR_BACKGROUND + 1 )
::cColorSpec := hb_ColorIndex( cColor, CLR_BORDER ) + "," + ;
hb_ColorIndex( cColor, CLR_STANDARD ) + "," + ;
hb_ColorIndex( cColor, CLR_BACKGROUND )
ENDIF
RETURN Self

View File

@@ -138,7 +138,7 @@ METHOD display() CLASS SCROLLBAR
DispBegin()
SetColor( __GUIColor( ::cColorSpec, 1 ) )
SetColor( hb_ColorIndex( ::cColorSpec, 0 ) )
IF ::nOrient == SCROLL_VERTICAL
@@ -146,7 +146,7 @@ METHOD display() CLASS SCROLLBAR
DispOutAt( nPos, nOffset, SubStr( cStyle, 2, 1 ) )
NEXT
SetColor( __GUIColor( ::cColorSpec, 2 ) )
SetColor( hb_ColorIndex( ::cColorSpec, 1 ) )
DispOutAt( nStart, nOffset, SubStr( cStyle, 1, 1 ) )
DispOutAt( nStart + ::nThumbPos, nOffset, SubStr( cStyle, 3, 1 ) )
DispOutAt( nEnd + 1, nOffset, SubStr( cStyle, 4, 1 ) )
@@ -154,7 +154,7 @@ METHOD display() CLASS SCROLLBAR
DispOutAt( nOffset, nStart + 1, Replicate( SubStr( cStyle, 2, 1 ), nEnd - nStart ) )
SetColor( __GUIColor( ::cColorSpec, 2 ) )
SetColor( hb_ColorIndex( ::cColorSpec, 1 ) )
DispOutAt( nOffset, nStart, SubStr( cStyle, 1, 1 ) )
DispOutAt( nOffset, nStart + ::nThumbPos, SubStr( cStyle, 3, 1 ) )
DispOutAt( nOffset, nEnd + 1, SubStr( cStyle, 4, 1 ) )
@@ -195,11 +195,11 @@ METHOD update() CLASS SCROLLBAR
nThumbPos := ::nThumbPos
IF ::nOrient == SCROLL_VERTICAL
DispOutAt( ::nStart + nThumbPos, ::nOffSet, SubStr( ::cStyle, 2, 1 ), __GUIColor( ::cColorSpec, 1 ) )
DispOutAt( ::nStart + nThumbPos, ::nOffset, SubStr( ::cStyle, 3, 1 ), __GUIColor( ::cColorSpec, 2 ) )
DispOutAt( ::nStart + nThumbPos, ::nOffSet, SubStr( ::cStyle, 2, 1 ), hb_ColorIndex( ::cColorSpec, 0 ) )
DispOutAt( ::nStart + nThumbPos, ::nOffset, SubStr( ::cStyle, 3, 1 ), hb_ColorIndex( ::cColorSpec, 1 ) )
ELSE
DispOutAt( ::nOffset, ::nStart + nThumbPos, SubStr( ::cStyle, 2, 1 ), __GUIColor( ::cColorSpec, 1 ) )
DispOutAt( ::nOffset, ::nStart + nThumbPos, SubStr( ::cStyle, 3, 1 ), __GUIColor( ::cColorSpec, 2 ) )
DispOutAt( ::nOffset, ::nStart + nThumbPos, SubStr( ::cStyle, 2, 1 ), hb_ColorIndex( ::cColorSpec, 0 ) )
DispOutAt( ::nOffset, ::nStart + nThumbPos, SubStr( ::cStyle, 3, 1 ), hb_ColorIndex( ::cColorSpec, 1 ) )
ENDIF
DispEnd()
@@ -290,8 +290,8 @@ METHOD bitmaps( aBitmaps ) CLASS SCROLLBAR
METHOD colorSpec( cColorSpec ) CLASS SCROLLBAR
IF ISCHARACTER( cColorSpec ) .AND. ;
!Empty( __GUIColor( cColorSpec, 2 ) ) .AND. ;
Empty( __GUIColor( cColorSpec, 3 ) )
!Empty( hb_ColorIndex( cColorSpec, 1 ) ) .AND. ;
Empty( hb_ColorIndex( cColorSpec, 2 ) )
::cColorSpec := cColorSpec
ENDIF
@@ -456,8 +456,8 @@ METHOD New( nStart, nEnd, nOffset, bSBlock, nOrient ) CLASS SCROLLBAR
ENDIF
cColor := SetColor()
::cColorSpec := __GUIColor( cColor, CLR_UNSELECTED + 1 ) + "," + ;
__GUIColor( cColor, CLR_ENHANCED + 1 )
::cColorSpec := hb_ColorIndex( cColor, CLR_UNSELECTED ) + "," + ;
hb_ColorIndex( cColor, CLR_ENHANCED )
RETURN Self

View File

@@ -76,6 +76,8 @@
#define GET_CLR_UNSELECTED 0
#define GET_CLR_ENHANCED 1
#define GET_CLR_CAPTION 2
#define GET_CLR_ACCEL 3
/* NOTE: In CA-Cl*pper TGET class does not inherit from any other classes
and there is no public class function like Get(). There is
@@ -100,13 +102,6 @@ CREATE CLASS Get
VAR rejected INIT .F. READONLY
VAR subScript
VAR typeOut INIT .F. READONLY
#ifdef HB_COMPAT_C53
VAR control
VAR message
VAR caption INIT ""
VAR capRow INIT 0
VAR capCol INIT 0
#endif
METHOD New( nRow, nCol, bVarBlock, cVarName, cPicture, cColorSpec ) /* NOTE: This method is a Harbour extension [vszakats] */
@@ -122,6 +117,11 @@ CREATE CLASS Get
METHOD display( lForced ) /* NOTE: lForced is an undocumented Harbour parameter. Should not be used by app code. [vszakats] */
#ifdef HB_COMPAT_C53
METHOD hitTest( nMRow, nMCol )
METHOD control( oControl ) SETGET /* NOTE: Undocumented CA-Cl*pper 5.3 method. */
METHOD message( cMessage ) SETGET /* NOTE: Undocumented CA-Cl*pper 5.3 method. */
METHOD caption( cCaption ) SETGET /* NOTE: Undocumented CA-Cl*pper 5.3 method. */
METHOD capRow( nCapRow ) SETGET /* NOTE: Undocumented CA-Cl*pper 5.3 method. */
METHOD capCol( nCapCol ) SETGET /* NOTE: Undocumented CA-Cl*pper 5.3 method. */
#endif
METHOD killFocus()
METHOD minus( lMinus ) SETGET
@@ -190,6 +190,11 @@ CREATE CLASS Get
VAR cBuffer
VAR lHideInput INIT .F.
VAR cStyle INIT "*" /* NOTE: First char is to be used as mask character when :hideInput is .T. [vszakats] */
VAR oControl
VAR cMessage INIT ""
VAR cCaption INIT ""
VAR nCapRow INIT 0
VAR nCapCol INIT 0
VAR cPicMask INIT ""
VAR cPicFunc INIT ""
@@ -242,6 +247,9 @@ METHOD display( lForced ) CLASS Get
local cBuffer
local nDispPos
local cCaption
local nPos
DEFAULT lForced TO .T.
if ! ISCHARACTER( ::cBuffer )
@@ -281,6 +289,27 @@ METHOD display( lForced ) CLASS Get
nDispPos := 1
endif
/* Handle C5.3 caption. */
if !Empty( ::cCaption )
cCaption := ::cCaption
if ( nPos := At( "&", cCaption ) ) > 0
if nPos == Len( cCaption )
nPos := 0
else
cCaption := Stuff( cCaption, nPos, 1, "" )
endif
endif
DispOutAt( ::nCapRow, ::nCapCol, cCaption, hb_ColorIndex( ::cColorSpec, GET_CLR_CAPTION ) )
if nPos > 0
DispOutAt( ::nCapRow, ::nCapCol + nPos - 1, SubStr( cCaption, nPos, 1 ), hb_ColorIndex( ::cColorSpec, GET_CLR_ACCEL ) )
endif
endif
/* Display the GET */
if cBuffer != NIL .and. ( lForced .or. nDispPos != ::nOldPos )
DispOutAt( ::nRow, ::nCol,;
iif( ::lHideInput, PadR( Replicate( SubStr( ::cStyle, 1, 1 ), Len( RTrim( cBuffer ) ) ), ::nDispLen ), SubStr( cBuffer, nDispPos, ::nDispLen ) ),;
@@ -1117,8 +1146,8 @@ METHOD delWordRight() CLASS Get
METHOD colorSpec( cColorSpec ) CLASS Get
local nClrUns
local nClrEnh
local cClrEnh
local nClrOth
local cClrOth
if PCount() == 0
return ::cColorSpec
@@ -1126,12 +1155,15 @@ METHOD colorSpec( cColorSpec ) CLASS Get
if ISCHARACTER( cColorSpec )
nClrUns := hb_ColorToN( hb_ColorIndex( cColorSpec, GET_CLR_UNSELECTED ) )
nClrEnh := hb_ColorToN( cClrEnh := hb_ColorIndex( cColorSpec, GET_CLR_ENHANCED ) )
::cColorSpec := hb_NToColor( nClrUns ) +;
"," +;
hb_NToColor( iif( ( nClrEnh != 0 .or. Upper( StrTran( cClrEnh, " ", "" ) ) == "N/N" ), nClrEnh, nClrUns ) )
#ifdef HB_COMPAT_C53
::cColorSpec := hb_NToColor( nClrUns := hb_ColorToN( hb_ColorIndex( cColorSpec, GET_CLR_UNSELECTED ) ) ) +;
"," + hb_NToColor( iif( ( nClrOth := hb_ColorToN( cClrOth := hb_ColorIndex( cColorSpec, GET_CLR_ENHANCED ) ) ) != 0 .or. Upper( StrTran( cClrOth, " ", "" ) ) == "N/N", nClrOth, nClrUns ) ) +;
"," + hb_NToColor( iif( ( nClrOth := hb_ColorToN( cClrOth := hb_ColorIndex( cColorSpec, GET_CLR_CAPTION ) ) ) != 0 .or. Upper( StrTran( cClrOth, " ", "" ) ) == "N/N", nClrOth, nClrUns ) ) +;
"," + hb_NToColor( iif( ( nClrOth := hb_ColorToN( cClrOth := hb_ColorIndex( cColorSpec, GET_CLR_ACCEL ) ) ) != 0 .or. Upper( StrTran( cClrOth, " ", "" ) ) == "N/N", nClrOth, nClrUns ) )
#else
::cColorSpec := hb_NToColor( nClrUns := hb_ColorToN( hb_ColorIndex( cColorSpec, GET_CLR_UNSELECTED ) ) ) +;
"," + hb_NToColor( iif( ( nClrOth := hb_ColorToN( cClrOth := hb_ColorIndex( cColorSpec, GET_CLR_ENHANCED ) ) ) != 0 .or. Upper( StrTran( cClrOth, " ", "" ) ) == "N/N", nClrOth, nClrUns ) )
#endif
return cColorSpec
@@ -1447,15 +1479,63 @@ METHOD reform() CLASS Get
METHOD hitTest( nMRow, nMCol ) CLASS Get
if ::nRow == nMRow .and. ;
nMCol >= ::nCol - iif( Set( _SET_DELIMITERS ), 1, 0 ) .and. ;
nMCol <= ::nCol + ::nDispLen + iif( Set( _SET_DELIMITERS ), 1, 0 )
return HTCLIENT
if ISOBJECT( ::oControl )
return ::oControl:hitTest( nMRow, nMCol )
else
do case
case nMRow == ::nRow .and. ;
nMCol >= ::nCol .and. ;
nMCol < ::nCol + iif( ::nDispLen == NIL, 0, ::nDispLen )
return HTCLIENT
case nMRow == ::nCapRow .and. ;
nMCol >= ::nCapCol .and. ;
nMCol < ::nCapCol + Len( ::cCaption ) /* NOTE: C5.3 doesn't care about the shortcut key. */
return HTCAPTION
endcase
endif
return HTNOWHERE
METHOD control( oControl ) CLASS Get
if PCount() == 1 .and. ( oControl == NIL .or. ISOBJECT( oControl ) )
::oControl := oControl
endif
return ::oControl
METHOD caption( cCaption ) CLASS Get
if ISCHARACTER( cCaption )
::cCaption := cCaption
endif
return ::cCaption
METHOD capRow( nCapRow ) CLASS Get
if ISNUMBER( nCapRow )
::nCapRow := nCapRow
endif
return ::nCapRow
METHOD capCol( nCapCol ) CLASS Get
if ISNUMBER( nCapCol )
::nCapCol := nCapCol
endif
return ::nCapCol
METHOD message( cMessage ) CLASS Get
if ISCHARACTER( cMessage )
::cMessage := cMessage
endif
return ::cMessage
#endif
#ifdef HB_COMPAT_XPP
@@ -1831,7 +1911,15 @@ METHOD New( nRow, nCol, bVarBlock, cVarName, cPicture, cColorSpec ) CLASS Get
DEFAULT nCol TO Col() + iif( Set( _SET_DELIMITERS ), 1, 0 )
DEFAULT cVarName TO ""
DEFAULT bVarBlock TO iif( ISCHARACTER( cVarName ), MemvarBlock( cVarName ), NIL )
DEFAULT cColorSpec TO hb_ColorIndex( SetColor(), CLR_UNSELECTED ) + "," + hb_ColorIndex( SetColor(), CLR_ENHANCED )
#ifdef HB_COMPAT_C53
DEFAULT cColorSpec TO hb_ColorIndex( SetColor(), CLR_UNSELECTED ) + "," +;
hb_ColorIndex( SetColor(), CLR_ENHANCED ) + "," +;
hb_ColorIndex( SetColor(), CLR_STANDARD ) + "," +;
iif( IsDefColor(), iif( Set( _SET_INTENSITY ), "W+/N", "W/N" ), hb_ColorIndex( SetColor(), CLR_BACKGROUND ) )
#else
DEFAULT cColorSpec TO hb_ColorIndex( SetColor(), CLR_UNSELECTED ) + "," +;
hb_ColorIndex( SetColor(), CLR_ENHANCED )
#endif
::nRow := nRow
::nCol := nCol

View File

@@ -228,7 +228,7 @@ METHOD display() CLASS POPUPMENU
DispBox( nTop, nLeft, ::nBottom, ::nRight, ;
SubStr( ::cBorder, 1, 8 ) + " ", ;
__GUIColor( ::cColorSpec, 6 ) )
hb_ColorIndex( ::cColorSpec, 5 ) )
#ifdef HB_EXTENSION
IF ::shadowed
@@ -243,7 +243,7 @@ METHOD display() CLASS POPUPMENU
IF aItems[ nPos ]:caption == MENU_SEPARATOR
DispOutAt( nTop, nLeft - 1, SubStr( ::cBorder, 9, 1 ) + Replicate( SubStr( ::cBorder, 10, 1 ), nWidth ) + SubStr( ::cBorder, 11, 1 ), __GUIColor( ::cColorSpec, 6 ) )
DispOutAt( nTop, nLeft - 1, SubStr( ::cBorder, 9, 1 ) + Replicate( SubStr( ::cBorder, 10, 1 ), nWidth ) + SubStr( ::cBorder, 11, 1 ), hb_ColorIndex( ::cColorSpec, 5 ) )
ELSE
cCaption := PadR( aItems[ nPos ]:caption, nWidth - 1 )
@@ -283,10 +283,10 @@ METHOD display() CLASS POPUPMENU
cCaption := Stuff( cCaption, nHotKeyPos, 1, "" )
ENDIF
DispOutAt( nTop, nLeft, cCaption, __GUIColor( ::cColorSpec, iif( nPos == nCurrent, 2, iif( aItems[ nPos ]:enabled, 1, 5 ) ) ) )
DispOutAt( nTop, nLeft, cCaption, hb_ColorIndex( ::cColorSpec, iif( nPos == nCurrent, 1, iif( aItems[ nPos ]:enabled, 0, 4 ) ) ) )
IF aItems[ nPos ]:enabled .AND. nHotKeyPos != 0
DispOutAt( nTop, nLeft + nHotKeyPos - 1, SubStr( cCaption, nHotKeyPos, 1 ), __GUIColor( ::cColorSpec, iif( nPos == nCurrent, 4, 3 ) ) )
DispOutAt( nTop, nLeft + nHotKeyPos - 1, SubStr( cCaption, nHotKeyPos, 1 ), hb_ColorIndex( ::cColorSpec, iif( nPos == nCurrent, 3, 2 ) ) )
ENDIF
ENDIF
NEXT
@@ -718,7 +718,7 @@ METHOD colorSpec( cColorSpec ) CLASS POPUPMENU
IF cColorSpec != NIL
::cColorSpec := _eInstVar( Self, "COLORSPEC", cColorSpec, "C", 1001,;
{|| !Empty( __GUIColor( cColorSpec, 6 ) ) .AND. Empty( __GUIColor( cColorSpec, 7 ) ) } )
{|| !Empty( hb_ColorIndex( cColorSpec, 5 ) ) .AND. Empty( hb_ColorIndex( cColorSpec, 6 ) ) } )
ENDIF
RETURN ::cColorSpec
@@ -794,12 +794,12 @@ METHOD New( nTop, nLeft, nBottom, nRight ) CLASS POPUPMENU
::cColorSpec := "N/W,W/N,W+/W,W+/N,N+/W,W/N"
ELSE
cColor := SetColor()
::cColorSpec := __GUIColor( cColor, CLR_UNSELECTED + 1 ) + "," +;
__GUIColor( cColor, CLR_ENHANCED + 1 ) + "," +;
__GUIColor( cColor, CLR_BACKGROUND + 1 ) + "," +;
__GUIColor( cColor, CLR_ENHANCED + 1 ) + "," +;
__GUIColor( cColor, CLR_STANDARD + 1 ) + "," +;
__GUIColor( cColor, CLR_BORDER + 1 )
::cColorSpec := hb_ColorIndex( cColor, CLR_UNSELECTED ) + "," +;
hb_ColorIndex( cColor, CLR_ENHANCED ) + "," +;
hb_ColorIndex( cColor, CLR_BACKGROUND ) + "," +;
hb_ColorIndex( cColor, CLR_ENHANCED ) + "," +;
hb_ColorIndex( cColor, CLR_STANDARD ) + "," +;
hb_ColorIndex( cColor, CLR_BORDER )
ENDIF
RETURN Self

View File

@@ -154,8 +154,8 @@ METHOD display() CLASS TOPBARMENU
LOCAL nItemCount := ::nItemCount
LOCAL nCurrent := ::nCurrent
LOCAL cColor1 := __GUIColor( ::cColorSpec, 1 )
LOCAL cColor2 := __GUIColor( ::cColorSpec, 2 )
LOCAL cColor1 := hb_ColorIndex( ::cColorSpec, 0 )
LOCAL cColor2 := hb_ColorIndex( ::cColorSpec, 1 )
LOCAL oPopUp
LOCAL nItem
@@ -202,11 +202,11 @@ METHOD display() CLASS TOPBARMENU
DispOutAt( nRow, nLeft, cCaption,;
iif( nItem == nCurrent, cColor2,;
iif( aItems[ nItem ]:enabled, cColor1, __GUIColor( ::cColorSpec, 5 ) ) ) )
iif( aItems[ nItem ]:enabled, cColor1, hb_ColorIndex( ::cColorSpec, 4 ) ) ) )
IF aItems[ nItem ]:enabled .AND. nPos > 0
DispOutAt( nRow, nLeft + nPos - 1, SubStr( cCaption, nPos, 1 ),;
iif( nItem == nCurrent, __GUIColor( ::cColorSpec, 4 ), __GUIColor( ::cColorSpec, 3 ) ) )
iif( nItem == nCurrent, hb_ColorIndex( ::cColorSpec, 3 ), hb_ColorIndex( ::cColorSpec, 2 ) ) )
ENDIF
nLeft += nCaptionLen
@@ -416,7 +416,7 @@ METHOD colorSpec( cColorSpec ) CLASS TOPBARMENU
IF cColorSpec != NIL
::cColorSpec := _eInstVar( Self, "COLORSPEC", cColorSpec, "C", 1001,;
{|| !Empty( __GUIColor( cColorSpec, 6 ) ) .AND. Empty( __GUIColor( cColorSpec, 7 ) ) } )
{|| !Empty( hb_ColorIndex( cColorSpec, 5 ) ) .AND. Empty( hb_ColorIndex( cColorSpec, 6 ) ) } )
ENDIF
RETURN ::cColorSpec
@@ -472,12 +472,12 @@ METHOD New( nRow, nLeft, nRight ) CLASS TOPBARMENU
::cColorSpec := "N/W,W/N,W+/W,W+/N,N+/W,W/N"
ELSE
cColor := SetColor()
::cColorSpec := __GUIColor( cColor, CLR_UNSELECTED + 1 ) + "," +;
__GUIColor( cColor, CLR_ENHANCED + 1 ) + "," +;
__GUIColor( cColor, CLR_BACKGROUND + 1 ) + "," +;
__GUIColor( cColor, CLR_ENHANCED + 1 ) + "," +;
__GUIColor( cColor, CLR_STANDARD + 1 ) + "," +;
__GUIColor( cColor, CLR_BORDER + 1 )
::cColorSpec := hb_ColorIndex( cColor, CLR_UNSELECTED ) + "," +;
hb_ColorIndex( cColor, CLR_ENHANCED ) + "," +;
hb_ColorIndex( cColor, CLR_BACKGROUND ) + "," +;
hb_ColorIndex( cColor, CLR_ENHANCED ) + "," +;
hb_ColorIndex( cColor, CLR_STANDARD ) + "," +;
hb_ColorIndex( cColor, CLR_BORDER )
ENDIF
RETURN Self