summaryrefslogtreecommitdiffstats
path: root/chrome/browser/gtk/options/fonts_page_gtk.h
blob: fc878638665a176aa712d86978eb5f051de8cb66 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// The fonts page of the fonts & languages options dialog, which contains font
// family and size settings, as well as the default encoding option.

#ifndef CHROME_BROWSER_GTK_OPTIONS_FONTS_PAGE_GTK_H_
#define CHROME_BROWSER_GTK_OPTIONS_FONTS_PAGE_GTK_H_
#pragma once

#include <gtk/gtk.h>

#include "app/gtk_signal.h"
#include "base/scoped_ptr.h"
#include "chrome/browser/character_encoding.h"
#include "chrome/browser/options_page_base.h"
#include "chrome/browser/prefs/pref_member.h"

class DefaultEncodingComboboxModel;

class FontsPageGtk : public OptionsPageBase {
 public:
  explicit FontsPageGtk(Profile* profile);
  virtual ~FontsPageGtk();

  GtkWidget* get_page_widget() const { return page_; }

 private:
  void Init();
  void InitDefaultEncodingComboBox();

  // Overridden from OptionsPageBase.
  virtual void NotifyPrefChanged(const std::string* pref_name);

  // Retrieve the font selection from the button and save it to the prefs.  Also
  // ensure the button(s) are displayed in the proper size, as the
  // GtkFontSelector returns the value in points not pixels.
  void SetFontsFromButton(StringPrefMember* name_pref,
                          IntegerPrefMember* size_pref,
                          GtkWidget* font_button);

  CHROMEGTK_CALLBACK_0(FontsPageGtk, void, OnSerifFontSet);
  CHROMEGTK_CALLBACK_0(FontsPageGtk, void, OnSansFontSet);
  CHROMEGTK_CALLBACK_0(FontsPageGtk, void, OnFixedFontSet);
  CHROMEGTK_CALLBACK_0(FontsPageGtk, void, OnDefaultEncodingChanged);

  // The font chooser widgets
  GtkWidget* serif_font_button_;
  GtkWidget* sans_font_button_;
  GtkWidget* fixed_font_button_;

  // The default encoding combobox widget.
  GtkWidget* default_encoding_combobox_;
  scoped_ptr<DefaultEncodingComboboxModel> default_encoding_combobox_model_;

  // The widget containing the options for this page.
  GtkWidget* page_;

  // Font name preferences.
  StringPrefMember serif_name_;
  StringPrefMember sans_serif_name_;
  StringPrefMember fixed_width_name_;

  // Font size preferences, in pixels.
  IntegerPrefMember variable_width_size_;
  IntegerPrefMember fixed_width_size_;

  // Default encoding preference.
  StringPrefMember default_encoding_;

  DISALLOW_COPY_AND_ASSIGN(FontsPageGtk);
};

#endif  // CHROME_BROWSER_GTK_OPTIONS_FONTS_PAGE_GTK_H_