Files
harbour-core/harbour/examples/gtwvw/tests/maximize.prg
Viktor Szakats a5a304efc2 2009-12-22 03:47 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* src/rtl/gtwvt/gtwvt.c
    % Deleted unnecessary cast.

  * utils/hbmk2/hbmk2.pt_BR.po
    + Uploaded new version received from Vailton Renato. Thanks!

  * utils/hbmk2/hbmk2.hu_HU.po
    + Updated.
    + Added some new translations.

  * utils/hbmk2/hbmk2.prg
    * Minor formatting.
    ! Fixed typo in one of the displayed texts.

  + examples/gtwvw
  + examples/gtwvw/Makefile
  + examples/gtwvw/hbgtwvw.h
  + examples/gtwvw/hbole.h
  + examples/gtwvw/gtwvw.c
  + examples/gtwvw/wvwdraw.c
  + examples/gtwvw/wvwmenu.c
  + examples/gtwvw/wvwstbar.c
  + examples/gtwvw/wvwcheck.c
  + examples/gtwvw/wvwfuncs.c
  + examples/gtwvw/wvwpush.c
  + examples/gtwvw/wvwedit.c
  + examples/gtwvw/wvwtbar.c
  + examples/gtwvw/gtwvw.hbc
  + examples/gtwvw/gtwvw.hbp
  + examples/gtwvw/readme.txt
  + examples/gtwvw/tests
  + examples/gtwvw/tests/wvwtest9.rc
  + examples/gtwvw/tests/prog1.prg
  + examples/gtwvw/tests/prog2.prg
  + examples/gtwvw/tests/dia_excl.ico
  + examples/gtwvw/tests/drawimg.prg
  + examples/gtwvw/tests/vouch1.bmp
  + examples/gtwvw/tests/wvwmouse.prg
  + examples/gtwvw/tests/wvwtest9.hbp
  + examples/gtwvw/tests/hbmk.hbm
  + examples/gtwvw/tests/cbtest1.prg
  + examples/gtwvw/tests/def2.bmp
  + examples/gtwvw/tests/maincoor.prg
  + examples/gtwvw/tests/wvt2wvw.ch
  + examples/gtwvw/tests/cbtest6.prg
  + examples/gtwvw/tests/wvwtest9.prg
  + examples/gtwvw/tests/ebtest7.prg
  + examples/gtwvw/tests/vouch1.gif
  + examples/gtwvw/tests/maximize.prg
  + examples/gtwvw/tests/readme.txt
  + examples/gtwvw/tests/wvwtest9.xml
  + examples/gtwvw/tests/inpfocus.prg
  + examples/gtwvw/tests/prog0.prg
  + examples/gtwvw/docs
  + examples/gtwvw/docs/funclist.txt
  + examples/gtwvw/docs/gtwvw.txt
  + examples/gtwvw/docs/whatsnew.txt
    + Added rudimentary port of GTWVW to Harbour.
      (The source was current xhb CVS repository.)
      The port is very very (very) far from anything else
      than can be found in Harbour, this port involved making
      all the minimum required steps to build and link under
      Harbour, plus some extra cleanups.
    ! Lots of cleanups and fixes.
    + Added Harbour make files (both GNU make and hbmk2)
    + Cleaned tests to avoid multiple symbols and much simpler
      interdependencies.
    ! Removed extra test.dbf and what32 dependency.
    ; TOFIX: Due to public symbol collisions, this GTWVW it's
             probably not possible to use it with gtwin lib.
    ; NOTE: GTWVW is limited to non-UNICODE, non-C++, 32-bit
            Windows (no WinCE) builds, and for a clean compiler
            I had to suppress Harbour standard warning levels.
            Anyway, not basic tests program seems to work,
            although I didn't dig into them very deeply.
            We will see if this contrib turns out to be useful
            or not, and we can decide to drop it or maybe
            moving it to contrib once it has been brought up
            to Harbour standards. Although the code is huge,
            so don't expect to happen this very soon.
2009-12-22 02:50:24 +00:00

123 lines
3.5 KiB
Plaintext

