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 ); } }
/* * SetIsSaved - set whether the given MDI child has been saved */ void SetIsSaved( HWND hwnd, BOOL fissaved ) { img_node *node; img_node *next_icon; char fname[_MAX_FNAME]; char dir[_MAX_DIR]; char ext[_MAX_EXT]; char drive[_MAX_DRIVE]; char title[_MAX_EXT + _MAX_FNAME + 2]; char *main_title; node = GetImageNode( hwnd ); if( node == NULL ) { return; } // We do not check whether or not the image needs to have its // title bars updated here because sometimes we will save images // that are not modified to different files. #if 0 if( fissaved == node->issaved ) { return; } #endif next_icon = node; while( next_icon != NULL ) { next_icon->issaved = fissaved; next_icon = next_icon->nexticon; } if( fissaved ) { _wpi_getwindowtext( _wpi_getframe( node->hwnd ), title, sizeof( title ) ); if( strnicmp( title, IEImageUntitled, strlen( IEImageUntitled ) ) == 0 && strnicmp( node->fname, IEImageUntitled, strlen( IEImageUntitled ) ) == 0 ) { return; } _splitpath( node->fname, drive, dir, fname, ext ); strcpy( title, strupr( fname ) ); strcat( title, strupr( ext ) ); _wpi_setwindowtext( _wpi_getframe( node->hwnd ), (LPSTR)title ); main_title = (char *)MemAlloc( strlen( IEAppTitle ) + strlen( title ) + 3 + 1 ); if( main_title != NULL ) { strcpy( main_title, IEAppTitle ); strcat( main_title, " - " ); strcat( main_title, title ); _wpi_setwindowtext( HMainWindow, main_title ); MemFree( main_title ); } } else { _wpi_getwindowtext( _wpi_getframe( node->hwnd ), title, sizeof( title ) ); if( strnicmp( title, IEImageUntitled, strlen( IEImageUntitled ) ) == 0 ) { return; } else if( title[strlen( title ) - 1] == '*' ) { return; } else { strcat( title, "*" ); _wpi_setwindowtext( _wpi_getframe( node->hwnd ), (LPSTR)title ); } } } /* SetIsSaved */
size_t GUIGetWindowText( gui_window *wnd, char *data, size_t max_length ) { return( _wpi_getwindowtext( GUIGetParentFrameHWND( wnd ), data, max_length ) ); }