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

Examples of org.sf.feeling.swt.win32.internal.extension.MCI_STATUS_PARMS


      }
    });
   
    if(XPWidgetTheme.isPlatform()) { 
      PopupMenu popupMenu = new PopupMenu(text, XPWidgetTheme.THEME);
      CMenu menu = new CMenu();
      popupMenu.setMenu(menu);
      text.setMenu(new Menu(text.getShell(), SWT.POP_UP));
      CMenuItem item = new CMenuItem(SWT.NONE);
      item.addSelectionListener(new SelectionAdapter() {
        @SuppressWarnings("unused")
        public void widgetSelected(SelectionEvent e) {
          text.setText("");
        }
      });
      item.setText("Clear");
      menu.addItem(item);
    } else {
      Menu menu = new Menu(text.getShell(), SWT.POP_UP);
      text.setMenu(menu);
     
      MenuItem item = new MenuItem(menu, SWT.NONE);
View Full Code Here


    });


    Object treeMenu ;
    if(XPWidgetTheme.isPlatform()) { 
      PopupMenu popupMenu = new PopupMenu(tree, XPWidgetTheme.THEME);
      treeMenu = new CMenu();
      popupMenu.setMenu((CMenu)treeMenu);
    } else {
      treeMenu = new Menu(getShell(), SWT.POP_UP);
      tree.setMenu((Menu)treeMenu);
    }

    factory.createStyleMenuItem( treeMenu, "itemAdd", "+.gif", new SelectionAdapter(){
      @SuppressWarnings("unused")
      public void widgetSelected(SelectionEvent evt) {
        try {
          traverseTree(TreeHandler.SELECT, addItems());
        } catch (Exception e) {
          ClientLog.getInstance().setMessage(tree.getShell(), e);
        }
      }  
    })

    factory.createStyleMenuItem(treeMenu, "itemRemove", "-.gif", new SelectionAdapter(){
      @SuppressWarnings("unused")
      public void widgetSelected(SelectionEvent evt) {
        try {
          traverseTree(TreeHandler.REMOVE, new String[]{});
          removeItem();
          traverseTree(TreeHandler.SELECT, lstPath.getItems());
        } catch (Exception e) {
          ClientLog.getInstance().setMessage(tree.getShell(), e);
        }
      }  
    });  

    factory.createStyleMenuItem(treeMenu, SWT.SEPARATOR);

    factory.createStyleMenuItem(treeMenu, "itemExpand", new SelectionAdapter(){
      @SuppressWarnings("unused")
      public void widgetSelected(SelectionEvent evt) {
        expand(true);
      }  
    });

    factory.createStyleMenuItem(treeMenu, "itemCollapse", new SelectionAdapter(){
      @SuppressWarnings("unused")
      public void widgetSelected(SelectionEvent evt) {
        expand(false);
      }  
    });

    factory.createStyleMenuItem(treeMenu, SWT.SEPARATOR);

    factory.createStyleMenuItem(treeMenu, "itemExpandDataNode", new SelectionAdapter(){
      @SuppressWarnings("unused")
      public void widgetSelected(SelectionEvent evt) {
        expandDataNode();
      }  
    });

    factory.createStyleMenuItem(treeMenu, "itemCollapseTree", new SelectionAdapter(){
      @SuppressWarnings("unused")
      public void widgetSelected(SelectionEvent evt) {
        TreeItem [] items = tree.getItems();
        if(items == null) return;
        for(TreeItem item : items) {
          expand(item, false);
        }
      }  
    });

    factory.createStyleMenuItem(treeMenu, SWT.SEPARATOR);

    factory.createStyleMenuItem( treeMenu, "itemView", "view.gif", new SelectionAdapter(){
      @SuppressWarnings("unused")
      public void widgetSelected(SelectionEvent evt) {
        viewItem();
      }  
    });  

    sash0.setWeights( new int[]{500, 300});    
    handler = new TreeHandler();       

    Composite bottom = new Composite(this, SWT.NONE);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    bottom.setLayoutData(gridData);
    factory.setComposite(bottom);

    gridLayout = new GridLayout(1, false);
    gridLayout.marginHeight = 2;
    gridLayout.horizontalSpacing = 5;
    gridLayout.verticalSpacing = 0;
    gridLayout.marginWidth = 2;
    bottom.setLayout(gridLayout);

    txtPath = new NodeEditor2(bottom, this);
    txtPath.setFont(UIDATA.FONT_10B);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.heightHint = 70;
    if(UIDATA.isMacOS) {
      //      gridData.heightHint = 30;
      txtPath.setFont(UIDATA.FONT_11B);
    }

    txtPath.setLayoutData(gridData);
    /*txtPath.addKeyListener(new KeyAdapter() {
      public void keyPressed(KeyEvent event) {
        if(event.keyCode == SWT.CR) {
          addEditItem();
          event.doit = false;
        }
      }
    });*/

    /*txtPath.text.setDoubleClickEnabled(false);
    txtPath.text.addMouseListener(new MouseAdapter() {

      public void mouseDown(MouseEvent e) {
        if(e.count == 3) {
          txtPath.setText("");         
          return;
        }

        if(e.button == 2) {
          if(txtPath.getText().trim().isEmpty()) return;
          addEditItem();
        }
      }


      @SuppressWarnings("unused")
      public void mouseDoubleClick(MouseEvent e) {
        new TemplateHandlerAction(new char[]{'[', ']'}).handle(txtPath.text);
      }
    });*/


    lstPath = factory.createList(bottom, SWT.BORDER | SWT.SINGLE | SWT.V_SCROLL | SWT.H_SCROLL);
    lstPath.setFont(UIDATA.FONT_10B);
    lstPath.addSelectionListener(new SelectionAdapter(){
      @SuppressWarnings("unused")
      public void widgetSelected(SelectionEvent e){
        int selectedIndex = lstPath.getSelectionIndex();
        if(selectedIndex < 0) return;
        String path  = lstPath.getItem(selectedIndex);
        txtPath.setText(path);
        List<String> removes = null;
        try {
          removes = traverseTree(TreeHandler.SELECT, new String[]{path});
        } catch (Exception exp) {
          ClientLog.getInstance().setMessage(tree.getShell(), exp);
        }
        if(removes == null) return ;
        for(String ele : removes) lstPath.remove(ele);
        if(removes.size() > 0 && lstPath.getItemCount() > 0) lstPath.select(0);
      }
    });

    Object menu;

    if(XPWidgetTheme.isPlatform()) { 
      PopupMenu popupMenu = new PopupMenu(lstPath, XPWidgetTheme.THEME);
      menu = new CMenu();
      popupMenu.setMenu((CMenu)menu);
    } else {
      menu = new Menu(getShell(), SWT.POP_UP);
      lstPath.setMenu((Menu)menu);
    }

