Home | History | Annotate | Download | only in libgtk2ui
      1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #include "chrome/browser/ui/libgtk2ui/chrome_gtk_frame.h"
      6 
      7 G_BEGIN_DECLS
      8 
      9 // MetaFrames declaration
     10 G_DEFINE_TYPE(MetaFrames, meta_frames, GTK_TYPE_WINDOW)
     11 
     12 static void meta_frames_class_init(MetaFramesClass* frames_class) {
     13   // Noop since we don't declare anything.
     14 }
     15 
     16 static void meta_frames_init(MetaFrames* button) {
     17 }
     18 
     19 
     20 // ChromeGtkFrame declaration
     21 G_DEFINE_TYPE(ChromeGtkFrame, chrome_gtk_frame, meta_frames_get_type())
     22 
     23 static void chrome_gtk_frame_class_init(ChromeGtkFrameClass* frame_class) {
     24   GtkWidgetClass* widget_class = reinterpret_cast<GtkWidgetClass*>(frame_class);
     25 
     26   // Frame tints:
     27   gtk_widget_class_install_style_property(
     28       widget_class,
     29       g_param_spec_boxed(
     30           "frame-color",
     31           "Frame Color",
     32           "The color that the chrome frame will be. (If unspecified, "
     33             " Chrome will take ChromeGtkFrame::bg[SELECTED] and slightly darken"
     34             " it.)",
     35           GDK_TYPE_COLOR,
     36           G_PARAM_READABLE));
     37   gtk_widget_class_install_style_property(
     38       widget_class,
     39       g_param_spec_boxed(
     40           "inactive-frame-color",
     41           "Inactive Frame Color",
     42           "The color that the inactive chrome frame will be. (If"
     43             " unspecified, Chrome will take ChromeGtkFrame::bg[INSENSITIVE]"
     44             " and slightly darken it.)",
     45           GDK_TYPE_COLOR,
     46           G_PARAM_READABLE));
     47   gtk_widget_class_install_style_property(
     48       widget_class,
     49       g_param_spec_boxed(
     50           "incognito-frame-color",
     51           "Incognito Frame Color",
     52           "The color that the incognito frame will be. (If unspecified,"
     53             " Chrome will take the frame color and tint it by Chrome's default"
     54             " incognito tint.)",
     55           GDK_TYPE_COLOR,
     56           G_PARAM_READABLE));
     57   gtk_widget_class_install_style_property(
     58       widget_class,
     59       g_param_spec_boxed(
     60           "incognito-inactive-frame-color",
     61           "Incognito Inactive Frame Color",
     62           "The color that the inactive incognito frame will be. (If"
     63             " unspecified, Chrome will take the frame color and tint it by"
     64             " Chrome's default incognito tint.)",
     65           GDK_TYPE_COLOR,
     66           G_PARAM_READABLE));
     67 
     68   // Frame gradient control:
     69   gtk_widget_class_install_style_property(
     70       widget_class,
     71       g_param_spec_int(
     72           "frame-gradient-size",
     73           "Chrome Frame Gradient Size",
     74           "The size of the gradient on top of the frame image. Specify 0 to"
     75             " make the frame a solid color.",
     76           0,      // 0 disables the gradient
     77           128,    // The frame image is only up to 128 pixels tall.
     78           16,     // By default, gradients are 16 pixels high.
     79           G_PARAM_READABLE));
     80   gtk_widget_class_install_style_property(
     81       widget_class,
     82       g_param_spec_boxed(
     83           "frame-gradient-color",
     84           "Frame Gradient Color",
     85           "The top color of the chrome frame gradient. (If unspecified,"
     86             " chrome will create a lighter tint of frame-color",
     87           GDK_TYPE_COLOR,
     88           G_PARAM_READABLE));
     89   gtk_widget_class_install_style_property(
     90       widget_class,
     91       g_param_spec_boxed(
     92           "inactive-frame-gradient-color",
     93           "Inactive Frame Gradient Color",
     94           "The top color of the inactive chrome frame gradient. (If"
     95             " unspecified, chrome will create a lighter tint of frame-color",
     96           GDK_TYPE_COLOR,
     97           G_PARAM_READABLE));
     98   gtk_widget_class_install_style_property(
     99       widget_class,
    100       g_param_spec_boxed(
    101           "incognito-frame-gradient-color",
    102           "Incognito Frame Gradient Color",
    103           "The top color of the incognito chrome frame gradient. (If"
    104             " unspecified, chrome will create a lighter tint of frame-color",
    105           GDK_TYPE_COLOR,
    106           G_PARAM_READABLE));
    107   gtk_widget_class_install_style_property(
    108       widget_class,
    109       g_param_spec_boxed(
    110           "incognito-inactive-frame-gradient-color",
    111           "Incognito Inactive Frame Gradient Color",
    112           "The top color of the incognito inactive chrome frame gradient. (If"
    113             " unspecified, chrome will create a lighter tint of frame-color",
    114           GDK_TYPE_COLOR,
    115           G_PARAM_READABLE));
    116 
    117   // Scrollbar color properties:
    118   gtk_widget_class_install_style_property(
    119       widget_class,
    120       g_param_spec_boxed(
    121           "scrollbar-slider-prelight-color",
    122           "Scrollbar Slider Prelight Color",
    123           "The color applied to the mouse is above the tab",
    124           GDK_TYPE_COLOR,
    125           G_PARAM_READABLE));
    126   gtk_widget_class_install_style_property(
    127       widget_class,
    128       g_param_spec_boxed(
    129           "scrollbar-slider-normal-color",
    130           "Scrollbar Slider Normal Color",
    131           "The color applied to the slider normally",
    132           GDK_TYPE_COLOR,
    133           G_PARAM_READABLE));
    134   gtk_widget_class_install_style_property(
    135       widget_class,
    136       g_param_spec_boxed(
    137           "scrollbar-trough-color",
    138           "Scrollbar Trough Color",
    139           "The background color of the slider track",
    140           GDK_TYPE_COLOR,
    141           G_PARAM_READABLE));
    142 }
    143 
    144 static void chrome_gtk_frame_init(ChromeGtkFrame* frame) {
    145 }
    146 
    147 GtkWidget* chrome_gtk_frame_new(void) {
    148   return GTK_WIDGET(g_object_new(chrome_gtk_frame_get_type(),
    149                                  "type", GTK_WINDOW_TOPLEVEL,
    150                                  NULL));
    151 }
    152 
    153 G_END_DECLS
    154