Exemplo n.º 1
0
  public void initChatControl(Text chat) {
    chat.setFont(iniAppearance.getFontChat());
    chat.setBackground(iniAppearance.getColorBackground());
    chat.setForeground(iniAppearance.getColorForeground());

    chatControls.add(chat);
  }
Exemplo n.º 2
0
  public void initControl(Control control) {
    control.setFont(iniAppearance.getFontGlobal());
    control.setBackground(iniAppearance.getColorBackground());
    control.setForeground(iniAppearance.getColorForeground());

    controls.add(control);
  }
Exemplo n.º 3
0
  public void applyColor(ColorType type, RGB rgb) {
    Color newColor = new Color(SwtUtils.DISPLAY, rgb);
    Color oldColor = null;

    switch (type) {
      case BACKGROUND:
        {
          oldColor = iniAppearance.getColorBackground();

          for (Control control : controls) {
            if (control.isDisposed()) continue;

            control.setBackground(newColor);
          }
          for (Text chat : chatControls) {
            if (chat.isDisposed()) continue;

            chat.setBackground(newColor);
          }

          iniAppearance.setColorBackground(newColor);
          break;
        }
      case FOREGROUND:
        {
          oldColor = iniAppearance.getColorForeground();

          for (Control control : controls) {
            if (control.isDisposed()) continue;

            control.setForeground(newColor);
          }
          for (Text chat : chatControls) {
            if (chat.isDisposed()) continue;

            chat.setForeground(newColor);
          }

          iniAppearance.setColorForeground(newColor);
          break;
        }
      case LOG_BACKGROUND:
        {
          oldColor = iniAppearance.getColorLogBackground();

          for (StyledText text : logControls) {
            if (text.isDisposed()) continue;

            text.setBackground(newColor);
            text.setForeground(newColor);
          }

          iniAppearance.setColorLogBackground(newColor);
        }
    }

    if (oldColor != null) oldColor.dispose();
  }