View Full Code Here

    if(!isPlatform()) return;
    //XPVersion
   
    Color color = ColorCache.getInstance().getColor(245, 245, 240);
    if(composite instanceof Shell) {
      ShellWrapper wrapper = new ShellWrapper((Shell)composite);

      //      if (Win32.getWin32Version() >= Win32.VERSION(5, 0)) {
      wrapper.installTheme(ThemeConstants.STYLE_OFFICE2007);
      //      } else {
      //        wrapper.installTheme(ThemeConstants.STYLE_VISTA);
      //      }
    }
    setBackgroup(composite, color);//new Color(shell.getDisplay(), 255, 255, 255));
View Full Code Here

    if(font != null) gc.setFont(font);
    Rectangle drawRect = new Rectangle(1, 1, getSize().x - 2, getSize().y - 2);
    //button.getSize().y - 2
    if ((getStyle() & SWT.TOGGLE) != 0 && 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) {
        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

      {
        if (tracked)
        {
          if (theme instanceof GeneralThemeRender)
          {
            GeneralThemeRender themeRender = (GeneralThemeRender) theme;
            if (selected)
            {
              gc.setForeground(themeRender.getMenu_item_bg_selected1());
              gc.setBackground(themeRender.getMenu_item_bg_selected2());
              gc.fillGradientRectangle(drawRect.x, drawRect.y, drawRect.width,
                  drawRect.height, true);
              gc.setForeground(themeRender.getMenu_item_border_selected());
              gc.drawRectangle(drawRect);
            }
            else
            {
              gc.setForeground(themeRender.getMenu_item_bg_track1());
              gc.setBackground(themeRender.getMenu_item_bg_track2());
              gc.fillGradientRectangle(drawRect.x, drawRect.y, drawRect.width,
                  drawRect.height, true);
              gc.setForeground(themeRender.getMenu_item_border_track());
              gc.drawRectangle(drawRect);
            }
          }
          else if (theme instanceof OfficeThemeRender)
          {
            OfficeThemeRender themeRender = (OfficeThemeRender) theme;
            Color[] colors = null;
            if (selected)
            {
              colors = new Color[] {
                  themeRender.getMenu_item_outer_top_selected1(),
                  themeRender.getMenu_item_outer_top_selected2(),
                  themeRender.getMenu_item_outer_bottom_selected1(),
                  themeRender.getMenu_item_outer_bottom_selected2(),
                  themeRender.getMenu_item_inner_top_selected1(),
                  themeRender.getMenu_item_inner_top_selected2(),
                  themeRender.getMenu_item_inner_bottom_selected1(),
                  themeRender.getMenu_item_inner_bottom_selected2(),
                  themeRender.getMenu_item_border_selected() };
            }
            else
            {
              colors = new Color[] {
                  themeRender.getMenu_item_outer_top_track1(),
                  themeRender.getMenu_item_outer_top_track2(),
                  themeRender.getMenu_item_outer_bottom_track1(),
                  themeRender.getMenu_item_outer_bottom_track2(),
                  themeRender.getMenu_item_inner_top_track1(),
                  themeRender.getMenu_item_inner_top_track2(),
                  themeRender.getMenu_item_inner_bottom_track1(),
                  themeRender.getMenu_item_inner_bottom_track2(),
                  themeRender.getMenu_item_border_track() };
            }
            drawGradientBack(gc, drawRect, colors);
            drawGradientBorder(gc, drawRect, colors);
          }
          else if (theme instanceof GlossyThemeRender)
          {
            GlossyThemeRender themeRender = (GlossyThemeRender) theme;
            gc.setAntialias(SWT.ON);
            Rectangle outerBorder = new Rectangle(drawRect.x, drawRect.y,
                drawRect.width + 1, drawRect.height + 1);
            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);

            Pattern pattern = new Pattern(null, 0, glossy.y, 0, glossy.y
                + glossy.height, themeRender.getMenu_item_bg_color1(),
                themeRender.getMenu_item_bg_color1_alpha(), themeRender
                    .getMenu_item_bg_color2(), themeRender
                    .getMenu_item_bg_color2_alpha());
            Path path = new Path(null);
            path.addRectangle(glossy.x, glossy.y, glossy.width, glossy.height);
            gc.setBackgroundPattern(pattern);
            gc.fillPath(path);
            path.dispose();

            path = GraphicsUtil.createRoundRectangle(outerBorder, 2);
            gc.setForeground(themeRender.getMenu_item_outer_border());
            gc.drawPath(path);
            path.dispose();

            if (!selected) pattern = new Pattern(null, 0, glossy.y, 0, glossy.y
                + glossy.height, themeRender.getMenu_item_bg_glossy_track1(),
                themeRender.getMenu_item_bg_glossy_track1_alpha(), themeRender
                    .getMenu_item_bg_glossy_track2(), themeRender
                    .getMenu_item_bg_glossy_track2_alpha());
            else
              pattern = new Pattern(null, 0, glossy.y, 0, glossy.y
                  + glossy.height, themeRender
                  .getMenu_item_bg_glossy_selected1(), themeRender
                  .getMenu_item_bg_glossy_selected1_alpha(), themeRender
                  .getMenu_item_bg_glossy_selected2(), themeRender
                  .getMenu_item_bg_glossy_selected2_alpha());
            path = GraphicsUtil.createTopRoundRectangle(glossy, 2);
            gc.setBackgroundPattern(pattern);
            gc.fillPath(path);
            path.dispose();

            Color innerBorderColor = selected
                || (mc != null && (mc.getStyle() & SWT.CHECK) != 0 && mc
                    .getSelection()) ? themeRender
                .getMenu_item_inner_border_selected() : themeRender
                .getMenu_item_inner_border_track();

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

            if (!selected)
            {
              path = GraphicsUtil.createRoundRectangle(glow, 2);
              gc.setClipping(path);
              path.dispose();

              Color glowColor = themeRender.getMenu_item_bg_glow_track();
              path = createBottomRadialPath(glow);
              float[] point = new float[2];
              float[] bounds = new float[4];
              path.getBounds(bounds);
              point[0] = (bounds[0] + bounds[0] + bounds[2]) / 2f;
View Full Code Here

          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

      g.drawRectangle(rect);
    }
  }

  private void drawGlossyItem(GC gc, Rectangle drawRect) {
    GlossyThemeRender themeRender = (GlossyThemeRender) theme;

    Rectangle outerBorder = new Rectangle(drawRect.x, drawRect.y, drawRect.width,
        drawRect.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);

    gc.setBackground(themeRender.getMenu_control_item_bg_track());
    gc.fillRectangle(innerBorder);

    gc.setAntialias(SWT.ON);

    Pattern pattern = new Pattern(null, 0, glossy.y, 0, glossy.y + glossy.height,
        themeRender.getTool_item_bg_color1(), themeRender
        .getTool_item_bg_color1_alpha(), themeRender.getTool_item_bg_color2(),
        themeRender.getTool_item_bg_color2_alpha());
    Path path = new Path(null);
    path.addRectangle(glossy.x, glossy.y, glossy.width, glossy.height);
    gc.setBackgroundPattern(pattern);
    gc.fillPath(path);
    path.dispose();

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

    if (selected && (menuTracked || (getMenu() != null && !canSelected())))   {
      path = GraphicsUtil.createTopRoundRectangle(innerBorder, 2);
      gc.setBackground(themeRender.getTool_item_bg_glossy_showMenu());
      gc.fillPath(path);
      path.dispose();

      path = GraphicsUtil.createTopRoundRectangle(innerBorder, 2);
      gc.setForeground(themeRender.getTool_item_bg_glossy_showMenu());
      gc.drawPath(path);
      path.dispose();
      gc.setAdvanced(false);
      return;
    } else if (selected && getMenu() != null) {
      pattern = new Pattern(null, 0, glossy.y, 0, glossy.y + glossy.height, themeRender
          .getTool_item_bg_glossy_selected1(), themeRender
          .getTool_item_bg_glossy_selected1_alpha(), themeRender
          .getTool_item_bg_glossy_selected2(), themeRender
          .getTool_item_bg_glossy_selected2_alpha());
      Rectangle nonMenuRect = getNonMenuRect();
      Rectangle nonMenuGlossy = new Rectangle(innerBorder.x, innerBorder.y,
          nonMenuRect.width - 1, innerBorder.height / 2);
      path = createTopLeftRoundRectangle(nonMenuGlossy, 2);
      gc.setBackgroundPattern(pattern);
      gc.fillPath(path);
      path.dispose();

      pattern = new Pattern(null, 0, glossy.y, 0, glossy.y + glossy.height, themeRender
          .getTool_item_bg_glossy_track1(), themeRender
          .getTool_item_bg_glossy_track1_alpha(), themeRender
          .getTool_item_bg_glossy_track2(), themeRender
          .getTool_item_bg_glossy_track2_alpha());

      Rectangle menuRect = getMenuRect();
      Rectangle menuGlossy = new Rectangle(menuRect.x, innerBorder.y,
          menuRect.width - 1, innerBorder.height / 2);
      path = createTopRightRoundRectangle(menuGlossy, 2);
      gc.setBackgroundPattern(pattern);
      gc.fillPath(path);
      path.dispose();

      Color innerBorderColor = themeRender.getTool_item_inner_border_selected();

      path = createLeftRoundPath(new Rectangle(innerBorder.x, innerBorder.y,
          nonMenuRect.width - 1, innerBorder.height), 2);
      gc.setForeground(innerBorderColor);
      gc.drawPath(path);
      path.dispose();

      innerBorderColor = themeRender.getTool_item_inner_border_track();

      path = createRightRoundPath(new Rectangle(menuRect.x, innerBorder.y,
          menuRect.width, innerBorder.height), 2);
      gc.setForeground(innerBorderColor);
      gc.drawPath(path);
      path.dispose();

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

      Color glowColor = themeRender.getTool_item_bg_glow_track();
      path = createBottomRadialPath(glow);
      float[] point = new float[2];
      float[] bounds = new float[4];
      path.getBounds(bounds);
      point[0] = (bounds[0] + bounds[0] + bounds[2]) / 2f;
      point[1] = (bounds[1] + bounds[1] + bounds[3]) / 2f;
      GCExtension extension = new GCExtension(gc);
      extension.fillGradientPath(path, point, glowColor, 255, new Color[] { glowColor },
          new int[] { 0 });
      path.dispose();
      gc.setClipping((Region) null);

      gc.setAdvanced(false);
      return;
    }

    if (!(selected)) pattern = new Pattern(null, 0, glossy.y, 0, glossy.y + glossy.height,
        themeRender.getTool_item_bg_glossy_track1(), themeRender
        .getTool_item_bg_glossy_track1_alpha(), themeRender
        .getTool_item_bg_glossy_track2(), themeRender
        .getTool_item_bg_glossy_track2_alpha());
    else
      pattern = new Pattern(null, 0, glossy.y, 0, glossy.y + glossy.height, themeRender
          .getTool_item_bg_glossy_selected1(), themeRender
          .getTool_item_bg_glossy_selected1_alpha(), themeRender
          .getTool_item_bg_glossy_selected2(), themeRender
          .getTool_item_bg_glossy_selected2_alpha());
    path = GraphicsUtil.createTopRoundRectangle(glossy, 2);
    gc.setBackgroundPattern(pattern);
    gc.fillPath(path);
    path.dispose();

    Color innerBorderColor = (selected)
    || ((getStyle() & SWT.TOGGLE) != 0 && getSelection()) ? themeRender
        .getTool_item_inner_border_selected() : themeRender
        .getTool_item_inner_border_track();

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

        if (!((menuTracked || (getMenu() != null && !canSelected())) && selected)) {
          path = GraphicsUtil.createRoundRectangle(glow, 2);
          gc.setClipping(path);
          path.dispose();

          Color glowColor = themeRender.getTool_item_bg_glow_track();

          if ((getStyle() & SWT.TOGGLE) != 0 && getSelection()) {
            glowColor = themeRender.getTool_item_bg_checked_glow_track();
          }

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

  }

  private void drawGlossyItem(GC gc, Rectangle drawRect, ToolDrawCommand dc, boolean tracked)
  {
    GlossyThemeRender themeRender = (GlossyThemeRender) theme;
    gc.setAntialias(SWT.ON);
    Rectangle outerBorder = new Rectangle(drawRect.x, drawRect.y, drawRect.width + 1,
        drawRect.height + 1);
    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);

    Pattern pattern = new Pattern(null, 0, glossy.y, 0, glossy.y + glossy.height,
        themeRender.getTool_item_bg_color1(), themeRender
            .getTool_item_bg_color1_alpha(), themeRender.getTool_item_bg_color2(),
        themeRender.getTool_item_bg_color2_alpha());
    Path path = new Path(null);
    path.addRectangle(glossy.x, glossy.y, glossy.width, glossy.height);
    gc.setBackgroundPattern(pattern);
    gc.fillPath(path);
    path.dispose();

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

    if (tracked
        && dc.getToolItem() != null
        && selected
        && (menuTracked || (dc.getToolItem().getMenu() != null && !dc.getToolItem()
            .canSelected())))
    {
      path = GraphicsUtil.createTopRoundRectangle(innerBorder, 2);
      gc.setBackground(themeRender.getTool_item_bg_glossy_showMenu());
      gc.fillPath(path);
      path.dispose();

      path = GraphicsUtil.createTopRoundRectangle(innerBorder, 2);
      gc.setForeground(themeRender.getTool_item_bg_glossy_showMenu());
      gc.drawPath(path);
      path.dispose();
      gc.setAdvanced(false);
      return;
    }
    else if (tracked && dc.getToolItem() != null && selected
        && dc.getToolItem().getMenu() != null)
    {
      pattern = new Pattern(null, 0, glossy.y, 0, glossy.y + glossy.height, themeRender
          .getTool_item_bg_glossy_selected1(), themeRender
          .getTool_item_bg_glossy_selected1_alpha(), themeRender
          .getTool_item_bg_glossy_selected2(), themeRender
          .getTool_item_bg_glossy_selected2_alpha());
      Rectangle nonMenuRect = getNonMenuRect(dc);
      Rectangle nonMenuGlossy = new Rectangle(innerBorder.x, innerBorder.y,
          nonMenuRect.width - 1, innerBorder.height / 2);
      path = createTopLeftRoundRectangle(nonMenuGlossy, 2);
      gc.setBackgroundPattern(pattern);
      gc.fillPath(path);
      path.dispose();

      pattern = new Pattern(null, 0, glossy.y, 0, glossy.y + glossy.height, themeRender
          .getTool_item_bg_glossy_track1(), themeRender
          .getTool_item_bg_glossy_track1_alpha(), themeRender
          .getTool_item_bg_glossy_track2(), themeRender
          .getTool_item_bg_glossy_track2_alpha());

      Rectangle menuRect = getMenuRect(dc);
      Rectangle menuGlossy = new Rectangle(menuRect.x, innerBorder.y,
          menuRect.width - 1, innerBorder.height / 2);
      path = createTopRightRoundRectangle(menuGlossy, 2);
      gc.setBackgroundPattern(pattern);
      gc.fillPath(path);
      path.dispose();

      Color innerBorderColor = themeRender.getTool_item_inner_border_selected();

      path = createLeftRoundPath(new Rectangle(innerBorder.x, innerBorder.y,
          nonMenuRect.width - 1, innerBorder.height), 2);
      gc.setForeground(innerBorderColor);
      gc.drawPath(path);
      path.dispose();

      innerBorderColor = themeRender.getTool_item_inner_border_track();

      path = createRightRoundPath(new Rectangle(menuRect.x, innerBorder.y,
          menuRect.width, innerBorder.height), 2);
      gc.setForeground(innerBorderColor);
      gc.drawPath(path);
      path.dispose();

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

      Color glowColor = themeRender.getTool_item_bg_glow_track();
      path = createBottomRadialPath(glow);
      float[] point = new float[2];
      float[] bounds = new float[4];
      path.getBounds(bounds);
      point[0] = (bounds[0] + bounds[0] + bounds[2]) / 2f;
      point[1] = (bounds[1] + bounds[1] + bounds[3]) / 2f;
      GCExtension extension = new GCExtension(gc);
      extension.fillGradientPath(path, point, glowColor, 255, new Color[] { glowColor },
          new int[] { 0 });
      path.dispose();
      gc.setClipping((Region) null);

      gc.setAdvanced(false);
      return;
    }

    if (!(selected && tracked)) pattern = new Pattern(null, 0, glossy.y, 0, glossy.y
        + glossy.height, themeRender.getTool_item_bg_glossy_track1(), themeRender
        .getTool_item_bg_glossy_track1_alpha(), themeRender
        .getTool_item_bg_glossy_track2(), themeRender
        .getTool_item_bg_glossy_track2_alpha());
    else
      pattern = new Pattern(null, 0, glossy.y, 0, glossy.y + glossy.height, themeRender
          .getTool_item_bg_glossy_selected1(), themeRender
          .getTool_item_bg_glossy_selected1_alpha(), themeRender
          .getTool_item_bg_glossy_selected2(), themeRender
          .getTool_item_bg_glossy_selected2_alpha());
    path = GraphicsUtil.createTopRoundRectangle(glossy, 2);
    gc.setBackgroundPattern(pattern);
    gc.fillPath(path);
    path.dispose();

    Color innerBorderColor = (selected && tracked)
        || (dc.getToolItem() != null && (dc.getToolItem().getStyle() & SWT.CHECK) != 0 && dc
            .getToolItem().getSelection()) ? themeRender
        .getTool_item_inner_border_selected() : themeRender
        .getTool_item_inner_border_track();

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

    if (!((menuTracked || (dc.getToolItem() != null && dc.getToolItem().getMenu() != null && !dc
        .getToolItem().canSelected()))
        && selected && tracked))
    {
      path = GraphicsUtil.createRoundRectangle(glow, 2);
      gc.setClipping(path);
      path.dispose();

      Color glowColor = themeRender.getTool_item_bg_glow_track();

      if (dc.getToolItem() != null && (dc.getToolItem().getStyle() & SWT.CHECK) != 0
          && dc.getToolItem().getSelection())
      {
        if (tracked)
        {
          glowColor = themeRender.getTool_item_bg_checked_glow_track();
        }
        else
        {
          glowColor = themeRender.getTool_item_bg_checked_glow();
        }
      }

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

    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

TOP

Related Classes of org.sf.feeling.swt.win32.internal.extension.MCI_STATUS_PARMS

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.