Exemple #1
0
  /**
   * Initializes any internal resources needed by the device.
   *
   * <p>This method is called after <code>create</code>.
   *
   * <p>If subclasses reimplement this method, they must call the <code>super</code> implementation.
   *
   * @see #create
   */
  protected void init() {
    /* Create the standard colors */
    colors = new Color[SWT.COLOR_DARK_GRAY + 1];
    colors[SWT.COLOR_BLACK] = colors[0] = Color.wpf_new(this, OS.Colors_Black());
    colors[SWT.COLOR_DARK_RED] = Color.wpf_new(this, OS.Colors_Maroon());
    colors[SWT.COLOR_DARK_GREEN] = Color.wpf_new(this, OS.Colors_Green());
    colors[SWT.COLOR_DARK_YELLOW] = Color.wpf_new(this, OS.Colors_Olive());
    colors[SWT.COLOR_DARK_BLUE] = Color.wpf_new(this, OS.Colors_Navy());
    colors[SWT.COLOR_DARK_MAGENTA] = Color.wpf_new(this, OS.Colors_Purple());
    colors[SWT.COLOR_DARK_CYAN] = Color.wpf_new(this, OS.Colors_Teal());
    colors[SWT.COLOR_GRAY] = Color.wpf_new(this, OS.Colors_Silver());
    colors[SWT.COLOR_DARK_GRAY] = Color.wpf_new(this, OS.Colors_Silver());
    colors[SWT.COLOR_RED] = Color.wpf_new(this, OS.Colors_Red());
    colors[SWT.COLOR_GREEN] = Color.wpf_new(this, OS.Colors_Lime());
    colors[SWT.COLOR_YELLOW] = Color.wpf_new(this, OS.Colors_Yellow());
    colors[SWT.COLOR_BLUE] = Color.wpf_new(this, OS.Colors_Blue());
    colors[SWT.COLOR_MAGENTA] = Color.wpf_new(this, OS.Colors_Magenta());
    colors[SWT.COLOR_CYAN] = Color.wpf_new(this, OS.Colors_Cyan());
    colors[SWT.COLOR_WHITE] = Color.wpf_new(this, OS.Colors_White());

    /* Initialize the system font slot */
    int fontFamily = OS.SystemFonts_MessageFontFamily();
    int style = OS.SystemFonts_MessageFontStyle();
    int weight = OS.SystemFonts_MessageFontWeight();
    double size = OS.SystemFonts_MessageFontSize();
    int typeface = OS.gcnew_Typeface(fontFamily, style, weight, OS.FontStretches_Normal);
    OS.GCHandle_Free(fontFamily);
    OS.GCHandle_Free(style);
    OS.GCHandle_Free(weight);
    systemFont = Font.wpf_new(this, typeface, size);
  }