/* * selectColor - select the color */ static void selectColor( WPI_POINT *pt, HWND hwnd ) { int i; WPI_PRES pres; HWND currentwnd; int top; int bottom; WPI_RECT wrect; currentwnd = _wpi_getdlgitem( hwnd, BK_CURRENT ); pres = _wpi_getpres( currentwnd ); _wpi_mapwindowpoints( hwnd, currentwnd, pt, 1 ); _wpi_torgbmode( pres ); for( i = 0; i < 16; i++ ) { top = availColor[i].box.top; bottom = availColor[i].box.bottom; top = _wpi_cvth_y( top, 2 * SQR_SIZE ); bottom = _wpi_cvth_y( bottom, 2 * SQR_SIZE ); _wpi_setintwrectvalues( &wrect, availColor[i].box.left, top, availColor[i].box.right, bottom ); if( _wpi_ptinrect( &wrect, *pt ) ) { screenColor.color = availColor[i].color; DisplayColorBox( pres, &screenColor ); inverseColor.color = GetInverseColor( screenColor.color ); DisplayColorBox( pres, &inverseColor ); break; } } _wpi_releasepres( currentwnd, pres ); } /* selectColor */
/* * GUIControlSetRedraw -- set the redraw flag for a given window control */ bool GUIControlSetRedraw( gui_window *wnd, gui_ctl_id id, bool redraw ) { HWND hwnd; hwnd = _wpi_getdlgitem( wnd->hwnd, id ); _wpi_setredraw( hwnd, ( redraw ) ? TRUE : FALSE ); return( true ); }
bool GUIClearText( gui_window *wnd, unsigned id ) { HWND control; control = _wpi_getdlgitem( wnd->hwnd, id ); if( control != (HWND)NULL ) { _wpi_setwindowtext( control, NULL ); } return( TRUE ); }
void GUIControlDirty( gui_window *wnd, gui_ctl_id id ) { HWND control; control = _wpi_getdlgitem( wnd->hwnd, id ); if( control != NULLHANDLE ) { //GUIInvalidatePaintHandles( wnd ); // not 100% sure this is required _wpi_invalidaterect( control, NULL, TRUE ); _wpi_updatewindow( control ); } }
bool GUIEnableControl( gui_window *wnd, unsigned id, bool enable ) { HWND control; control = _wpi_getdlgitem( wnd->hwnd, id ); if( control != (HWND)NULL ) { _wpi_enablewindow( control, enable ); return( TRUE ); } return( FALSE ); }
bool GetControlInfo( gui_window * wnd, unsigned id, HWND *hwnd, WPI_PRES *dc ) { if ( wnd && wnd->hwnd ) { *hwnd = _wpi_getdlgitem( wnd->hwnd, id ); if ( *hwnd != (HWND)NULL ) { *dc = _wpi_getpres( *hwnd ); return( *dc != NULLHANDLE ); } } return( false ); }
WPI_MRESULT GUISendDlgItemMessage( HWND parent, gui_ctl_id id, WPI_MSG msg, WPI_PARAM1 wparam, WPI_PARAM2 lparam ) { HWND hwnd; hwnd = _wpi_getdlgitem( parent, id ); if( hwnd != NULLHANDLE ) { return( _wpi_sendmessage( hwnd, msg, wparam, lparam ) ); } else { return( 0L ); } }
bool GUIIsControlEnabled( gui_window *wnd, unsigned id ) { HWND control; control = _wpi_getdlgitem( wnd->hwnd, id ); if( control != (HWND)NULL ) { if( _wpi_iswindowenabled( control ) ) { return( TRUE ); } } return( FALSE ); }
char *GUIGetText( gui_window *wnd, gui_ctl_id id ) { LONG length; char *text; gui_control_class control_class; HWND hwnd; gui_ctl_idx choice; if( !GUIGetControlClass( wnd, id, &control_class ) ) { return( NULL ); } switch( control_class ) { case GUI_LISTBOX : choice = GUIGetCurrSelect( wnd, id ); if( choice == -1 ) { return( NULL ); } return( GUIGetListItem( wnd, id, choice ) ); default : hwnd = _wpi_getdlgitem( wnd->hwnd, id ); if( hwnd == NULLHANDLE ) { return( NULL ); } length = _wpi_getwindowtextlength( hwnd ); if( length > 0 ) { text = (char *)GUIMemAlloc( length + 1 ); if( text != NULL ) { _wpi_getwindowtext( hwnd, (LPSTR)text, length + 1 ); switch( control_class ) { case GUI_PUSH_BUTTON: case GUI_DEFPUSH_BUTTON: case GUI_RADIO_BUTTON: case GUI_CHECK_BOX: case GUI_STATIC: case GUI_GROUPBOX: _wpi_menutext2win( text ); break; } } return( text ); } return( NULL ); } }
/* * displayColors - display the colors */ static void displayColors( HWND hwnd ) { short i; WPI_PRES pres; HWND currentwnd; inverseColor.color = GetInverseColor( screenColor.color ); currentwnd = _wpi_getdlgitem( hwnd, BK_CURRENT ); pres = _wpi_getpres( currentwnd ); _wpi_torgbmode( pres ); DisplayColorBox( pres, &screenColor ); DisplayColorBox( pres, &inverseColor ); for( i = 0; i < 16; i++ ) { DisplayColorBox( pres, &availColor[i] ); } _wpi_releasepres( currentwnd, pres ); } /* displayColors */