/*
* $Id$
*/
/*
sample on using Maximize Mode in gtwvw.
budyanto@centrin.net.id
*/
#include "inkey.ch"
* this dimension will be used when user presses RESTORE button
static s_nNormalMaxrow := 24
static s_nNormalMaxcol := 79
STATIC s_lSizeReady := .F.
procedure main
local ch
* activate WVW_SIZE()
s_lSizeReady := .t.
* the biggest possible window
setcolor("N/W")
setmode(wvw_maxmaxrow()+1, wvw_maxmaxcol()+1)
* enable MAXIMIZE button
wvw_enablemaximize(0, .t.)
* set the window to MAXIMIZED state
wvw_maximize(0)
updatescr()
do while (ch := inkey(0))<>K_ESC
* refresh screen, probably in a new dimension
* (You may alternatively call updatescr() from WVW_SIZE instead)
updatescr()
enddo
return
procedure diminfo()
@ 0, 0 say "Window size: " + alltrim(str(maxrow()+1)) + " x " + alltrim(str(maxcol()+1)) + " "
return
procedure updatescr()
local i
CLS
for i := 0 to maxcol()
@ 0,i say "T"
next
for i := 0 to maxrow()
@ i,0 say "L"
next
for i := 0 to maxcol()
@ maxrow(),i say "B"
//@ maxrow()-1,i say right(tran(i,"999"),1)
next
for i := 0 to maxrow()
@ i,maxcol() say "R"
next
@ int(maxrow()/2)+0, 2 say padc("Press MAXIMIZE/RESTORE button to change dimension", maxcol()+1-4)
@ int(maxrow()/2)+1, 2 say padc("Try also changing taskbar size/position", maxcol()+1-4)
@ int(maxrow()/2)+3, 2 say padc("Press any key to redraw screen", maxcol()+1-4)
@ int(maxrow()/2)+4, 2 say padc("Press ESC to quit", maxcol()+1-4)
diminfo()
return
function WVW_SIZE(nWinNum, hWnd, message, wParam, lParam)
* this function is called by gtwvw AFTER the size is changed
* WARNING: screen repainting is not performed completely by gtwvw at this point of call
local cScreen
local lNeedReset := .f., ;
maxsavedscrrow, maxsavedscrcol
if !s_lSizeReady
* program is not ready to handle window resizing
* (or this function is currently running)
return NIL
endif
if nWinNum<>0
* only care about Main Window
return NIL
endif
* avoid reentrance
s_lSizeReady := .f.
do case
case wParam == 2 //SIZE_MAXIMIZED
//alert("MAXIMIZE")
* reset is required only if we are changing size
lNeedReset := maxcol() <> wvw_maxmaxcol();
.or. maxrow() <> wvw_maxmaxrow()
if lNeedReset
maxsavedscrrow := min(min(s_nNormalMaxrow, wvw_maxmaxrow()),maxrow())
maxsavedscrcol := min(min(s_nNormalMaxcol, wvw_maxmaxcol()),maxcol())
cScreen := savescreen(0,0,maxsavedscrrow, maxsavedscrcol)
if setmode(wvw_maxmaxrow()+1, wvw_maxmaxcol()+1) //adjust maxrow() & maxcol()
restscreen(0,0,maxsavedscrrow, maxsavedscrcol, cScreen)
endif
diminfo() //updatescr()
endif
case wParam == 0 //SIZE_RESTORED
//alert("RESTORE")
lNeedReset := maxcol() <> s_nNormalMaxcol .or.;
maxrow() <> s_nNormalMaxrow
if lNeedReset
maxsavedscrrow := min(s_nNormalMaxrow, maxrow())
maxsavedscrcol := min(s_nNormalMaxcol, maxcol())
cScreen := savescreen(0,0,maxsavedscrrow, maxsavedscrcol)
if setmode(s_nNormalMaxrow+1,s_nNormalMaxcol+1)
restscreen(0,0,maxsavedscrrow, maxsavedscrcol, cScreen)
endif
diminfo() //updatescr()
endif
otherwise
* do nothing
endcase
* allow next call
s_lSizeReady := .t.
return NIL