2009-06-13 16:57 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)
* harbour/contrib/hbxbp/appevent.ch
* harbour/contrib/hbxbp/tests/demoxbp.prg
* harbour/contrib/hbxbp/xbpdialog.prg
* harbour/contrib/hbxbp/xbpgeneric.prg
* harbour/contrib/hbxbp/xbpwindow.prg
! Added more constructs.
Now demoxbp.prg is compilable as is with both compilers
and we can exerience differences. Note, I have not implemented
kbeP_Close event and keyboard modifiers, so quiting the demo
is : Harbour - press 'Q' Xbase++ - press upper 'Q' or X button.
This commit is contained in:
@@ -17,6 +17,18 @@
|
||||
past entries belonging to author(s): Viktor Szakats.
|
||||
*/
|
||||
|
||||
2009-06-13 16:57 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)
|
||||
* harbour/contrib/hbxbp/appevent.ch
|
||||
* harbour/contrib/hbxbp/tests/demoxbp.prg
|
||||
* harbour/contrib/hbxbp/xbpdialog.prg
|
||||
* harbour/contrib/hbxbp/xbpgeneric.prg
|
||||
* harbour/contrib/hbxbp/xbpwindow.prg
|
||||
! Added more constructs.
|
||||
Now demoxbp.prg is compilable as is with both compilers
|
||||
and we can exerience differences. Note, I have not implemented
|
||||
kbeP_Close event and keyboard modifiers, so quiting the demo
|
||||
is : Harbour - press 'Q' Xbase++ - press upper 'Q' or X button.
|
||||
|
||||
2009-06-14 01:56 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
|
||||
+ contrib/rddsql/sddmy/tests/hbmk.hbm
|
||||
- contrib/rddsql/sddmy/tests/sddmy.hbc
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
#define xbeP_None (001 + xbeB_Event)
|
||||
#define xbeP_Keyboard (004 + xbeB_Event)
|
||||
#define xbeP_User 134217728
|
||||
#define xbeP_Close (056 + xbeB_Event)
|
||||
#define xbeP_Quit (057 + xbeB_Event)
|
||||
#define xbeM_Motion (022 + xbeB_Event)
|
||||
|
||||
#define xbeK_ESC 27
|
||||
|
||||
@@ -63,6 +63,8 @@ PROCEDURE Main()
|
||||
/* Create Application Window */
|
||||
oDlg := GuiStdDialog( 'Harbour - Xbase++ - QT Dialog [ Press "Q" to Exit ]' )
|
||||
|
||||
SetAppWindow( oDlg )
|
||||
|
||||
/* Obtain desktop dimensions */
|
||||
aSize := AppDesktop():currentSize()
|
||||
/* Place on the center of desktop */
|
||||
@@ -81,10 +83,10 @@ PROCEDURE Main()
|
||||
/* Enter Xbase++ Event Loop - still with limited functionality but working */
|
||||
DO WHILE .t.
|
||||
nEvent := AppEvent( @mp1, @mp2, @oXbp )
|
||||
|
||||
IF nEvent == xbeP_Keyboard .and. mp1 == 81
|
||||
IF nEvent == xbeP_Close .or. ( nEvent == xbeP_Keyboard .and. mp1 == 81 )
|
||||
EXIT
|
||||
ENDIF
|
||||
oXbp:handleEvent( nEvent, mp1, mp2 )
|
||||
ENDDO
|
||||
|
||||
/* Very important - destroy resources */
|
||||
@@ -118,7 +120,8 @@ STATIC FUNCTION GuiStdDialog( cTitle )
|
||||
STATIC FUNCTION Build_MenuBar( oDlg )
|
||||
LOCAL oMenuBar, oSubMenu
|
||||
|
||||
oMenuBar := XbpMenuBar():new( oDlg ):create()
|
||||
//oMenuBar := XbpMenuBar():new( oDlg ):create()
|
||||
oMenuBar := SetAppWindow():MenuBar()
|
||||
|
||||
/* Define submenu in procedural style.
|
||||
* The numeric index of the selected menu item
|
||||
@@ -144,13 +147,12 @@ STATIC FUNCTION Build_MenuBar( oDlg )
|
||||
oSubMenu:addItem( { "Play Closing ~2", {|| MyFunctionXbp( 2 ) } } )
|
||||
oSubMenu:addItem( { NIL, NIL, XBPMENUBAR_MIS_SEPARATOR, NIL } )
|
||||
oSubMenu:addItem( { "new.png|~MessageBox", {|| MyFunctionXbp( 3 ) }, , XBPMENUBAR_MIA_HILITED } )
|
||||
//
|
||||
oMenuBar:addItem( { oSubMenu, NIL } )
|
||||
//
|
||||
oSubMenu:insItem( 2, { "This executes MsgBox()", {|| MyFunctionXbp( 103 ) }, , XBPMENUBAR_MIA_CHECKED } )
|
||||
//
|
||||
oSubMenu:itemMarked := {|mp1| IF( mp1 == 5, MsgBox( "WOW - ::itemMarked - Activated" ), NIL ) }
|
||||
//
|
||||
|
||||
/* Menu colors are being honored in Harbour only */
|
||||
oSubMenu:setColorFG( GraMakeRGBColor( { 255, 1, 1 } ) )
|
||||
oSubMenu:setColorBG( GraMakeRGBColor( { 134,128,250 } ) )
|
||||
|
||||
|
||||
@@ -278,34 +278,11 @@ METHOD XbpDrawingArea:create( oParent, oOwner, aPos, aSize, aPresParams, lVisibl
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD XbpDrawingArea:handleEvent( nMessage, aNM )
|
||||
LOCAL hDC
|
||||
METHOD XbpDrawingArea:handleEvent( nEvent, mp1, mp2 )
|
||||
|
||||
hb_ToOutDebug( " %s:handleEvent( %i )", __ObjGetClsName( self ), nMessage )
|
||||
|
||||
DO CASE
|
||||
|
||||
CASE nMessage == HB_GTE_RESIZED
|
||||
IF hb_isBlock( ::sl_resize )
|
||||
eval( ::sl_resize, NIL, NIL, self )
|
||||
ENDIF
|
||||
aeval( ::aChildren, {|o| o:handleEvent( HB_GTE_RESIZED, { 0, 0, 0, 0, 0 } ) } )
|
||||
RETURN ( 0 )
|
||||
|
||||
CASE nMessage == HB_GTE_CTLCOLOR
|
||||
hDC := aNM[ 1 ]
|
||||
|
||||
IF hb_isNumeric( ::clr_FG )
|
||||
Qtc_SetTextColor( hDC, ::clr_FG )
|
||||
ENDIF
|
||||
IF hb_isNumeric( ::hBrushBG )
|
||||
Qtc_SetBkMode( hDC, 1 )
|
||||
|
||||
Qtc_FillRect( hDC, { 0,0,::currentSize()[1],::currentSize()[1]}, ::hBrushBG )
|
||||
RETURN ( 0 )
|
||||
ENDIF
|
||||
|
||||
ENDCASE
|
||||
HB_SYMBOL_UNUSED( nEvent )
|
||||
HB_SYMBOL_UNUSED( mp1 )
|
||||
HB_SYMBOL_UNUSED( mp2 )
|
||||
|
||||
RETURN ( 1 )
|
||||
|
||||
|
||||
@@ -79,6 +79,8 @@ THREAD STATIC nEventIn := 0
|
||||
THREAD STATIC nEventOut := 0
|
||||
THREAD STATIC ts_mutex
|
||||
|
||||
STATIC oDummy
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
INIT PROCEDURE Qt_Start()
|
||||
@@ -122,7 +124,7 @@ FUNCTION AppEvent( mp1, mp2, oXbp )
|
||||
nEvent := 0
|
||||
mp1 := NIL
|
||||
mp2 := NIL
|
||||
oXbp := NIL
|
||||
oXbp := oDummy
|
||||
ELSE
|
||||
nEvent := ts_events[ nEventOut,1 ]
|
||||
mp1 := ts_events[ nEventOut,2 ]
|
||||
@@ -147,6 +149,9 @@ FUNCTION SetAppWindow( oXbp )
|
||||
IF empty( ts_events )
|
||||
ts_events := array( EVENT_BUFFER )
|
||||
ENDIF
|
||||
IF empty( oDummy )
|
||||
oDummy := XbpObject():new()
|
||||
ENDIF
|
||||
|
||||
oldAppWindow := oAppWindow
|
||||
|
||||
|
||||
@@ -1409,6 +1409,23 @@ FUNCTION hb_toOut( ... )
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
CLASS XbpObject
|
||||
|
||||
METHOD INIT
|
||||
METHOD HandleEvent() INLINE ( 1 )
|
||||
|
||||
ENDCLASS
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD XbpObject:INIT()
|
||||
RETURN Self
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user