mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-03 23:04:08 +01:00
Draw color samples to look more like buttons including thicker border to indicate focus.
This commit is contained in:
parent
e6f5ab9d01
commit
073aa6716b
1 changed files with 24 additions and 3 deletions
|
@ -1,6 +1,6 @@
|
||||||
/* -*-mode: C; fill-column: 77; c-basic-offset: 4; -*- */
|
/* -*- fill-column: 77; c-basic-offset: 4; compile-command: "make TARGET_OS=wince DEBUG=TRUE" -*- */
|
||||||
/*
|
/*
|
||||||
* Copyright 2004-2007 by Eric House (xwords@eehouse.org). All rights reserved.
|
* Copyright 2004-2008 by Eric House (xwords@eehouse.org). All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
#include "ceclrsel.h"
|
#include "ceclrsel.h"
|
||||||
#include "ceutil.h"
|
#include "ceutil.h"
|
||||||
|
#include "cedebug.h"
|
||||||
#include "debhacks.h"
|
#include "debhacks.h"
|
||||||
|
|
||||||
#ifdef MY_COLOR_SEL
|
#ifdef MY_COLOR_SEL
|
||||||
|
@ -338,12 +339,29 @@ wrapChooseColor( ColorsDlgState* cState, HWND owner, XP_U16 button )
|
||||||
#endif
|
#endif
|
||||||
} /* wrapChooseColor */
|
} /* wrapChooseColor */
|
||||||
|
|
||||||
|
/* I'd prefer to use normal buttons, letting the OS draw them except for
|
||||||
|
* their background color, but MS docs don't seem to allow any way to do
|
||||||
|
* that. I'm either totally on my own drawing the button or they're all in
|
||||||
|
* the same color and so useless. So they're just rects with a black outer
|
||||||
|
* rect to show focus.
|
||||||
|
*/
|
||||||
static void
|
static void
|
||||||
ceDrawColorButton( ColorsDlgState* cState, DRAWITEMSTRUCT* dis )
|
ceDrawColorButton( ColorsDlgState* cState, DRAWITEMSTRUCT* dis )
|
||||||
{
|
{
|
||||||
HBRUSH brush = brushForButton( cState, dis->hwndItem );
|
HBRUSH brush = brushForButton( cState, dis->hwndItem );
|
||||||
XP_ASSERT( !!brush );
|
XP_ASSERT( !!brush );
|
||||||
FillRect( dis->hDC, &dis->rcItem, brush );
|
|
||||||
|
RECT r = dis->rcItem;
|
||||||
|
XP_Bool hasFocus = ((dis->itemAction & ODA_FOCUS) != 0)
|
||||||
|
&& ((dis->itemState & ODS_FOCUS) != 0);
|
||||||
|
|
||||||
|
Rectangle( dis->hDC, r.left, r.top, r.right, r.bottom );
|
||||||
|
InsetRect( &r, 1, 1 );
|
||||||
|
if ( hasFocus ) {
|
||||||
|
Rectangle( dis->hDC, r.left, r.top, r.right, r.bottom );
|
||||||
|
}
|
||||||
|
InsetRect( &r, 1, 1 );
|
||||||
|
FillRect( dis->hDC, &r, brush );
|
||||||
} /* ceDrawColorButton */
|
} /* ceDrawColorButton */
|
||||||
|
|
||||||
LRESULT CALLBACK
|
LRESULT CALLBACK
|
||||||
|
@ -372,6 +390,9 @@ ColorsDlg( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
|
||||||
cState->inited = XP_TRUE;
|
cState->inited = XP_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* XP_LOGF( "%s: event=%s (%d); wParam=0x%x; lParam=0x%lx", __func__, */
|
||||||
|
/* messageToStr(message), message, wParam, lParam ); */
|
||||||
|
|
||||||
switch (message) {
|
switch (message) {
|
||||||
|
|
||||||
case WM_DRAWITEM: /* passed when button has BS_OWNERDRAW style */
|
case WM_DRAWITEM: /* passed when button has BS_OWNERDRAW style */
|
||||||
|
|
Loading…
Reference in a new issue