VOID lboxMouBtn1dwn(PELBOX pelb, PMSEMSG pmmsg) { INT i, idx; // trova colonna for (i = 0; i < pelb->ccol; ++i) { if (pmmsg->x >= pelb->pcol[i].rcl.xLeft && pmmsg->x < pelb->pcol[i].rcl.xRight) { // trova indice item idx = (SHORT)pelb->lbxwprc(pelb->hlbx, LM_QUERYTOPINDEX, MPVOID, MPVOID) + (pelb->rcltopitem.yTop - pmmsg->y) / pelb->cyitem; // notifica owner controllo (se non si clicca su un'area vuota) if (idx < pelb->citems) { if ((pelb->fl & ELBCS_ITEMCHECKBOXED) && ((pmmsg->x - pelb->pcol[i].rcl.xLeft) < pelb->cyitem)) WinSendMsg(WinQueryWindow(pelb->hwnd, QW_OWNER), WM_CONTROL, MPFROM2SHORT((USHORT)pelb->id, ELBXN_CHECKED), MPFROM2SHORT(idx, i)); else WinSendMsg(WinQueryWindow(pelb->hwnd, QW_OWNER), WM_CONTROL, MPFROM2SHORT((USHORT)pelb->id, ELBXN_SELECT), MPFROM2SHORT(idx, i)); } else { WinAlarm(HWND_DESKTOP, WA_ERROR); } // end if break; } // end if } /* endfor */ }
MRESULT InitMainWindow(HWND hwnd, /* handle to the main client window */ MPARAM mp1, /* first parameter of WM_CREATE message */ MPARAM mp2) /* second parameter of WM_CREATE message */ { FONTMETRICS fm; HPS hps; hps = WinGetPS (hwnd) ; GpiQueryFontMetrics (hps, (LONG) sizeof fm, &fm) ; cxChar = fm.lAveCharWidth ; cxCaps = fm.lEmInc ; cyChar = fm.lMaxBaselineExt ; cyDesc = fm.lMaxDescender ; WinReleasePS (hps) ; cxTextTotal = MESSAGE_LEN * cxChar ; hwndHscroll = WinWindowFromID ( WinQueryWindow (hwnd, QW_PARENT), FID_HORZSCROLL) ; hwndVscroll = WinWindowFromID ( WinQueryWindow (hwnd, QW_PARENT), FID_VERTSCROLL) ; return (MRFROMLONG(0)); }
/*------------------------------------------------------------------------*/ void PaperSetSize(WINDOWINFO *pwi,USHORT usWidth, USHORT usHeight) { HWND hwndframe; HWND hParent; POINTL ptl; RECTL rcl; LONG x,y,cx,cy; hwndframe = WinQueryWindow(pwi->hwndClient,QW_PARENT); hParent = WinQueryWindow(hwndframe,QW_PARENT); /* canvas */ WinQueryWindowRect(hParent,&rcl); view.iZoom = 0; pwi->usFormWidth = usWidth; pwi->usFormHeight = usHeight; pwi->usWidth = usWidth; pwi->usHeight = usHeight; ptl.x = usWidth; ptl.y = usHeight; GpiConvert(pwi->hps,CVTC_DEFAULTPAGE,CVTC_DEVICE,1,(POINTL *)&ptl); cx = ptl.x; cy = ptl.y; pwi->cxClient = cx; pwi->cyClient = cy; pwi->cxClnt = cx; pwi->cyClnt = cy; /* ** If paperwidth is smaller than the window wherein it is drawn ** than try to center it in the x-direction. ** Else simply begin at zero. */ if (cx < rcl.xRight) { x = (rcl.xRight - cx)/2; } else x = 0; if (cy < rcl.yTop) { y = (rcl.yTop - cy)/2; } else { y = rcl.yTop - cy; } view.sVscrollPos = 0; view.sHscrollPos = 0; CanvScrollBar(pwi,FALSE); WinSetWindowPos(hwndframe,(HWND)0,x,y,cx,cy,SWP_MOVE | SWP_SIZE); return; }
MRESULT _System DrvMountDrivesDlg( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) { if (msg == WM_TIMER && mp1 == (MP)CAM_LVMTMR) { HEV hev = WinQueryWindowULong( hwnd, QWL_USER); if (!WinWaitEventSem( hev, 0)) WinSendMsg( hwnd, WM_COMMAND, (MP)CAM_LVMTMR, 0); return (0); } if (msg == WM_COMMAND || msg == WM_SYSCOMMAND) { ULONG ulChk; if (!WinStopTimer( 0, hwnd, CAM_LVMTMR)) printf( "DrvMountDrivesDlg - WinStopTimer\n"); ulChk = (ULONG)WinSendDlgItemMsg( hwnd, IDC_AUTOMOUNT, BM_QUERYCHECK, 0, 0); DrvSetUseLvm( WinQueryWindow( hwnd, QW_OWNER), ulChk); WindowClosed( WinQueryWindowUShort( hwnd, QWS_ID)); WinDismissDlg( hwnd, (mp1 == (MP)CAM_LVMTMR)); return (0); } if (msg == WM_INITDLG) { HEV hev = (HEV)mp2; WinSetWindowULong( hwnd, QWL_USER, hev); LoadDlgStrings( hwnd, nlsMountDlg); WinSendDlgItemMsg( hwnd, IDC_AUTOMOUNT, BM_SETCHECK, (MP)(CAMDRV_IS_NOLVM ? 0 : 1), 0); ShowDialog( hwnd, 0); if (!WinWaitEventSem( hev, 0)) { WindowClosed( WinQueryWindowUShort( hwnd, QWS_ID)); WinDismissDlg( hwnd, TRUE); } else if (!WinStartTimer( 0, hwnd, CAM_LVMTMR, 250)) printf( "DrvMountDrivesDlg - WinStartTimer\n"); return (0); } if (msg == WM_FOCUSCHANGE) { if (SHORT1FROMMP(mp2) && !WinIsWindowEnabled( hwnd)) { WinPostMsg( WinQueryWindow( hwnd, QW_OWNER), CAMMSG_FOCUSCHANGE, 0, 0); return (0); } } return (WinDefDlgProc( hwnd, msg, mp1, mp2)); }
BOOL lboxChar(PELBOX pelb, PCHRMSG pchmsg) { ULONG fs = pchmsg->fs & 0xfff; // se cambia cursore notifica owner indicando in mp1 l'ID dell'item con // il cursore if (!((pchmsg->fs & KC_ALT) || (pchmsg->fs & KC_KEYUP)) && (pchmsg->fs & KC_VIRTUALKEY) && ((pchmsg->vkey == VK_PAGEUP) || (pchmsg->vkey == VK_PAGEDOWN) || (pchmsg->vkey == VK_END) || (pchmsg->vkey == VK_HOME) || (pchmsg->vkey == VK_UP) || (pchmsg->vkey == VK_DOWN))) { pelb->lbxwprc(pelb->hlbx, WM_CHAR, MPFROMSH2CH(pchmsg->fs, pchmsg->cRepeat, pchmsg->scancode), MPFROM2SHORT(pchmsg->chr, pchmsg->vkey)); WinSendMsg(WinQueryWindow(pelb->hwnd, QW_OWNER), WM_CONTROL, MPFROM2SHORT((USHORT)pelb->id, ELBXN_CURSORMOVE), (MPARAM)(pelb->lbxwprc(pelb->hlbx, LM_QUERYSELECTION, (MPARAM)LIT_CURSOR, MPVOID))); return TRUE; } /* endif */ // ignora caratteri selezione item if (pchmsg->vkey == VK_SPACE || pchmsg->vkey == VK_NEWLINE || pchmsg->vkey == VK_ENTER || pchmsg->fs & KC_CTRL) return TRUE; // considera solo caratteri: if (fs == 5 || fs == 0xd) { INT i; SHORT idx; for (i = 0; i < pelb->ccol; ++i) { if (pchmsg->chr == pelb->pcol[i].mnemo && (idx = (SHORT)pelb->lbxwprc(pelb->hlbx, LM_QUERYSELECTION, (MPARAM)LIT_CURSOR, MPVOID)) >= 0) { WinSendMsg(WinQueryWindow(pelb->hwnd, QW_OWNER), WM_CONTROL, MPFROM2SHORT((USHORT)pelb->id, (pelb->fl & ELBCS_ITEMCHECKBOXED? ELBXN_CHECKED: ELBXN_SELECT)), MPFROM2SHORT(idx, i)); // cambia stato selezione item per forzarne aggiornamento i = (SHORT)pelb->lbxwprc(pelb->hlbx, LM_QUERYSELECTION, (MPARAM)(idx - 1), MPVOID); pelb->lbxwprc(pelb->hlbx, LM_SELECTITEM, (MPARAM)idx, (MPARAM)(i != idx || i < 0)); break; } /* endif */ } /* endfor */ return TRUE; } /* endif */ // gli altri caratteri di scrolling sono regolarmente processati return FALSE; }
// Window - окно. LONG WindowTypes_WindowType( HWND Window ) { // Если окно не задано - возврат. if( Window == NULLHANDLE ) return WT_UNKNOWN; // Если это окно рабочего стола - возврат. if( IsDesktopWindow( Window ) ) return WT_UNKNOWN; // Это может быть окно рамки. if( IsFrameWindow( Window ) ) return WT_BORDER; // Окна заголовка, картинки и меню могут иметь различные имена. // У них есть родительское окно - рабочий стол или окно рамки. HWND Parent_window = WinQueryWindow( Window, QW_PARENT ); if( IsFrameWindow( Parent_window ) ) { if( WinWindowFromID( Parent_window, FID_SYSMENU ) == Window ) return WT_SYSMENU; if( WinWindowFromID( Parent_window, FID_TITLEBAR ) == Window ) return WT_TITLEBAR; if( WinWindowFromID( Parent_window, FID_MINMAX ) == Window ) return WT_MINMAX; if( WinWindowFromID( Parent_window, FID_MENU ) == Window ) return WT_MENU; if( WinWindowFromID( Parent_window, FID_CLIENT ) == Window ) return WT_CLIENT; } // Возврат. return WT_UNKNOWN; }
VOID clbControlEntryMsg(PCLBOX pclb, ULONG nmsg) { MPARAM mp = (MPARAM)pclb->hwnd; if (pclb->fl & CLBXS_DROPDOWN) { // dropdown box switch (nmsg) { case CBN_EFCHANGE: nmsg = clbEnableAdd(pclb); break; // case CBN_EFSCROLL: nmsg = CLBXN_ENEFSCROLL; break; case CBN_MEMERROR: nmsg = CLBXN_ENMEMERR; break; // case CBN_LBSELECT: nmsg = CLBXN_ENSELECT; break; // case CBN_LBSCROLL: nmsg = CLBXN_ENSCROLL; break; // case CBN_SHOWLIST: nmsg = CLBXN_ENSHOW; break; case CBN_ENTER: nmsg = CLBXN_ENENTER; mp = (MPARAM)WinSendMsg(pclb->hentry, LM_QUERYSELECTION, (MPARAM)LIT_CURSOR, MPVOID); break; default: nmsg = 0; } /* endswitch */ } else { // entryfield switch (nmsg) { case EN_CHANGE: nmsg = clbEnableAdd(pclb); break; // case EN_SETFOCUS: nmsg = CLBXN_ENSETFCS; break; // case EN_KILLFOCUS: nmsg = CLBXN_ENLOSEFCS; break; // case EN_SCROLL: nmsg = CLBXN_ENEFSCROLL; break; case EN_MEMERROR: nmsg = CLBXN_ENMEMERR; break; // case EN_OVERFLOW: nmsg = CLBXN_ENOVERFLW; break; // case EN_INSERTMODETOGGLE: nmsg = CLBXN_ENINSTGL; break; default: nmsg = 0; } /* endswitch */ } /* endif */ if (nmsg) WinSendMsg(WinQueryWindow(pclb->hwnd, QW_OWNER), WM_CONTROL, MPFROM2SHORT(pclb->id, nmsg), mp); }
MRESULT EXPENTRY wpCTTrack(HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) { switch(msg) { case WM_CHAR: { SHORT fsflags = SHORT1FROMMP(mp1); SHORT usvkey = SHORT2FROMMP(mp2); if(fsflags & KC_KEYUP) break; if((fsflags & KC_SHIFT) && (usvkey == VK_F10)) { RECORDCORE *record; record = searchRecords(hwnd, 0, (RECORDCORE *) CMA_FIRST, CRA_SELECTED); processPopUp(WinQueryWindow(hwnd, QW_PARENT), WinQueryWindowUShort(hwnd,QWS_ID), record, PUM_CDRECORD, PUM_CDCONTAINER, &sourceEmphasisInfo); WinSendMsg(sourceEmphasisInfo.PUMHwnd, MM_SETITEMATTR, MPFROM2SHORT(IDM_MINIICONS, FALSE), MPFROM2SHORT(MIA_CHECKED, miniIcons ? MIA_CHECKED : 0)); return 0; } else if((fsflags & KC_SHIFT) && (usvkey == VK_F9)) { CNREDITDATA editdata; CNRINFO cnrInfo; WinSendMsg(hwnd,CM_QUERYCNRINFO, MPFROMP(&cnrInfo),MPFROMLONG(sizeof(cnrInfo))); editdata.cb = sizeof(editdata); editdata.hwndCnr = hwnd; editdata.pRecord = searchRecords(hwnd, 0, (RECORDCORE *) CMA_FIRST, CRA_CURSORED); editdata.ppszText = NULL; editdata.cbText = 0; if(cnrInfo.flWindowAttr & CV_DETAIL) { editdata.pFieldInfo = (FIELDINFO*) WinSendMsg(hwnd, CM_QUERYDETAILFIELDINFO, MPFROMP(NULL), MPFROMSHORT(CMA_FIRST)); editdata.pFieldInfo = (FIELDINFO*) WinSendMsg(hwnd, CM_QUERYDETAILFIELDINFO, MPFROMP(editdata.pFieldInfo), MPFROMSHORT(CMA_NEXT)); editdata.id = CID_LEFTDVWND; } else { editdata.pFieldInfo = NULL; editdata.id = WinQueryWindowUShort(hwnd,QWS_ID); } WinSendMsg(hwnd,CM_OPENEDIT,MPFROMP(&editdata),0); return 0; } break; } } return wpCT( hwnd, msg, mp1, mp2 ); }
MRESULT EXPENTRY newlboxproc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) { PELBOX pelb = (PELBOX)stGetData(WinQueryWindow(hwnd, QW_PARENT)); switch (msg) { case WM_BUTTON1DOWN: lboxMouBtn1dwn(pelb, MOUSEMSG(&msg)); WinPostMsg(hwnd, WM_BUTTON1UP, mp1, mp2); break; case WM_CHAR: if (lboxChar(pelb, CHARMSG(&msg))) return (MRESULT)TRUE; break; case WM_BEGINDRAG: if (lboxBeginDrag(pelb, MOUSEMSG(&msg))) return (MRESULT)TRUE; break; case WM_MOUSEMOVE: if (lboxMouseMove(pelb, MOUSEMSG(&msg))) return (MRESULT)TRUE; break; case WM_ENDDRAG: if (lboxEndDrag(pelb, MOUSEMSG(&msg))) return (MRESULT)TRUE; break; // implementa autoscrolling case WM_TIMER: if (lboxTimer(pelb, (ULONG)mp1)) return (MRESULT)FALSE; break; } /* endswitch */ return pelb->lbxwprc(hwnd, msg, mp1, mp2); }
/*------------------------------------------------------------------------*/ static void positionWindowInViewPort(WINDOWINFO *pwi ) { HWND hFrame = WinQueryWindow(pwi->hwndClient,QW_PARENT); LONG x,y; x = y = 0; if (pwi->cxClient < view.cxCanvas) { x = (view.cxCanvas - pwi->cxClient)/2; x -= view.sHscrollPos; } else { x -= view.sHscrollPos; } if (pwi->cyClient < view.cyCanvas) { y = (view.cyCanvas - pwi->cyClient)/2; y += view.sVscrollPos; } else { y = view.cyCanvas - pwi->cyClient; y += view.sVscrollPos; } WinSetWindowPos(hFrame,(HWND)0,x,y,0,0,SWP_MOVE); }
void SetWindowTitle( HWND hwndWnd ) { CHAR szWinTitle[MAX_STRING_BYTES]; CHAR szUntitled[MAX_STRING_BYTES]; /* * Use the application title as the first part of the window title */ strncpy( szWinTitle, szAppName, MAX_STRING_BYTES ); /* * If there is an allocated data buffer, concatenate a dash ( '-' ) and * either the name of the file or the string "(untitled)" to the window * title string. */ if ( pbFileBuffer != NULL ) { strncat( szWinTitle, " - ", MAX_STRING_BYTES ); if ( *szFileName == '\0' ) { WinLoadString( habAnchor, NULLHANDLE, IDS_UNTITLED, sizeof( szUntitled ), szUntitled ); strncat( szWinTitle, szUntitled, MAX_STRING_BYTES ); } else { strncat( szWinTitle, szFileName, MAX_STRING_BYTES ); } } WinSetWindowText( WinQueryWindow( hwndWnd, QW_PARENT), szWinTitle ); }
void notify( HWND hwnd, USHORT notifyCode, MPARAM mp2 ) { HWND hwndOwner = WinQueryWindow( hwnd, QW_OWNER ); HWND usId = WinQueryWindowUShort( hwnd, QWS_ID ); WinPostMsg( hwndOwner, WM_CONTROL, MPFROM2SHORT( usId, notifyCode ), mp2 ); }
/*--------------------------------------------------------------------------- AboutWndProc ---------------------------------------------------------------------------*/ MRESULT EXPENTRY AboutWndProc( HWND wnd, ULONG msg, MPARAM mp1, MPARAM mp2 ) { WNDATTR *wndattr; MRESULT MRes; HWND frame, client; char number[10]; switch (msg) { case WM_INITDLG: PositionDialog( wnd ); frame = WinQueryWindow( wnd, QW_OWNER ); client = WinWindowFromID( frame, FID_CLIENT ); wndattr = (WNDATTR*)WinQueryWindowPtr( client, QWL_USER ); ltoa( LPListLines( wndattr->list ), number, 10 ); WinSetDlgItemText( wnd, ID_LINES, number ); ltoa( LPListMarkedLines( wndattr->list ), number, 10 ); WinSetDlgItemText( wnd, ID_MARKED, number ); ltoa( LPListMaxLines( wndattr->list ), number, 10 ); WinSetDlgItemText( wnd, ID_MAXLINES, number ); ltoa( LPListMaxLen( wndattr->list ), number, 10 ); WinSetDlgItemText( wnd, ID_MAXLENGTH, number ); break; default: MRes = WinDefDlgProc( wnd, msg, mp1, mp2 ); break; } return MRes; }
/* * _PositionScrollThumb */ void _PositionScrollThumb( LPWDATA w ) { DWORD c; WORD curr, end; DWORD ll; c = w->TopLineNumber; ll = _GetLastLineNumber( w ); if( ll > MAXLNE ) { end = MAXLNE; curr = (WORD)(((DWORD) c * MAXLNE)/ll); } else { end = ll; curr = c; } #if defined( __OS2__ ) if( end > w->height ) { end -= w->height; } WinSendMsg( WinWindowFromID( WinQueryWindow( w->hwnd, QW_PARENT ), FID_VERTSCROLL ), SBM_SETSCROLLBAR, MPFROMSHORT( curr ), MPFROM2SHORT( 1, end ) ); #else SetScrollRange( w->hwnd, SB_VERT, 1, end, FALSE ); SetScrollPos( w->hwnd, SB_VERT, curr, TRUE ); #endif } /* _PositionScrollThumb */
int icqskin_autoSize(HWND hwnd, short x, short y, short cx, short cy, short baseCy) { RECTL rcl; WinQueryWindowRect( WinQueryWindow(hwnd, QW_OWNER), &rcl); if(cx < 0) cx = rcl.xRight + cx; if( ((USHORT) cy) == 0xFFFF) cy = baseCy; else if(cy < 0) cy = rcl.yTop + cy; if(x < 0) x = (rcl.xRight + x) - cx; if(y < 0) y = (rcl.yTop + y) - cy; if( cx != (rcl.xLeft - rcl.xRight) || cy != (rcl.yTop - rcl.yBottom)) { WinSetWindowPos(hwnd, 0, x, y, cx, cy, SWP_SIZE|SWP_MOVE); WinInvalidateRect(hwnd,NULL,FALSE); return TRUE; } return FALSE; }
// For frame windows, 'Show' is equivalent to 'Show & Activate' nsresult nsFrameWindow::Show( PRBool bState) { if( mWnd) { ULONG ulFlags; if( bState) { ULONG ulStyle = WinQueryWindowULong( GetMainWindow(), QWL_STYLE); ulFlags = SWP_SHOW; /* Don't activate the window unless the parent is visible */ if (WinIsWindowVisible(WinQueryWindow(GetMainWindow(), QW_PARENT))) ulFlags |= SWP_ACTIVATE; if (!( ulStyle & WS_VISIBLE)) { PRInt32 sizeMode; GetSizeMode( &sizeMode); if ( sizeMode == nsSizeMode_Maximized) { ulFlags |= SWP_MAXIMIZE; } else if ( sizeMode == nsSizeMode_Minimized) { ulFlags |= SWP_MINIMIZE; } else { ulFlags |= SWP_RESTORE; } } if( ulStyle & WS_MINIMIZED) ulFlags |= (SWP_RESTORE | SWP_MAXIMIZE); } else ulFlags = SWP_HIDE | SWP_DEACTIVATE; WinSetWindowPos( GetMainWindow(), NULLHANDLE, 0L, 0L, 0L, 0L, ulFlags); SetWindowListVisibility( bState); } return NS_OK; }
void AddToPlaylist(HWND hWnd, PSZ pszFilespec) { HDIR hFind = HDIR_SYSTEM; FILEFINDBUF3 FindBuffer = {0}; ULONG ulResultBufLen = sizeof(FILEFINDBUF3); ULONG ulFindCount = 1; APIRET rc = NO_ERROR; ULONG flAtttribute = FILE_ARCHIVED | FILE_SYSTEM | FILE_HIDDEN | FILE_READONLY; PSZ pszFilepath = new char[CCHMAXPATH]; PSZ pTemp = NULL; MakePathFromFilepath(pszFilepath, pszFilespec); pTemp = pszFilepath + strlen(pszFilepath); rc = DosFindFirst(pszFilespec, &hFind, flAtttribute, &FindBuffer, ulResultBufLen, &ulFindCount, FIL_STANDARD); while(rc == NO_ERROR) { strcpy(pTemp, FindBuffer.achName); if(IsValidFile(pszFilepath)) { plAddEntry(hWnd, pszFilepath); WinSetWindowText(WinQueryWindow(hWnd, QW_PARENT), pTemp); } ulFindCount = 1; rc = DosFindNext(hFind, &FindBuffer, ulResultBufLen, &ulFindCount); } DosFindClose(hFind); delete pszFilepath; }
MRESULT mainhewmInit(HWND hwnd,MPARAM mp1,MPARAM mp2) { HWND hwndFrame = WinQueryWindow(hwnd,QW_PARENT); // printf("HEWM_INIT\n"); if (bootopen) han_type = HEFileOpenWithAutoHanCode(hwnd,bootopen,TRUE); HESetTitlebarText(hwnd); WinPostMsg(hwndHIA,HIAM_SETKBDTYPE,MPFROMLONG(kbd_type),0L); WinPostMsg(hwndHMLE,HMLM_SETTEXTFORMAT,MPFROMLONG(eol_type),0L); WinPostMsg(hwndStatbar,STATBAR_USERM_SETEOLTYPE,MPFROMLONG(eol_type),0L); WinPostMsg(hwndStatbar,STATBAR_USERM_SETHANTYPE,MPFROMLONG(han_type),0L); if (readonly) { WinEnableMenuItem(WinWindowFromID(hwndFrame,FID_MENU),IDM_IMPORT,FALSE ); WinEnableMenuItem(WinWindowFromID(hwndFrame,FID_MENU),IDM_SAVE,FALSE); //WinEnableMenuItem(WinWindowFromID(hwndFrame,FID_MENU),IDM_SAVEAS,FALSE); WinPostMsg(hwndToolbar,TOOLBAR_USERM_SHOWITEM,MPFROMLONG(TOOLBAR_SAVE),FALSE); WinPostMsg(hwndToolbar,TOOLBAR_USERM_SHOWITEM,MPFROMLONG(TOOLBAR_CUT),FALSE); WinPostMsg(hwndToolbar,TOOLBAR_USERM_SHOWITEM,MPFROMLONG(TOOLBAR_PASTE),FALSE); WinPostMsg(hwndToolbar,TOOLBAR_USERM_SHOWITEM,MPFROMLONG(TOOLBAR_CLEAR),FALSE); WinPostMsg(hwndToolbar,TOOLBAR_USERM_UPDATE,0,0); } WinEnableMenuItem(WinWindowFromID(hwndFrame,FID_MENU),IDM_PROPERTIES,FALSE); WinSetFocus(HWND_DESKTOP,hwndHMLE); return 0L; }
MRESULT _System DrvEjectAllDlg( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) { switch (msg) { case WM_INITDLG: DrvInitEjectAllDlg( hwnd, mp2); return (0); case WM_SAVEAPPLICATION: WinStoreWindowPos( CAMINI_APP, CAMINI_EJECTPOS, hwnd); return (0); case WM_SYSCOMMAND: if (SHORT1FROMMP( mp1) == SC_CLOSE) return (WinSendMsg( hwnd, WM_COMMAND, (MP)IDC_NO, 0)); break; case WM_COMMAND: if (mp1 == (MP)IDC_YES) { WinEnableWindow( WinWindowFromID( hwnd, IDC_YES), FALSE); WinEnableWindow( WinWindowFromID( hwnd, IDC_NO), FALSE); LoadDlgItemString( hwnd, IDC_TEXT1, MSG_Ejecting); LoadDlgItemString( hwnd, IDC_TEXT4, MSG_ThisMayTake); DrvEjectAllDrives( hwnd); } WindowClosed( WinQueryWindowUShort( hwnd, QWS_ID)); WinDestroyWindow( hwnd); return (0); case WM_FOCUSCHANGE: if (SHORT1FROMMP(mp2) && !WinIsWindowEnabled( hwnd)) { WinPostMsg( WinQueryWindow( hwnd, QW_OWNER), CAMMSG_FOCUSCHANGE, 0, 0); return (0); } break; case WM_DESTROY: WinPostMsg( WinQueryWindow( hwnd, QW_OWNER), CAMMSG_EXIT, (MP)TRUE, 0); break; } return (WinDefDlgProc( hwnd, msg, mp1, mp2)); }
MRESULT EXPENTRY ClientWndProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) { static CHAR *szMenuText [3] = { NULL, "A~bout PoorMenu...", "~Help..." } ; static MENUITEM mi [3] = { MIT_END, MIS_SEPARATOR, 0, 0, 0, 0, MIT_END, MIS_TEXT, 0, IDM_ABOUT, 0, 0, MIT_END, MIS_TEXT, 0, IDM_HELP, 0, 0 } ; HWND hwndSysMenu, hwndSysSubMenu ; INT iItem, idSysMenu ; MENUITEM miSysMenu ; switch (msg) { case WM_CREATE: hwndSysMenu = WinWindowFromID ( WinQueryWindow (hwnd, QW_PARENT), FID_SYSMENU) ; idSysMenu = SHORT1FROMMR (WinSendMsg (hwndSysMenu, MM_ITEMIDFROMPOSITION, NULL, NULL)) ; WinSendMsg (hwndSysMenu, MM_QUERYITEM, MPFROM2SHORT (idSysMenu, FALSE), MPFROMP (&miSysMenu)) ; hwndSysSubMenu = miSysMenu.hwndSubMenu ; for (iItem = 0 ; iItem < 3 ; iItem++) WinSendMsg (hwndSysSubMenu, MM_INSERTITEM, MPFROMP (mi + iItem), MPFROMP (szMenuText [iItem])) ; return 0 ; case WM_COMMAND: switch (COMMANDMSG(&msg)->cmd) { case IDM_ABOUT: WinMessageBox (HWND_DESKTOP, hwnd, "(C) Charles Petzold, 1993", szCaption, 0, MB_OK | MB_INFORMATION) ; return 0 ; case IDM_HELP: WinMessageBox (HWND_DESKTOP, hwnd, "Help not yet implemented", szCaption, 0, MB_OK | MB_WARNING) ; return 0 ; } break ; case WM_ERASEBACKGROUND: return MRFROMSHORT (1) ; } return WinDefWindowProc (hwnd, msg, mp1, mp2) ; }
nsresult nsNativeBrowserWindow::CreateMenuBar(PRInt32 aWidth) { HWND hwnd = (HWND)mWindow->GetNativeData(NS_NATIVE_WIDGET); HWND hwndFrame = WinQueryWindow( hwnd, QW_PARENT); HWND hwndMenu = WinLoadMenu( hwndFrame, 0, IDM_VIEWERBAR); WinSendMsg( hwndFrame, WM_UPDATEFRAME, MPFROMLONG(FCF_MENU), 0); return NS_OK; }
MRESULT hia_wmCreate(HWND hwnd,MPARAM mp1,MPARAM mp2) { HIA *hia = NULL; HIABuf *hiabuf = NULL; HIANotifWnd *notifList = NULL; ULONG notifListAllocSize = HIA_NOTIFLIST_DEFAULT_SIZE; HWND hwndOwner = WinQueryWindow(hwnd,QW_OWNER); USHORT Id = WinQueryWindowUShort(hwnd,QWS_ID); int i; if (DosAllocMem((PPVOID)&hiabuf,sizeof(HIABuf),fALLOC)) return MRFROMLONG(TRUE); #ifdef DEBUG assert(hiabuf!=NULL); #endif HIABufClear(hiabuf); if (DosAllocMem((PPVOID)¬ifList,sizeof(HIANotifWnd)*notifListAllocSize,fALLOC)) return MRFROMLONG(TRUE); #ifdef DEBUG assert(notifList!=NULL); #endif for (i=0;i<notifListAllocSize;i++) { notifList[i].hwnd = NULLHANDLE; notifList[i].id = 0; } if (DosAllocMem((PPVOID)&hia,sizeof(HIA),fALLOC)) return MRFROMLONG(TRUE); #ifdef DEBUG assert(hia!=NULL); #endif hia->hwndHIA = hwnd; hia->inbuf = hiabuf; hia->kbdtype = HAN_KBD_2; hia->hanmode = HCH_ENG; hia->insertmode = HAN_INSERT; hia->hcode = HCH_JSY; hia->isHanjaKey = hia_defaultHanjaKey; hia->isSpecialCharKey = hia_defaultSpecialCharKey; hia->notifListAllocSize = notifListAllocSize; hia->notifList = notifList; hia->notifList[0].hwnd = hwndOwner; hia->notifList[0].id = Id; hia->responseTo = &(hia->notifList[0]); hia->hwndHCHLB = NULLHANDLE; hia->fRunningHCHLB = FALSE; hia->scselIndex = 0; if (!WinSetWindowPtr(hwnd,WINWORD_INSTANCE,(PVOID)hia)) return MRFROMLONG(TRUE); return 0L; }
MRESULT EXPENTRY MyWindowProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) { SWP swp; ULONG rc; HWND hFrame; HWND hListBox; /* Listbox window handle */ switch (msg) { case WM_CREATE: hListBox = WinCreateWindow(hwnd, WC_LISTBOX, NULL, WS_VISIBLE | LS_NOADJUSTPOS | LS_HORZSCROLL, 0, 0, 0, 0, hwnd, HWND_TOP, ID_LISTBOX, 0, 0); pwpList = WinSubclassWindow(hListBox, wpSubList); hFrame = WinQueryWindow(hwnd, QW_PARENT); rc = WinSetWindowPos(hFrame, HWND_TOP, 0, 0, 400, 300, SWP_SIZE | SWP_ACTIVATE | SWP_SHOW); break; case WM_SIZE: WinQueryWindowPos(hwnd, &swp); hListBox=WinWindowFromID(hwnd, ID_LISTBOX); WinSetWindowPos(hListBox, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy, SWP_SIZE | SWP_SHOW); break; default: return(WinDefWindowProc(hwnd, msg, mp1, mp2)); } return((MRESULT)FALSE); }
static MRESULT EXPENTRY AttribSelectProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) { PATTRIBSELECTDATA pWinData = WinQueryWindowPtr(hwnd, QWL_USER); switch(msg) { case WM_CREATE: return (MRESULT) CreateWindow(hwnd, (PCREATESTRUCT) mp2); case WM_DESTROY: DestroyWindow(pWinData); break; case WM_HELP: /* Weiterleiten mit eigener ID */ mp1 = MPFROMSHORT(WinQueryWindowUShort(hwnd, QWS_ID)); break; case ATTSM_SETATTRIB: return (MRESULT) SetAttrib(hwnd, pWinData, (ULONG) mp1, (ULONG) mp2); case ATTSM_QUERYATTRIB: return (MRESULT) QueryAttrib(pWinData); case WM_CONTROL: if (SHORT1FROMMP(mp1) == ATTSID_VALUE) { switch(SHORT2FROMMP(mp1)) { case VN_ENTER: AttribClicked(hwnd, pWinData, SHORT1FROMMP(mp2), SHORT2FROMMP(mp2)); break; case VN_HELP: #if 0 WinPostMsg(WinQueryWindow(hwnd, QW_OWNER), WM_HELP, MPFROMSHORT(WinQueryWindowUShort(hwnd, QWS_ID)), mp2); #endif break; } } break; case WM_DRAWITEM: if (SHORT1FROMMP(mp1) == ATTSID_VALUE) return (MRESULT) DrawItem(pWinData, (POWNERITEM) mp2); else break; case WM_QUERYDLGCODE: return WinSendMsg(pWinData->hwndValueSet, msg, mp1, mp2); default: break; } return WinDefWindowProc(hwnd, msg, mp1, mp2); }
/*--------------------------------------------- Helper subroutines to work over menu items. ---------------------------------------------*/ VOID EnableMenuItem (HWND hwnd, SHORT sMenuItem, BOOL fEnable) { HWND hwndParent = WinQueryWindow (hwnd, QW_PARENT, FALSE) ; HWND hwndMenu = WinWindowFromID (hwndParent, FID_MENU) ; WinSendMsg (hwndMenu, MM_SETITEMATTR, MPFROM2SHORT (sMenuItem, TRUE), MPFROM2SHORT (MIA_DISABLED, fEnable ? 0 : MIA_DISABLED)) ; }
static MRESULT EXPENTRY newchkproc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) { PCLBOX pclb = (PCLBOX)stGetData(WinQueryWindow(hwnd, QW_PARENT)); if (msg == WM_PAINT && !pclb->is.enbl) { pclb->pfbtn(hwnd, msg, mp1, mp2); paintDisabledCheck(hwnd, &pclb->rclcpt, pclb->lbkgnd); return(MRESULT)FALSE; } /* endif */ return pclb->pfbtn(hwnd, msg, mp1, mp2); }
VOID UpdateMenuText (HWND hwnd, SHORT sMenuItem, PSZ szNewText) { HWND hwndParent = WinQueryWindow (hwnd, QW_PARENT, FALSE); HWND hwndMenu = WinWindowFromID (hwndParent, FID_MENU); WinSendMsg (hwndMenu, MM_SETITEMTEXT, MPFROMSHORT ( sMenuItem ), MPFROMP ( szNewText) ) ; }
static void restoreWindow(HWND hwnd, const char *name, USHORT cx, USHORT cy) { ICQFRAME *cfg = WinQueryWindowPtr(hwnd,0); if(!name) name = cfg->name; icqRestoreWindow(WinQueryWindow(hwnd,QW_PARENT), cfg->icq, 0, name, cx, cy); }
static void storeWindow(HWND hwnd, const char *name) { ICQFRAME *cfg = WinQueryWindowPtr(hwnd,0); if(!name) name = cfg->name; icqStoreWindow(WinQueryWindow(hwnd,QW_PARENT), cfg->icq, 0, name); }
BOOL lboxEndDrag(PELBOX pelb, PMSEMSG pmmsg) { LONG rc; if (!(pelb->fl & ELBCS_ITEMDRAGGABLE) || !pelb->is.dragging) return FALSE; WinSetCapture(HWND_DESKTOP, NULLHANDLE); WinStopTimer(pelb->hab, pelb->hlbx, DRAG_TIMERID); pelb->is.dragging = 0; if (pelb->is.where == ELBOX_DRAGIN) { PVOID pitemdata; PSZ psz; ULONG cb; SHORT dropitem = (SHORT)pelb->lbxwprc(pelb->hlbx, LM_QUERYTOPINDEX, MPVOID, MPVOID) + (pelb->rcltopitem.yTop - pmmsg->y + pelb->cyitem / 2) / pelb->cyitem; if (dropitem != pelb->dragitem && dropitem != (pelb->dragitem + 1)) { rc = (LONG)WinSendMsg(WinQueryWindow(pelb->hwnd, QW_OWNER), WM_CONTROL, MPFROM2SHORT((USHORT)pelb->id, ELBXN_DROPITEM), MPFROM2SHORT(pelb->dragitem, dropitem)); if (rc < 0) goto cancel; if (rc > 0) return TRUE; // ricava dati item draggato cb = (ULONG)pelb->lbxwprc(pelb->hlbx, LM_QUERYITEMTEXTLENGTH, (MPARAM)pelb->dragitem, MPVOID) + 1; if (NULL != (psz = (PSZ)malloc(cb))) { pelb->lbxwprc(pelb->hlbx, LM_QUERYITEMTEXT, MPFROM2SHORT(pelb->dragitem, cb), (MPARAM)psz); pitemdata = pelb->lbxwprc(pelb->hlbx, LM_QUERYITEMHANDLE, (MPARAM)pelb->dragitem, MPVOID); WinEnableWindowUpdate(pelb->hlbx, FALSE); // lo copia nella nuova posizione if (dropitem >= pelb->citems) dropitem = LIT_END; dropitem = (SHORT)pelb->lbxwprc(pelb->hlbx, LM_INSERTITEM, (MPARAM)dropitem, (MPARAM)psz); pelb->lbxwprc(pelb->hlbx, LM_SETITEMHANDLE, (MPARAM)dropitem, (MPARAM)pitemdata); free(psz); // se inserzione nuovo item precede vecchio aumenta indice if (dropitem < pelb->dragitem) ++pelb->dragitem; else --dropitem; // cancella item da vecchia posizione pelb->lbxwprc(pelb->hlbx, LM_DELETEITEM, (MPARAM)pelb->dragitem, MPVOID); // seleziona item riposizionato pelb->lbxwprc(pelb->hlbx, LM_SELECTITEM, (MPARAM)dropitem, (MPARAM)TRUE); WinEnableWindowUpdate(pelb->hlbx, TRUE); return TRUE; } /* endif */ } /* endif */ } /* endif */ cancel: WinAlarm(HWND_DESKTOP, WA_ERROR); return TRUE; } /* endif */