Package org.sf.feeling.swt.win32.extension.widgets

Examples of org.sf.feeling.swt.win32.extension.widgets.CButton


    drawAllCommands(e.gc);
  }

  private void drawGlossyThemeBackGround(GC gc)
  {
    GlossyThemeRender themeRender = (GlossyThemeRender) theme;
    Rectangle glossyRect = new Rectangle(0, 0, toolbar.getSize().x,
        toolbar.getSize().y / 2);
    Pattern pattern = new Pattern(null, 0, 0, 0, glossyRect.height, themeRender
        .getToolbar_bg_glossy_color1(), themeRender
        .getToolbar_bg_glossy_color1_alpha(), themeRender
        .getToolbar_bg_glossy_color2(), themeRender
        .getToolbar_bg_glossy_color2_alpha());
    gc.setBackgroundPattern(pattern);
    Path path = new Path(null);
    path.addRectangle(glossyRect.x, glossyRect.y, glossyRect.width, glossyRect.height);
    gc.fillPath(path);
    path.dispose();

    int glowSize = (int) (toolbar.getSize().y * 0.15);
    Rectangle glowRect = new Rectangle(0, toolbar.getSize().y - glowSize, toolbar
        .getSize().x, glowSize);
    pattern = new Pattern(null, 0, glowRect.y, 0, glowRect.y + glowRect.height,
        themeRender.getToolbar_bg_glow_color1(), themeRender
            .getToolbar_bg_glow_color1_alpha(), themeRender
            .getToolbar_bg_glow_color2(), themeRender
            .getToolbar_bg_glow_color2_alpha());
    gc.setBackgroundPattern(pattern);
    path = new Path(null);
    path.addRectangle(glowRect.x, glowRect.y, glowRect.width, glowRect.height);
    gc.fillPath(path);
View Full Code Here


  public static boolean isPlatform() {
    if(!SKIN) return false;
//        return false;
    if(!"win32".equalsIgnoreCase(SWT.getPlatform())) return false;
    if(!(Win32.getWin32Version() >= Win32.VERSION(5, 0))) return false;
    if(THEME == null) THEME = new Office2007ThemeRender();
    return true;
  }
View Full Code Here

              .getMenu_control_item_border_track());
          g.drawRectangle(selectArea);
        }
        else if (theme instanceof OfficeThemeRender)
        {
          OfficeThemeRender themeRender = (OfficeThemeRender) theme;
          Color[] colors = new Color[] {
              themeRender.getMenu_control_item_outer_top_track1(),
              themeRender.getMenu_control_item_outer_top_track2(),
              themeRender.getMenu_control_item_outer_bottom_track1(),
              themeRender.getMenu_control_item_outer_bottom_track2(),
              themeRender.getMenu_control_item_inner_top_track1(),
              themeRender.getMenu_control_item_inner_top_track2(),
              themeRender.getMenu_control_item_inner_bottom_track1(),
              themeRender.getMenu_control_item_inner_bottom_track2(),
              themeRender.getMenu_control_item_border_track() };
          drawGradientBack(g, selectArea, colors);
          drawGradientBorder(g, selectArea, colors);
        }
        else if (theme instanceof GlossyThemeRender)
        {
          GlossyThemeRender themeRender = (GlossyThemeRender) theme;
          Rectangle outerBorder = new Rectangle(selectArea.x, selectArea.y,
              selectArea.width, selectArea.height);
          Rectangle innerBorder = GraphicsUtil.inflate(outerBorder, -1, -1);
          Rectangle glossy = new Rectangle(innerBorder.x, innerBorder.y,
              innerBorder.width, innerBorder.height / 2);
          Rectangle glow = GraphicsUtil.createRectangleFromLTRB(outerBorder.x,
              outerBorder.y + Math.round(outerBorder.height * .5f),
              outerBorder.x + outerBorder.width, outerBorder.y
                  + outerBorder.height);

          g.setBackground(themeRender.getMenu_control_item_bg_track());
          g.fillRectangle(innerBorder);
          g.setAntialias(SWT.ON);

          Pattern pattern = new Pattern(null, 0, glossy.y, 0, glossy.y
              + glossy.height, themeRender.getMenu_control_item_bg_color1(),
              themeRender.getMenu_control_item_bg_color1_alpha(), themeRender
                  .getMenu_control_item_bg_color2(), themeRender
                  .getMenu_control_item_bg_color2_alpha());
          Path path = new Path(null);
          path.addRectangle(glossy.x, glossy.y, glossy.width, glossy.height);
          g.setBackgroundPattern(pattern);
          g.fillPath(path);
          path.dispose();

          // draw border
          path = GraphicsUtil.createRoundRectangle(outerBorder, 2);
          g.setForeground(themeRender.getMenu_control_item_outer_border());
          g.drawPath(path);
          path.dispose();

          pattern = new Pattern(null, 0, glossy.y, 0, glossy.y + glossy.height,
              themeRender.getMenu_control_item_bg_glossy_track1(), themeRender
                  .getMenu_control_item_bg_glossy_track1_alpha(),
              themeRender.getMenu_control_item_bg_glossy_track2(), themeRender
                  .getMenu_control_item_bg_glossy_track2_alpha());

          path = GraphicsUtil.createTopRoundRectangle(glossy, 2);
          g.setBackgroundPattern(pattern);
          g.fillPath(path);
          path.dispose();

          Color innerBorderColor = themeRender.getMenu_control_item_inner_border();

          path = GraphicsUtil.createRoundRectangle(innerBorder, 2);
          g.setForeground(innerBorderColor);
          g.drawPath(path);
          path.dispose();

          path = GraphicsUtil.createRoundRectangle(glow, 2);
          g.setClipping(path);
          path.dispose();

          Color glowColor = themeRender.getMenu_control_item_bg_glow();

          path = createBottomRadialPath(glow);
          float[] point = new float[2];
          float[] bounds = new float[4];
          path.getBounds(bounds);
View Full Code Here

        gc.setBackground(themeRender.getTool_item_check_selection_bg_normal2());
        gc.fillGradientRectangle(drawRect.x, drawRect.y, drawRect.width, drawRect.height, true);
        gc.setForeground(themeRender.getTool_item_check_selection_fg_normal());
        gc.drawRectangle(drawRect);
      } else if (theme instanceof OfficeThemeRender) {
        OfficeThemeRender themeRender = (OfficeThemeRender) theme;
        Color[] colors = new Color[] {
            themeRender.getTool_item_outer_top_checked1(),
            themeRender.getTool_item_outer_top_checked2(),
            themeRender.getTool_item_outer_bottom_checked1(),
            themeRender.getTool_item_outer_bottom_checked2(),
            themeRender.getTool_item_inner_top_checked1(),
            themeRender.getTool_item_inner_top_checked2(),
            themeRender.getTool_item_inner_bottom_checked1(),
            themeRender.getTool_item_inner_bottom_checked2(),
            themeRender.getTool_item_border_checked(), };
        drawGradientBack(gc, drawRect, colors);
        drawGradientBorder(gc, drawRect, colors);
      } else if (theme instanceof GlossyThemeRender) {
        drawGlossyItem(gc, drawRect);
      }
    }

    if (theme instanceof GeneralThemeRender) {
      GeneralThemeRender themeRender = (GeneralThemeRender) theme;
      if (selected && isEnabled()) {
        if (menuTracked || (getMenu() != null && !canSelected())) {
          gc.setForeground(themeRender.getTool_item_showmenu_bg1());
          gc.setBackground(themeRender.getTool_item_showmenu_bg2());
          gc.fillGradientRectangle(drawRect.x, drawRect.y, drawRect.width,
              drawRect.height, true);
          gc.setForeground(themeRender.getTool_item_showmenu_fg());
          gc.drawRectangle(drawRect);
        } else {
          gc.setForeground(themeRender.getTool_item_bg_selected1());
          gc.setBackground(themeRender.getTool_item_bg_selected2());
          if (getMenu() != null) {
            Rectangle noneMenuRect = getNonMenuRect();
            gc.fillGradientRectangle(noneMenuRect.x, noneMenuRect.y,
                noneMenuRect.width, noneMenuRect.height, true);
            gc.setForeground(themeRender.getTool_item_bg_track1());
            gc.setBackground(themeRender.getTool_item_bg_track2());
            Rectangle menuRect = getMenuRect();
            gc.fillGradientRectangle(menuRect.x, menuRect.y, menuRect.width, menuRect.height, true);
          } else {
            gc.fillGradientRectangle(drawRect.x, drawRect.y, drawRect.width, drawRect.height, true);
          }
          gc.setForeground(themeRender.getTool_item_fg_selected());
          gc.drawRectangle(drawRect);

        }
      } else if ((getStyle() & SWT.TOGGLE) != 0 && getSelection() && isEnabled()) {
        gc.setForeground(themeRender.getTool_item_check_selection_bg_track1());
        gc.setBackground(themeRender.getTool_item_check_selection_bg_track2());
        gc.fillGradientRectangle(drawRect.x, drawRect.y, drawRect.width,
            drawRect.height, true);
        gc.setForeground(themeRender.getTool_item_check_selection_fg_track());
        gc.drawRectangle(drawRect);
      } else {
        gc.setForeground(themeRender.getTool_item_bg_track1());
        gc.setBackground(themeRender.getTool_item_bg_track2());
        gc.fillGradientRectangle(drawRect.x, drawRect.y, drawRect.width, drawRect.height, true);
        gc.setForeground(themeRender.getTool_item_fg_track());
        gc.drawRectangle(drawRect);
      }
    } else if (theme instanceof OfficeThemeRender) {
      OfficeThemeRender themeRender = (OfficeThemeRender) theme;
      Color[] colors = null;
      if (selected && isEnabled()) {
        if (menuTracked || (getMenu() != null && !canSelected())) {
          colors = new Color[] {
              themeRender.getTool_item_outer_top_showmenu_color1(),
              themeRender.getTool_item_outer_top_showmenu_color2(),
              themeRender.getTool_item_outer_bottom_showmenu_color1(),
              themeRender.getTool_item_outer_bottom_showmenu_color2(),
              themeRender.getTool_item_inner_top_showmenu_color1(),
              themeRender.getTool_item_inner_top_showmenu_color2(),
              themeRender.getTool_item_inner_bottom_showmenu_color1(),
              themeRender.getTool_item_inner_bottom_showmenu_color2(),
              themeRender.getTool_item_border_showmenu_color(), };
          drawGradientBack(gc, drawRect, colors);
          drawGradientBorder(gc, drawRect, colors);
        } else {
          colors = new Color[] { themeRender.getTool_item_outer_top_selected1(),
              themeRender.getTool_item_outer_top_selected2(),
              themeRender.getTool_item_outer_bottom_selected1(),
              themeRender.getTool_item_outer_bottom_selected2(),
              themeRender.getTool_item_inner_top_selected1(),
              themeRender.getTool_item_inner_top_selected2(),
              themeRender.getTool_item_inner_bottom_selected1(),
              themeRender.getTool_item_inner_bottom_selected2(),
              themeRender.getTool_item_border_selected(), };
          if (getMenu() != null) {
            drawGradientBack(gc, getNonMenuRect(), colors);
            colors = new Color[] {
                themeRender.getTool_item_outer_top_track1(),
                themeRender.getTool_item_outer_top_track2(),
                themeRender.getTool_item_outer_bottom_track1(),
                themeRender.getTool_item_outer_bottom_track2(),
                themeRender.getTool_item_inner_top_track1(),
                themeRender.getTool_item_inner_top_track2(),
                themeRender.getTool_item_inner_bottom_track1(),
                themeRender.getTool_item_inner_bottom_track2(),
                themeRender.getTool_item_border_track(), };
            drawGradientBack(gc, getMenuRect(), colors);
          } else {
            drawGradientBack(gc, drawRect, colors);
          }
          drawGradientBorder(gc, drawRect, colors);
        }
      } else if ((getStyle() & SWT.TOGGLE) != 0 && getSelection() && isEnabled()) {
        colors = new Color[] {
            themeRender.getTool_item_outer_top_checked_track1(),
            themeRender.getTool_item_outer_top_checked_track2(),
            themeRender.getTool_item_outer_bottom_checked_track1(),
            themeRender.getTool_item_outer_bottom_checked_track2(),
            themeRender.getTool_item_inner_top_checked_track1(),
            themeRender.getTool_item_inner_top_checked_track2(),
            themeRender.getTool_item_inner_bottom_checked_track1(),
            themeRender.getTool_item_inner_bottom_checked_track2(),
            themeRender.getTool_item_border_checked_track(), };
        drawGradientBack(gc, drawRect, colors);
        drawGradientBorder(gc, drawRect, colors);
      } else {
        colors = new Color[] { themeRender.getTool_item_outer_top_track1(),
            themeRender.getTool_item_outer_top_track2(),
            themeRender.getTool_item_outer_bottom_track1(),
            themeRender.getTool_item_outer_bottom_track2(),
            themeRender.getTool_item_inner_top_track1(),
            themeRender.getTool_item_inner_top_track2(),
            themeRender.getTool_item_inner_bottom_track1(),
            themeRender.getTool_item_inner_bottom_track2(),
            themeRender.getTool_item_border_track(), };
        drawGradientBack(gc, drawRect, colors);
        drawGradientBorder(gc, drawRect, colors);
      }
    } else if (theme instanceof GlossyThemeRender) {
      drawGlossyItem(gc, drawRect);
View Full Code Here

              gc.drawRectangle(drawRect);
            }
          }
          else if (theme instanceof OfficeThemeRender)
          {
            OfficeThemeRender themeRender = (OfficeThemeRender) theme;
            Color[] colors = null;
            if (selected)
            {
              if (mc == null)
              {
                colors = new Color[] {
                    themeRender.getTool_item_outer_top_selected1(),
                    themeRender.getTool_item_outer_top_selected2(),
                    themeRender.getTool_item_outer_bottom_selected1(),
                    themeRender.getTool_item_outer_bottom_selected2(),
                    themeRender.getTool_item_inner_top_selected1(),
                    themeRender.getTool_item_inner_top_selected2(),
                    themeRender.getTool_item_inner_bottom_selected1(),
                    themeRender.getTool_item_inner_bottom_selected2(),
                    themeRender.getTool_item_border_selected(), };
                drawGradientBack(gc, drawRect, colors);
                drawGradientBorder(gc, drawRect, colors);
              }
              else
              {
                if (menuTracked || (mc.getMenu() != null && !mc.canSelected()))
                {
                  colors = new Color[] {
                      themeRender
                          .getTool_item_outer_top_showmenu_color1(),
                      themeRender
                          .getTool_item_outer_top_showmenu_color2(),
                      themeRender
                          .getTool_item_outer_bottom_showmenu_color1(),
                      themeRender
                          .getTool_item_outer_bottom_showmenu_color2(),
                      themeRender
                          .getTool_item_inner_top_showmenu_color1(),
                      themeRender
                          .getTool_item_inner_top_showmenu_color2(),
                      themeRender
                          .getTool_item_inner_bottom_showmenu_color1(),
                      themeRender
                          .getTool_item_inner_bottom_showmenu_color2(),
                      themeRender.getTool_item_border_showmenu_color(), };
                  drawGradientBack(gc, drawRect, colors);
                  drawGradientBorder(gc, drawRect, colors);
                }
                else
                {
                  colors = new Color[] {
                      themeRender.getTool_item_outer_top_selected1(),
                      themeRender.getTool_item_outer_top_selected2(),
                      themeRender.getTool_item_outer_bottom_selected1(),
                      themeRender.getTool_item_outer_bottom_selected2(),
                      themeRender.getTool_item_inner_top_selected1(),
                      themeRender.getTool_item_inner_top_selected2(),
                      themeRender.getTool_item_inner_bottom_selected1(),
                      themeRender.getTool_item_inner_bottom_selected2(),
                      themeRender.getTool_item_border_selected(), };
                  if (mc.getMenu() != null)
                  {
                    drawGradientBack(gc, getNonMenuRect(dc), colors);
                    colors = new Color[] {
                        themeRender.getTool_item_outer_top_track1(),
                        themeRender.getTool_item_outer_top_track2(),
                        themeRender.getTool_item_outer_bottom_track1(),
                        themeRender.getTool_item_outer_bottom_track2(),
                        themeRender.getTool_item_inner_top_track1(),
                        themeRender.getTool_item_inner_top_track2(),
                        themeRender.getTool_item_inner_bottom_track1(),
                        themeRender.getTool_item_inner_bottom_track2(),
                        themeRender.getTool_item_border_track(), };
                    drawGradientBack(gc, getMenuRect(dc), colors);
                  }
                  else
                    drawGradientBack(gc, drawRect, colors);
                  drawGradientBorder(gc, drawRect, colors);
                }
              }
            }
            else if (mc != null && (mc.getStyle() & SWT.CHECK) != 0
                && mc.getSelection())
            {
              colors = new Color[] {
                  themeRender.getTool_item_outer_top_checked_track1(),
                  themeRender.getTool_item_outer_top_checked_track2(),
                  themeRender.getTool_item_outer_bottom_checked_track1(),
                  themeRender.getTool_item_outer_bottom_checked_track2(),
                  themeRender.getTool_item_inner_top_checked_track1(),
                  themeRender.getTool_item_inner_top_checked_track2(),
                  themeRender.getTool_item_inner_bottom_checked_track1(),
                  themeRender.getTool_item_inner_bottom_checked_track2(),
                  themeRender.getTool_item_border_checked_track(), };
              drawGradientBack(gc, drawRect, colors);
              drawGradientBorder(gc, drawRect, colors);
            }
            else
            {
              colors = new Color[] {
                  themeRender.getTool_item_outer_top_track1(),
                  themeRender.getTool_item_outer_top_track2(),
                  themeRender.getTool_item_outer_bottom_track1(),
                  themeRender.getTool_item_outer_bottom_track2(),
                  themeRender.getTool_item_inner_top_track1(),
                  themeRender.getTool_item_inner_top_track2(),
                  themeRender.getTool_item_inner_bottom_track1(),
                  themeRender.getTool_item_inner_bottom_track2(),
                  themeRender.getTool_item_border_track(), };
              drawGradientBack(gc, drawRect, colors);
              drawGradientBorder(gc, drawRect, colors);
            }
          }
          else if (theme instanceof GlossyThemeRender)
          {
            drawGlossyItem(gc, drawRect, dc, tracked);
          }
          if (selected) showMenuShadow(gc, dc.getDrawRect(), dc.getToolItem());
        }
        else if (mc != null && (mc.getStyle() & SWT.CHECK) != 0 && mc.getSelection())
        {
          if (theme instanceof GeneralThemeRender)
          {
            GeneralThemeRender themeRender = (GeneralThemeRender) theme;
            gc
                .setForeground(themeRender
                    .getTool_item_check_selection_bg_normal1());
            gc
                .setBackground(themeRender
                    .getTool_item_check_selection_bg_normal2());
            gc.fillGradientRectangle(drawRect.x, drawRect.y, drawRect.width,
                drawRect.height, true);
            gc.setForeground(themeRender.getTool_item_check_selection_fg_normal());
            gc.drawRectangle(drawRect);
          }
          else if (theme instanceof OfficeThemeRender)
          {
            OfficeThemeRender themeRender = (OfficeThemeRender) theme;
            Color[] colors = new Color[] {
                themeRender.getTool_item_outer_top_checked1(),
                themeRender.getTool_item_outer_top_checked2(),
                themeRender.getTool_item_outer_bottom_checked1(),
                themeRender.getTool_item_outer_bottom_checked2(),
                themeRender.getTool_item_inner_top_checked1(),
                themeRender.getTool_item_inner_top_checked2(),
                themeRender.getTool_item_inner_bottom_checked1(),
                themeRender.getTool_item_inner_bottom_checked2(),
                themeRender.getTool_item_border_checked(), };
            drawGradientBack(gc, drawRect, colors);
            drawGradientBorder(gc, drawRect, colors);
          }
          else if (theme instanceof GlossyThemeRender)
          {
View Full Code Here

  public PopupMenu(Control control) {
    this(control, true);
  }

  public PopupMenu(Control control, boolean autoDetect) {
    this(control, new VS2005ThemeRender(), autoDetect);
  }
View Full Code Here

   *            specifies the directory on the disk.
   * @return the number of free bytes available on the disk.
   */
  public static long getDiskFreeSpace(String path)
  {
    DISKFREESPACE diskSpace = Extension.GetDiskFreeSpace(path);
    return diskSpace.freeBytesAvailable;
  }
View Full Code Here

   *            specifies the directory on the disk.
   * @return the number of bytes available on the disk.
   */
  public static long getDiskTotalSize(String path)
  {
    DISKFREESPACE diskSpace = Extension.GetDiskFreeSpace(path);
    return diskSpace.totalNumberOfBytes;
  }
View Full Code Here

    /**
     * Starts the event loop.
     */
    public void run() {
      messageThreadAlive = true;
      eventObject = new EventObject(descriptor.getName());
      eventObject.reset();
      eventLoop.installHook();
      while (messageThreadAlive) {
        eventObject.waitFor();
        if (messageThreadAlive) {
View Full Code Here

   * @param point
   *            a memory KBDLLHOOKSTRUCT struct point
   * @return A KeyboardLLHookStruct object.
   */
  public static KeyboardLLHookStruct valueOf(int point) {
    KBDLLHOOKSTRUCT struct = new KBDLLHOOKSTRUCT();
    Extension.CreateStructByPoint(point, struct);
    return new KeyboardLLHookStruct(struct);
  }
View Full Code Here

TOP

Related Classes of org.sf.feeling.swt.win32.extension.widgets.CButton

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.