?? decorations.java
字號:
if (((state & HIDDEN) == 0) == visible) return; } else { if (visible == OS.IsWindowVisible (handle)) return; } if (visible) { /* * It is possible (but unlikely), that application * code could have disposed the widget in the show * event. If this happens, just return. */ sendEvent (SWT.Show); if (isDisposed ()) return; if (OS.IsHPC) { if (menuBar != null) { int hwndCB = menuBar.hwndCB; OS.CommandBar_DrawMenuBar (hwndCB, 0); } } if (drawCount != 0) { state &= ~HIDDEN; } else { if (OS.IsWinCE) { OS.ShowWindow (handle, OS.SW_SHOW); } else { if (menuBar != null) { display.removeBar (menuBar); OS.DrawMenuBar (handle); } OS.ShowWindow (handle, swFlags); } OS.UpdateWindow (handle); } } else { if (!OS.IsWinCE) { if (OS.IsIconic (handle)) { swFlags = OS.SW_SHOWMINNOACTIVE; } else { if (OS.IsZoomed (handle)) { swFlags = OS.SW_SHOWMAXIMIZED; } else { if (handle == OS.GetActiveWindow ()) { swFlags = OS.SW_RESTORE; } else { swFlags = OS.SW_SHOWNOACTIVATE; } } } } if (drawCount != 0) { state |= HIDDEN; } else { OS.ShowWindow (handle, OS.SW_HIDE); } /* * It is possible (but unlikely), that application * code could have disposed the widget in an event * triggered by ShowWindow(). If this happens, just * return. */ if (isDisposed ()) return; sendEvent (SWT.Hide); }}boolean translateAccelerator (MSG msg) { if (!isEnabled () || !isActive ()) return false; if (menuBar != null && !menuBar.isEnabled ()) return false; if (translateMDIAccelerator (msg) || translateMenuAccelerator (msg)) return true; Decorations decorations = parent.menuShell (); return decorations.translateAccelerator (msg);}boolean translateMenuAccelerator (MSG msg) { if (hAccel == -1) createAccelerators (); return hAccel != 0 && OS.TranslateAccelerator (handle, hAccel, msg) != 0;}boolean translateMDIAccelerator (MSG msg) { if (!(this instanceof Shell)) { Shell shell = getShell (); int hwndMDIClient = shell.hwndMDIClient; if (hwndMDIClient != 0 && OS.TranslateMDISysAccel (hwndMDIClient, msg)) { return true; } if (msg.message == OS.WM_KEYDOWN) { if (OS.GetKeyState (OS.VK_CONTROL) >= 0) return false; switch (msg.wParam) { case OS.VK_F4: OS.PostMessage (handle, OS.WM_CLOSE, 0, 0); return true; case OS.VK_F6: if (traverseDecorations (true)) return true; } return false; } if (msg.message == OS.WM_SYSKEYDOWN) { switch (msg.wParam) { case OS.VK_F4: OS.PostMessage (shell.handle, OS.WM_CLOSE, 0, 0); return true; } return false; } } return false;}boolean traverseDecorations (boolean next) { Control [] children = parent._getChildren (); int length = children.length; int index = 0; while (index < length) { if (children [index] == this) break; index++; } /* * It is possible (but unlikely), that application * code could have disposed the widget in focus in * or out events. Ensure that a disposed widget is * not accessed. */ int start = index, offset = (next) ? 1 : -1; while ((index = (index + offset + length) % length) != start) { Control child = children [index]; if (!child.isDisposed () && child instanceof Decorations) { if (child.setFocus ()) return true; } } return false;}boolean traverseItem (boolean next) { return false;}boolean traverseReturn () { if (defaultButton == null || defaultButton.isDisposed ()) return false; if (!defaultButton.isVisible () || !defaultButton.isEnabled ()) return false; defaultButton.click (); return true;}CREATESTRUCT widgetCreateStruct () { return new CREATESTRUCT ();}int widgetExtStyle () { int bits = super.widgetExtStyle () | OS.WS_EX_MDICHILD; bits &= ~OS.WS_EX_CLIENTEDGE; if ((style & SWT.NO_TRIM) != 0) return bits; if (OS.IsPPC) { if ((style & SWT.CLOSE) != 0) bits |= OS.WS_EX_CAPTIONOKBTN; } if ((style & SWT.TOOL) != 0) bits |= OS.WS_EX_TOOLWINDOW; if ((style & SWT.RESIZE) != 0) return bits; if ((style & SWT.BORDER) != 0) bits |= OS.WS_EX_DLGMODALFRAME; return bits;}int widgetParent () { Shell shell = getShell (); return shell.hwndMDIClient ();}int widgetStyle () { /* * Clear WS_VISIBLE and WS_TABSTOP. NOTE: In Windows, WS_TABSTOP * has the same value as WS_MAXIMIZEBOX so these bits cannot be * used to control tabbing. */ int bits = super.widgetStyle () & ~(OS.WS_TABSTOP | OS.WS_VISIBLE); /* Set the title bits and no-trim bits */ bits &= ~OS.WS_BORDER; if ((style & SWT.NO_TRIM) != 0) return bits; if ((style & SWT.TITLE) != 0) bits |= OS.WS_CAPTION; /* Set the min and max button bits */ if ((style & SWT.MIN) != 0) bits |= OS.WS_MINIMIZEBOX; if ((style & SWT.MAX) != 0) bits |= OS.WS_MAXIMIZEBOX; /* Set the resize, dialog border or border bits */ if ((style & SWT.RESIZE) != 0) { /* * Note on WinCE PPC. SWT.RESIZE is used to resize * the Shell according to the state of the IME. * It does not set the WS_THICKFRAME style. */ if (!OS.IsPPC) bits |= OS.WS_THICKFRAME; } else { if ((style & SWT.BORDER) == 0) bits |= OS.WS_BORDER; } /* Set the system menu and close box bits */ if (!OS.IsPPC && !OS.IsSP) { if ((style & SWT.CLOSE) != 0) bits |= OS.WS_SYSMENU; } return bits;}int windowProc (int hwnd, int msg, int wParam, int lParam) { switch (msg) { case Display.SWT_GETACCEL: case Display.SWT_GETACCELCOUNT: if (hAccel == -1) createAccelerators (); return msg == Display.SWT_GETACCELCOUNT ? nAccel : hAccel; } return super.windowProc (hwnd, msg, wParam, lParam);}LRESULT WM_ACTIVATE (int wParam, int lParam) { LRESULT result = super.WM_ACTIVATE (wParam, lParam); if (result != null) return result; if ((wParam & 0xFFFF) != 0) { /* * When the high word of wParam is non-zero, the activation * state of the window is being changed while the window is * minimized. If this is the case, do not report activation * events or restore the focus. */ if ((wParam >> 16) != 0) return result; /* * It is possible (but unlikely), that application * code could have disposed the widget in the activate * event. If this happens, end the processing of the * Windows message by returning zero as the result of * the window proc. */ Control control = display.findControl (lParam); if (control == null || control instanceof Shell) { if (this instanceof Shell) { sendEvent (SWT.Activate); if (isDisposed ()) return LRESULT.ZERO; } } if (restoreFocus ()) return LRESULT.ZERO; } else { /* * It is possible (but unlikely), that application * code could have disposed the widget in the deactivate * event. If this happens, end the processing of the * Windows message by returning zero as the result of * the window proc. */ Control control = display.findControl (lParam); if (control == null || control instanceof Shell) { if (this instanceof Shell) { Shell shell = getShell (); shell.setActiveControl (null); if (isDisposed ()) return LRESULT.ZERO; sendEvent (SWT.Deactivate); if (isDisposed ()) return LRESULT.ZERO; } } saveFocus (); } return result;}LRESULT WM_CLOSE (int wParam, int lParam) { LRESULT result = super.WM_CLOSE (wParam, lParam); if (result != null) return result; if (!isEnabled () || !isActive ()) return LRESULT.ZERO; Event event = new Event (); sendEvent (SWT.Close, event); // the widget could be disposed at this point if (event.doit && !isDisposed ()) dispose (); return LRESULT.ZERO;}LRESULT WM_HOTKEY (int wParam, int lParam) { LRESULT result = super.WM_HOTKEY (wParam, lParam); if (result != null) return result; if (OS.IsSP) { /* * Feature on WinCE SP. The Back key is either used to close * the foreground Dialog or used as a regular Back key in an EDIT * control. The article 'Back Key' in MSDN for Smartphone * describes how an application should handle it. The * workaround is to override the Back key when creating * the menubar and handle it based on the style of the Shell. * If the Shell has the SWT.CLOSE style, close the Shell. * Otherwise, send the Back key to the window with focus. */ if (((lParam >> 16) & 0xFFFF) == OS.VK_ESCAPE) { if ((style & SWT.CLOSE) != 0) { OS.PostMessage (handle, OS.WM_CLOSE, 0, 0); } else { OS.SHSendBackToFocusWindow (OS.WM_HOTKEY, wParam, lParam); } return LRESULT.ZERO; } } return result;}LRESULT WM_KILLFOCUS (int wParam, int lParam) { LRESULT result = super.WM_KILLFOCUS (wParam, lParam); saveFocus (); return result;}LRESULT WM_NCACTIVATE (int wParam, int lParam) { LRESULT result = super.WM_NCACTIVATE (wParam, lParam); if (result != null) return result; if (wParam == 0) { if (display.lockActiveWindow) return LRESULT.ZERO; Control control = display.findControl (lParam); if (control != null) { Shell shell = getShell (); Decorations decorations = control.menuShell (); if (decorations.getShell () == shell) { if (this instanceof Shell) return LRESULT.ONE; if (display.ignoreRestoreFocus) { if (display.lastHittest != OS.HTCLIENT) { result = LRESULT.ONE; } } } } } if (!(this instanceof Shell)) { int hwndShell = getShell().handle; OS.SendMessage (hwndShell, OS.WM_NCACTIVATE, wParam, lParam); } return result;}LRESULT WM_QUERYOPEN (int wParam, int lParam) { LRESULT result = super.WM_QUERYOPEN (wParam, lParam); if (result != null) return result; sendEvent (SWT.Deiconify); // widget could be disposed at this point return result;}LRESULT WM_SETFOCUS (int wParam, int lParam) { LRESULT result = super.WM_SETFOCUS (wParam, lParam); if (savedFocus != this) restoreFocus (); return result;}LRESULT WM_SIZE (int wParam, int lParam) { LRESULT result = super.WM_SIZE (wParam, lParam); /* * It is possible (but unlikely), that application * code could have disposed the widget in the resize * event. If this happens, end the processing of the * Windows message by returning the result of the * WM_SIZE message. */ if (isDisposed ()) return result; if (wParam == OS.SIZE_MINIMIZED) { sendEvent (SWT.Iconify); // widget could be disposed at this point } return result;}LRESULT WM_SYSCOMMAND (int wParam, int lParam) { LRESULT result = super.WM_SYSCOMMAND (wParam,lParam); if (result != null) return result; if (!(this instanceof Shell)) { int cmd = wParam & 0xFFF0; switch (cmd) { case OS.SC_CLOSE: { OS.PostMessage (handle, OS.WM_CLOSE, 0, 0); return LRESULT.ZERO; } case OS.SC_NEXTWINDOW: { traverseDecorations (true); return LRESULT.ZERO; } } } return result;}LRESULT WM_WINDOWPOSCHANGING (int wParam, int lParam) { LRESULT result = super.WM_WINDOWPOSCHANGING (wParam,lParam); if (result != null) return result; if (display.lockActiveWindow) { WINDOWPOS lpwp = new WINDOWPOS (); OS.MoveMemory (lpwp, lParam, WINDOWPOS.sizeof); lpwp.flags |= OS.SWP_NOZORDER; OS.MoveMemory (lParam, lpwp, WINDOWPOS.sizeof); } return result;}}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -