mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-18 22:26:30 +01:00
factor out updateScrollInfo so I can update scroller live once I get
super-small boards figured out.
This commit is contained in:
parent
bb7e827703
commit
5dca33c5ab
1 changed files with 30 additions and 16 deletions
|
@ -386,14 +386,34 @@ ceInitUtilFuncs( CEAppGlobals* globals )
|
||||||
|
|
||||||
#ifdef CEFEATURE_CANSCROLL
|
#ifdef CEFEATURE_CANSCROLL
|
||||||
# define SCROLL_SHRINK 1
|
# define SCROLL_SHRINK 1
|
||||||
|
|
||||||
|
static void
|
||||||
|
updateScrollInfo( HWND hwnd, XP_U16 nHidden )
|
||||||
|
{
|
||||||
|
SCROLLINFO sinfo;
|
||||||
|
|
||||||
|
XP_MEMSET( &sinfo, 0, sizeof(sinfo) );
|
||||||
|
sinfo.cbSize = sizeof(sinfo);
|
||||||
|
sinfo.fMask = SIF_RANGE | SIF_POS | SIF_PAGE;
|
||||||
|
sinfo.nPos = 0;
|
||||||
|
sinfo.nMin = 0;
|
||||||
|
sinfo.nMax = nHidden;
|
||||||
|
sinfo.nPage = 1;
|
||||||
|
|
||||||
|
(void)SetScrollInfo( hwnd, SB_CTL, &sinfo, TRUE );
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
showScroller( CEAppGlobals* globals, XP_U16 nHidden, XP_U16 x, XP_U16 y,
|
showScroller( CEAppGlobals* globals, XP_U16 nHidden, XP_U16 x, XP_U16 y,
|
||||||
XP_U16 width, XP_U16 height )
|
XP_U16 width, XP_U16 height )
|
||||||
{
|
{
|
||||||
|
if ( !!globals->scrollHandle ) {
|
||||||
|
DestroyWindow( globals->scrollHandle );
|
||||||
|
globals->scrollHandle = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if ( !globals->scrollHandle ) {
|
if ( !globals->scrollHandle ) {
|
||||||
HWND hwndSB;
|
HWND hwndSB;
|
||||||
SCROLLINFO sinfo;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
hwndSB = CreateWindow( TEXT("SCROLLBAR"), // Class name
|
hwndSB = CreateWindow( TEXT("SCROLLBAR"), // Class name
|
||||||
NULL, // Window text
|
NULL, // Window text
|
||||||
|
@ -406,16 +426,9 @@ showScroller( CEAppGlobals* globals, XP_U16 nHidden, XP_U16 x, XP_U16 y,
|
||||||
globals->hInst, // The instance handle
|
globals->hInst, // The instance handle
|
||||||
NULL ); // s'pposed to be NULL
|
NULL ); // s'pposed to be NULL
|
||||||
|
|
||||||
XP_MEMSET( &sinfo, 0, sizeof(sinfo) );
|
updateScrollInfo( hwndSB, nHidden );
|
||||||
sinfo.cbSize = sizeof(sinfo);
|
|
||||||
sinfo.fMask = SIF_RANGE | SIF_POS | SIF_PAGE;
|
|
||||||
sinfo.nPos = 0;
|
|
||||||
sinfo.nMin = 0;
|
|
||||||
sinfo.nMax = nHidden;
|
|
||||||
sinfo.nPage = 1;
|
|
||||||
ret = SetScrollInfo( hwndSB, SB_CTL, &sinfo, TRUE );
|
|
||||||
|
|
||||||
EnableWindow( hwndSB, TRUE ); /* tray hidden */
|
EnableWindow( hwndSB, nHidden > 0 );
|
||||||
|
|
||||||
globals->scrollHandle = hwndSB;
|
globals->scrollHandle = hwndSB;
|
||||||
}
|
}
|
||||||
|
@ -1321,11 +1334,11 @@ ceDoHistory( CEAppGlobals* globals )
|
||||||
} /* ceDoHistory */
|
} /* ceDoHistory */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
drawInsidePaint( HWND hWnd, CEAppGlobals* globals )
|
drawInsidePaint( CEAppGlobals* globals )
|
||||||
{
|
{
|
||||||
HDC hdc;
|
HDC hdc;
|
||||||
|
|
||||||
hdc = GetDC( hWnd );
|
hdc = GetDC( globals->hWnd );
|
||||||
if ( !hdc ) {
|
if ( !hdc ) {
|
||||||
logLastError( __FUNCTION__ );
|
logLastError( __FUNCTION__ );
|
||||||
} else {
|
} else {
|
||||||
|
@ -1965,7 +1978,8 @@ WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
RECTtoXPR( &rect, &rt );
|
RECTtoXPR( &rect, &rt );
|
||||||
board_invalRect( globals->game.board, &rect );
|
board_invalRect( globals->game.board, &rect );
|
||||||
|
|
||||||
drawInsidePaint( hWnd, globals );
|
XP_ASSERT( globals->hWnd == hWnd );
|
||||||
|
drawInsidePaint( globals );
|
||||||
}
|
}
|
||||||
if ( !ValidateRect( hWnd, &rt ) ) {
|
if ( !ValidateRect( hWnd, &rt ) ) {
|
||||||
logLastError( "WM_PAINT:ValidateRect" );
|
logLastError( "WM_PAINT:ValidateRect" );
|
||||||
|
@ -2514,7 +2528,7 @@ ce_util_trayHiddenChange( XW_UtilCtxt* uc, XW_TrayVisState newState )
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
drawInsidePaint( globals->hWnd, globals );
|
drawInsidePaint( globals );
|
||||||
} /* ce_util_trayHiddenChange */
|
} /* ce_util_trayHiddenChange */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -2531,7 +2545,7 @@ static void
|
||||||
ce_util_notifyGameOver( XW_UtilCtxt* uc )
|
ce_util_notifyGameOver( XW_UtilCtxt* uc )
|
||||||
{
|
{
|
||||||
CEAppGlobals* globals = (CEAppGlobals*)uc->closure;
|
CEAppGlobals* globals = (CEAppGlobals*)uc->closure;
|
||||||
drawInsidePaint( globals->hWnd, globals );
|
drawInsidePaint( globals );
|
||||||
ceDisplayFinalScores( globals );
|
ceDisplayFinalScores( globals );
|
||||||
} /* ce_util_notifyGameOver */
|
} /* ce_util_notifyGameOver */
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue