?? decorations.java
字號:
public Rectangle getClientArea () { checkWidget (); /* * Note: The CommandBar is part of the client area, * not the trim. Applications don't expect this so * subtract the height of the CommandBar. */ if (OS.IsHPC) { Rectangle rect = super.getClientArea (); if (menuBar != null) { int hwndCB = menuBar.hwndCB; int height = OS.CommandBar_Height (hwndCB); rect.y += height; rect.height -= height; } return rect; } if (!OS.IsWinCE) { if (OS.IsIconic (handle)) { RECT rect = new RECT (); WINDOWPLACEMENT lpwndpl = new WINDOWPLACEMENT (); lpwndpl.length = WINDOWPLACEMENT.sizeof; OS.GetWindowPlacement (handle, lpwndpl); int width = lpwndpl.right - lpwndpl.left; int height = lpwndpl.bottom - lpwndpl.top; OS.SetRect (rect, 0, 0, width, height); OS.SendMessage (handle, OS.WM_NCCALCSIZE, 0, rect); return new Rectangle (0, 0, rect.right, rect.bottom); } } return super.getClientArea ();}/** * Returns the receiver's default button if one had * previously been set, otherwise returns null. * * @return the default button or null * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * * @see #setDefaultButton */public Button getDefaultButton () { checkWidget (); return defaultButton;}/** * Returns the receiver's image if it had previously been * set using <code>setImage()</code>. The image is typically * displayed by the window manager when the instance is * marked as iconified, and may also be displayed somewhere * in the trim when the instance is in normal or maximized * states. * <p> * Note: This method will return null if called before * <code>setImage()</code> is called. It does not provide * access to a window manager provided, "default" image * even if one exists. * </p> * * @return the image * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */public Image getImage () { checkWidget (); return image;}/** * Returns the receiver's images if they had previously been * set using <code>setImages()</code>. Images are typically * displayed by the window manager when the instance is * marked as iconified, and may also be displayed somewhere * in the trim when the instance is in normal or maximized * states. Depending where the icon is displayed, the platform * chooses the icon with the "best" size. It is expected that * the array will contain the same icon rendered at different * resolutions. * * <p> * Note: This method will return an empty array if called before * <code>setImages()</code> is called. It does not provide * access to a window manager provided, "default" image * even if one exists. * </p> * * @return the images * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * * @since 3.0 */public Image [] getImages () { checkWidget (); if (images == null) return new Image [0]; Image [] result = new Image [images.length]; System.arraycopy (images, 0, result, 0, images.length); return result;}public Point getLocation () { checkWidget (); if (!OS.IsWinCE) { if (OS.IsIconic (handle)) { WINDOWPLACEMENT lpwndpl = new WINDOWPLACEMENT (); lpwndpl.length = WINDOWPLACEMENT.sizeof; OS.GetWindowPlacement (handle, lpwndpl); return new Point (lpwndpl.left, lpwndpl.top); } } return super.getLocation ();}/** * Returns <code>true</code> if the receiver is currently * maximized, and false otherwise. * <p> * * @return the maximized state * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * * @see #setMaximized */public boolean getMaximized () { checkWidget (); if (OS.IsWinCE) return swFlags == OS.SW_SHOWMAXIMIZED; if (OS.IsWindowVisible (handle)) return OS.IsZoomed (handle); return swFlags == OS.SW_SHOWMAXIMIZED;}/** * Returns the receiver's menu bar if one had previously * been set, otherwise returns null. * * @return the menu bar or null * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */public Menu getMenuBar () { checkWidget (); return menuBar;}/** * Returns <code>true</code> if the receiver is currently * minimized, and false otherwise. * <p> * * @return the minimized state * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * * @see #setMinimized */public boolean getMinimized () { checkWidget (); if (OS.IsWinCE) return false; if (OS.IsWindowVisible (handle)) return OS.IsIconic (handle); return swFlags == OS.SW_SHOWMINNOACTIVE;}String getNameText () { return getText ();}public Point getSize () { checkWidget (); if (!OS.IsWinCE) { if (OS.IsIconic (handle)) { WINDOWPLACEMENT lpwndpl = new WINDOWPLACEMENT (); lpwndpl.length = WINDOWPLACEMENT.sizeof; OS.GetWindowPlacement (handle, lpwndpl); int width = lpwndpl.right - lpwndpl.left; int height = lpwndpl.bottom - lpwndpl.top; return new Point (width, height); } } return super.getSize ();}/** * Returns the receiver's text, which is the string that the * window manager will typically display as the receiver's * <em>title</em>. If the text has not previously been set, * returns an empty string. * * @return the text * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */public String getText () { checkWidget (); int length = OS.GetWindowTextLength (handle); if (length == 0) return ""; /* Use the character encoding for the default locale */ TCHAR buffer = new TCHAR (0, length + 1); OS.GetWindowText (handle, buffer, length + 1); return buffer.toString (0, length);}public boolean isReparentable () { checkWidget (); /* * Feature in Windows. Calling SetParent() for a shell causes * a kind of fake MDI to happen. It doesn't work well on Windows * and is not supported on the other platforms. The fix is to * disallow the SetParent(). */ return false;}boolean isTabGroup () { /* * Can't test WS_TAB bits because they are the same as WS_MAXIMIZEBOX. */ return true;}boolean isTabItem () { /* * Can't test WS_TAB bits because they are the same as WS_MAXIMIZEBOX. */ return false;}Decorations menuShell () { return this;}void releaseWidget () { if (menuBar != null) menuBar.releaseResources (); menuBar = null; if (menus != null) { do { int index = 0; while (index < menus.length) { Menu menu = menus [index]; if (menu != null && !menu.isDisposed ()) { while (menu.getParentMenu () != null) { menu = menu.getParentMenu (); } menu.dispose (); break; } index++; } if (index == menus.length) break; } while (true); } menus = null; super.releaseWidget (); if (smallImage != null) smallImage.dispose (); if (largeImage != null) largeImage.dispose (); smallImage = largeImage = image = null; images = null; savedFocus = null; defaultButton = saveDefault = null; if (hAccel != 0 && hAccel != -1) OS.DestroyAcceleratorTable (hAccel); hAccel = -1;}void removeMenu (Menu menu) { if (menus == null) return; for (int i=0; i<menus.length; i++) { if (menus [i] == menu) { menus [i] = null; return; } }}boolean restoreFocus () { if (display.ignoreRestoreFocus) return true; if (savedFocus != null && savedFocus.isDisposed ()) savedFocus = null; if (savedFocus != null && savedFocus.setSavedFocus ()) return true; /* * This code is intentionally commented. When no widget * has been given focus, some platforms give focus to the * default button. Windows doesn't do this. */// if (defaultButton != null && !defaultButton.isDisposed ()) {// if (defaultButton.setFocus ()) return true;// } return false;}void saveFocus () { Control control = display.getFocusControl (); if (control != null && control != this && this == control.menuShell ()) { setSavedFocus (control); }}void setBounds (int x, int y, int width, int height, int flags) { if (OS.IsWinCE) { super.setBounds (x, y, width, height, flags); } if (OS.IsIconic (handle) || OS.IsZoomed (handle)) { setPlacement (x, y, width, height, flags); return; } super.setBounds (x, y, width, height, flags);}/** * If the argument is not null, sets the receiver's default * button to the argument, and if the argument is null, sets * the receiver's default button to the first button which * was set as the receiver's default button (called the * <em>saved default button</em>). If no default button had * previously been set, or the saved default button was * disposed, the receiver's default button will be set to * null. * * @param button the new default button * * @exception IllegalArgumentException <ul> * <li>ERROR_INVALID_ARGUMENT - if the button has been disposed</li> * </ul> * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */public void setDefaultButton (Button button) { checkWidget (); setDefaultButton (button, true);}void setDefaultButton (Button button, boolean save) { if (button == null) { if (defaultButton == saveDefault) { if (save) saveDefault = null; return; } } else { if (button.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT); if ((button.style & SWT.PUSH) == 0) return; if (button == defaultButton) return; } if (defaultButton != null) { if (!defaultButton.isDisposed ()) defaultButton.setDefault (false); } if ((defaultButton = button) == null) defaultButton = saveDefault; if (defaultButton != null) { if (!defaultButton.isDisposed ()) defaultButton.setDefault (true); } if (save) saveDefault = defaultButton; if (saveDefault != null && saveDefault.isDisposed ()) saveDefault = null;}/** * Sets the receiver's image to the argument, which may * be null. The image is typically displayed by the window * manager when the instance is marked as iconified, and * may also be displayed somewhere in the trim when the * instance is in normal or maximized states. * * @param image the new image (or null) * * @exception IllegalArgumentException <ul> * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li> * </ul> * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -