📄 wdesdlg.c
字号:
}
Bool WdeOpenSelectedDialog ( WdeResInfo *res_info, WdeResDlgItem *ditem,
Bool make_current )
{
Bool from_id;
if ( !res_info || !ditem ) {
return ( FALSE );
}
if ( ditem->object ) {
if ( make_current ) {
MakeObjectCurrent ( ditem->object );
WdeHandleGotoCurrentObject();
}
return ( TRUE );
}
if ( ( !ditem->rnode || !ditem->lnode ) &&
( !ditem->dialog_info || !ditem->dialog_name ) ) {
return ( FALSE );
}
if ( !ditem->dialog_info ) {
ditem->dialog_info = WdeLoadDialogFromRes ( res_info, ditem->lnode, ditem->is32bit );
ditem->modified = FALSE;
}
if( !ditem->dialog_name ) {
ditem->dialog_name = WdeCopyWResID( &ditem->rnode->Info.ResName );
if( !ditem->dialog_name ) {
return( FALSE );
}
}
if( !WdeOpenDialogFromResInfo ( res_info, ditem ) ) {
WdeDisplayErrorMsg( WDE_DIALOGNOTOPENED );
return( FALSE );
}
if( ditem->object != NULL ) {
from_id = TRUE;
Forward( ditem->object, RESOLVE_HELPSYMBOL, NULL, &from_id ); /* JPK */
Forward( ditem->object, RESOLVE_SYMBOL, NULL, &from_id );
}
if( make_current ) {
MakeObjectCurrent( ditem->object );
WdeHandleGotoCurrentObject();
}
return( TRUE );
}
Bool WdeOpenDialogFromResInfo ( WdeResInfo *res_info, WdeResDlgItem *ditem )
{
Bool old;
Bool show;
old = ditem->modified;
if ( res_info && ditem && ditem->dialog_info ) {
ditem->object = WdeCreateDialogFromRes ( res_info, ditem );
if ( !ditem->object ) {
return ( FALSE );
}
if ( !WdeAddControlsToDialog ( res_info, ditem->object,
ditem->dialog_info ) ) {
Destroy ( ditem->object, FALSE );
ditem->object = NULL;
return ( FALSE );
}
show = TRUE;
Forward ( ditem->object, SHOW_WIN, &show, NULL );
ditem->modified = old;
return ( TRUE );
}
return ( FALSE );
}
Bool WdeAddControlsToDialog ( WdeResInfo *res_info, OBJPTR dialog,
WdeDialogBoxInfo *info )
{
WdeDialogBoxControl *control;
LIST *clist;
HWND dialog_window;
POINT origin;
if (!Forward ( dialog, GET_WINDOW_HANDLE, &dialog_window, NULL)) {
WdeWriteTrail("WdeAddControlsToDialog: GET_WINDOW_HANDLE failed!");
return ( FALSE );
}
GetOffset ( &origin );
for ( clist = info->control_list; clist; clist = ListNext(clist) ) {
control = (WdeDialogBoxControl *) ListElement(clist);
if ( !WdeAddControlToDialog ( res_info, dialog, control,
&origin, dialog_window ) ) {
WdeWriteTrail("WdeAddControlsToDialog: add control failed!");
}
}
return ( TRUE );
}
Bool WdeAddControlToDialog ( WdeResInfo *res_info, OBJPTR dialog,
WdeDialogBoxControl *control,
POINT *origin, HWND dialog_win )
{
OBJPTR new;
OBJ_ID object_id;
RECT control_rect;
Bool clear_int;
control_rect.left = GETCTL_SIZEX(control);
control_rect.top = GETCTL_SIZEY(control);
control_rect.right = control_rect.left + GETCTL_SIZEW(control);
control_rect.bottom = control_rect.top + GETCTL_SIZEH(control);
MapDialogRect ( dialog_win, &control_rect );
WdeMapWindowRect ( dialog_win, res_info->edit_win, &control_rect );
control_rect.left += origin->x;
control_rect.top += origin->y;
control_rect.right += origin->x;
control_rect.bottom += origin->y;
object_id = WdeGetOBJIDFromControl( control );
if( object_id == 0 ) {
new = Create (CUSTCNTL1_OBJ, dialog, &control_rect, (OBJPTR)control);
if ( new == NULL ) {
WdeWriteTrail("WdeAddControlToDialog: changing to text!");
object_id = TEXT_OBJ;
SETCTL_STYLE( control, SS_LEFT | WS_BORDER | WS_VISIBLE | WS_TABSTOP | WS_GROUP );
if( GETCTL_CLASSID(control) ) {
WdeMemFree( GETCTL_CLASSID(control) );
}
SETCTL_CLASSID( control, ResNumToControlClass(CLASS_STATIC) );
new = Create (object_id, dialog, &control_rect, (OBJPTR)control);
}
} else {
new = Create ( object_id, dialog, &control_rect, (OBJPTR) control );
}
if ( new == NULL ) {
WdeWriteTrail("WdeAddControlToDialog: Create failed!");
return ( FALSE );
}
if ( !Register ( new ) ) {
WdeWriteTrail("WdeAddControlToDialog: Register failed!");
Destroy ( new, FALSE );
return ( FALSE );
}
if ( Forward ( new, IS_OBJECT_CLEAR, &clear_int, NULL ) && clear_int ) {
Forward ( new, ON_TOP, NULL, NULL );
}
return ( TRUE );
}
OBJ_ID WdeGetOBJIDFromClassNum ( uint_8 class, uint_32 style )
{
OBJ_ID id;
id = 0;
switch (class) {
case CLASS_BUTTON:
style = style & 0x0000000f;
switch ( style ) {
case BS_PUSHBUTTON:
case BS_DEFPUSHBUTTON:
case BS_USERBUTTON:
case BS_OWNERDRAW:
id = PBUTTON_OBJ;
break;
case BS_CHECKBOX:
case BS_AUTOCHECKBOX:
case BS_3STATE:
case BS_AUTO3STATE:
id = CBUTTON_OBJ;
break;
case BS_RADIOBUTTON:
case BS_AUTORADIOBUTTON:
id = RBUTTON_OBJ;
break;
case BS_GROUPBOX:
id = GBUTTON_OBJ;
break;
default:
WdeWriteTrail("WdeGetOBJIDFromClassNum: bad button!");
break;
}
break;
case CLASS_EDIT:
id = EDIT_OBJ;
break;
case CLASS_STATIC:
style = style & 0x0000000f;
switch ( style ) {
case SS_LEFT:
case SS_LEFTNOWORDWRAP:
case SS_CENTER:
case SS_RIGHT:
case SS_SIMPLE:
id = TEXT_OBJ;
break;
case SS_BLACKRECT:
case SS_GRAYRECT:
case SS_WHITERECT:
case SS_BLACKFRAME:
case SS_GRAYFRAME:
case SS_WHITEFRAME:
id = FRAME_OBJ;
break;
case SS_ICON:
#if __NT__XX
case SS_BITMAP:
case SS_ENHMETAFILE:
#endif
id = ICON_OBJ;
break;
default:
WdeWriteTrail("WdeGetOBJIDFromClassNum: bad static!");
break;
}
break;
case CLASS_LISTBOX:
id = LISTBOX_OBJ;
break;
case CLASS_SCROLLBAR:
style = style & 0x00000009;
if ( style == SBS_HORZ ) {
id = HSCROLL_OBJ;
} else if ( style == SBS_VERT ) {
id = VSCROLL_OBJ;
} else if ( style == SBS_SIZEBOX ) {
id = SIZEBOX_OBJ;
} else {
WdeWriteTrail("WdeGetOBJIDFromClassNum: bad scrollbar!");
}
break;
case CLASS_COMBOBOX:
id = COMBOBOX_OBJ;
break;
default:
WdeWriteTrail("WdeGetOBJIDFromClassNum: Could not figure out control class!");
break;
}
return ( id );
}
OBJ_ID WdeGetOBJIDFromControl ( WdeDialogBoxControl *control )
{
ControlClass *class;
uint_8 class_id;
OBJ_ID id;
class = GETCTL_CLASSID( control );
id = 0;
if (class->Class & 0x80) {
id = WdeGetOBJIDFromClassNum( class->Class, GETCTL_STYLE(control) );
} else {
id = WdeGetCommonControlClassFromClassName( class->ClassName );
if( id == 0 ) {
class_id = WdeGetClassFromClassName( class->ClassName );
/* assume some sort of custom class if class_id is 0 */
if ( class_id != 0 ) {
id = WdeGetOBJIDFromClassNum( class_id, GETCTL_STYLE(control) );
}
}
}
return( id );
}
BOOL WINEXPORT WdeSelectDialogProc ( HWND hDlg, UINT message,
WPARAM wParam, volatile LPARAM lParam )
{
WdeDialogSelectInfo *si;
BOOL ret;
ret = FALSE;
switch (message) {
case WM_SYSCOLORCHANGE:
WdeCtl3dColorChange ();
break;
case WM_INITDIALOG:
si = (WdeDialogSelectInfo *) lParam;
SetWindowLong ( hDlg, DWL_USER, (LONG) si );
if ( !WdeSetSelectInfo ( hDlg, si ) ) {
EndDialog ( hDlg, FALSE );
}
ret = TRUE;
break;
case WM_COMMAND:
si = (WdeDialogSelectInfo *) GetWindowLong ( hDlg, DWL_USER );
switch ( LOWORD(wParam) ) {
case IDB_HELP:
WdeHelpRoutine();
break;
case IDB_SELECT_LISTBOX:
if ( GET_WM_COMMAND_CMD(wParam,lParam) != LBN_DBLCLK ) {
break;
}
case IDOK:
if ( !WdeGetSelectInfo ( hDlg, si ) ) {
EndDialog ( hDlg, FALSE );
}
EndDialog ( hDlg, TRUE );
ret = TRUE;
break;
case IDCANCEL:
EndDialog ( hDlg, FALSE );
ret = TRUE;
break;
}
}
return ( ret );
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -