From 0301bd545f9f677de635cae7398ae9a27acf8d25 Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Wed, 4 May 2011 08:36:42 +0000 Subject: [PATCH] 2011-05-04 01:25 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbxbp/xbpwindow.prg * contrib/hbxbp/xbpdialog.prg + Implemented: XbpDialog() :tasklist, :border, :maxButton, :minButton, :alwaysOnTop functionality. Shum, can you provide feedback ? --- harbour/ChangeLog | 7 +++ harbour/contrib/hbxbp/xbpdialog.prg | 90 +++++++++++++++++++---------- harbour/contrib/hbxbp/xbpwindow.prg | 7 ++- 3 files changed, 73 insertions(+), 31 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index fb19e0aa23..79c3f7976c 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,13 @@ The license applies to all entries newer than 2009-04-28. */ +2011-05-04 01:25 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) + * contrib/hbxbp/xbpwindow.prg + * contrib/hbxbp/xbpdialog.prg + + Implemented: XbpDialog() :tasklist, :border, :maxButton, + :minButton, :alwaysOnTop + functionality. Shum, can you provide feedback ? + 2011-05-03 23:17 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbct/doc/en/tab.txt * contrib/xhb/hbcompat.ch diff --git a/harbour/contrib/hbxbp/xbpdialog.prg b/harbour/contrib/hbxbp/xbpdialog.prg index d541c3d0b7..8d34ad4aa8 100644 --- a/harbour/contrib/hbxbp/xbpdialog.prg +++ b/harbour/contrib/hbxbp/xbpdialog.prg @@ -96,10 +96,8 @@ CLASS XbpDialog FROM XbpWindow METHOD init( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) METHOD configure( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) - METHOD handleEvent( nEvent, mp1, mp2 ) VIRTUAL METHOD execEvent( nEvent, pEvent ) - //METHOD close() INLINE NIL METHOD destroy() METHOD showModal() @@ -138,6 +136,23 @@ METHOD XbpDialog:init( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) RETURN Self /*----------------------------------------------------------------------*/ +#if 0 +Qt::FramelessWindowHint + +Qt_CustomizeWindowHint +Qt_WindowTitleHint +Qt_WindowSystemMenuHint +Qt_WindowMinimizeButtonHint +Qt_WindowMaximizeButtonHint +Qt_WindowMinMaxButtonsHint +Qt_WindowCloseButtonHint +Qt_WindowContextHelpButtonHint +Qt_WindowShadeButtonHint +Qt_WindowStaysOnTopHint +Qt_WindowStaysOnBottomHint +Qt_WindowOkButtonHint +Qt_WindowCancelButtonHint +#endif METHOD XbpDialog:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) LOCAL nFlags, nnFlags @@ -155,7 +170,11 @@ METHOD XbpDialog:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) ENDIF ::oWidget:setMouseTracking( .t. ) ELSE - ::oWidget := QMainWindow() + IF ::taskList + ::oWidget := QMainWindow() + ELSE + ::oWidget := QMainWindow( SetAppWindow() ) + ENDIF ::oWidget:setMouseTracking( .t. ) ::oWidget:setObjectName( "mainWindow" ) ENDIF @@ -168,32 +187,38 @@ METHOD XbpDialog:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) ::oWidget:setCentralWidget( ::drawingArea:oWidget ) ENDIF - nFlags := ::oWidget:windowFlags() - nnFlags := nFlags - IF ! ::maxButton - IF hb_bitAnd( nFlags, Qt_WindowMaximizeButtonHint ) == Qt_WindowMaximizeButtonHint - nFlags -= Qt_WindowMaximizeButtonHint + nnFlags := ::oWidget:windowFlags() + nFlags := Qt_Window + + IF ::border == XBPDLG_NO_BORDER + nFlags := hb_bitOr( nFlags, Qt_FramelessWindowHint ) + + ELSE + nFlags := hb_bitOr( nFlags, Qt_CustomizeWindowHint ) + nFlags := hb_bitOr( nFlags, Qt_WindowCloseButtonHint ) + + IF ::titleBar + nFlags := hb_bitOr( nFlags, Qt_WindowTitleHint ) + ENDIF + IF ::sysMenu + nFlags := hb_bitOr( nFlags, Qt_WindowSystemMenuHint ) + ENDIF + IF ::maxButton + nFlags := hb_bitOr( nFlags, Qt_WindowMaximizeButtonHint ) + ENDIF + IF ::minButton + nFlags := hb_bitOr( nFlags, Qt_WindowMinimizeButtonHint ) ENDIF ENDIF - IF ! ::minButton - IF hb_bitAnd( nFlags, Qt_WindowMinimizeButtonHint ) == Qt_WindowMinimizeButtonHint - nFlags -= Qt_WindowMinimizeButtonHint - ENDIF + + IF ::alwaysOnTop + nFlags += hb_bitOr( nFlags, Qt_WindowStaysOnTopHint ) ENDIF - #if 0 - IF !( ::taskList ) - IF hb_bitAnd( nFlags, Qt_Window ) == Qt_Window - nFlags -= Qt_Window - ENDIF - /* This hides the taskbar entry but title bar is not visible */ - nFlags += Qt_ToolTip + Qt_WindowTitleHint - ENDIF - #endif IF nnFlags != nFlags ::oWidget:setWindowFlags( nFlags ) ENDIF - IF !empty( ::title ) + IF ! empty( ::title ) ::oWidget:setWindowTitle( ::title ) ENDIF IF hb_isChar( ::icon ) @@ -202,6 +227,18 @@ METHOD XbpDialog:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) ::setPosAndSize() + IF ::border == XBPDLG_RAISEDBORDERTHICK_FIXED .OR. ; + ::border == XBPDLG_RAISEDBORDERTHIN_FIXED .OR. ; + ::border == XBPDLG_RECESSEDBORDERTHICK_FIXED .OR. ; + ::border == XBPDLG_RECESSEDBORDERTHIN_FIXED + + ::oWidget:setMinimumWidth( ::oWidget:width() ) + ::oWidget:setMaximumWidth( ::oWidget:width() ) + ::oWidget:setMinimumHeight( ::oWidget:height() ) + ::oWidget:setMaximumHeight( ::oWidget:height() ) + ENDIF + + ::nFlags := nFlags IF __objGetClsName( ::oParent ) == "XBPDRAWINGAREA" ::setParent( ::oParent ) @@ -233,11 +270,7 @@ METHOD XbpDialog:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) METHOD XbpDialog:destroy() - HB_TRACE( HB_TR_DEBUG, ". " ) - HB_TRACE( HB_TR_DEBUG, "<<<<<<<<<< XbpDialog:destroy B >>>>>>>>>>" ) - IF ! empty( ::oMdi ) -// ::oParent:oWidget:removeSubWindow( ::oMdi ) ::oMdi := NIL ENDIF @@ -255,9 +288,6 @@ METHOD XbpDialog:destroy() ::XbpWindow:destroy() - HB_TRACE( HB_TR_DEBUG, "<<<<<<<<<< XbpDialog:destroy E >>>>>>>>>>" ) - HB_TRACE( HB_TR_DEBUG, ". " ) - RETURN Self /*----------------------------------------------------------------------*/ @@ -279,7 +309,7 @@ METHOD XbpDialog:execEvent( nEvent, pEvent ) SetAppEvent( xbeP_Close, NIL, NIL, Self ) ENDCASE - RETURN .T. + RETURN .F. /*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbxbp/xbpwindow.prg b/harbour/contrib/hbxbp/xbpwindow.prg index d95a279290..f32e69e015 100644 --- a/harbour/contrib/hbxbp/xbpwindow.prg +++ b/harbour/contrib/hbxbp/xbpwindow.prg @@ -627,7 +627,7 @@ METHOD XbpWindow:grabEvent( nEvent, oEvent ) oP0 := oEvent:oldPos() oP1 := oEvent:pos() ::moveOwned( oP1:x() - oP0:x(), oP1:y() - oP0:y() ) - // SetAppEvent( xbeP_Move, { oP0:x(), oP0:y() }, { oP1:x(), oP1:y() }, Self ) + // SetAppEvent( xbeP_Move, { oP0:x(), oP0:y() }, { oP1:x(), oP1:y() }, Self ) RETURN .f. CASE QEvent_Resize // :resize() oObj_O := oEvent:oldSize() @@ -667,6 +667,11 @@ METHOD XbpWindow:handleEvent( nEvent, mp1, mp2 ) SWITCH ( nEvent ) + CASE xbeP_Close + IF ! empty( ::oWidget ) + ::destroy() + ENDIF + EXIT CASE xbeP_Keyboard ::keyboard( mp1 ) EXIT