OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_GTK_OPTIONS_OPTIONS_LAYOUT_GTK_H_ | 5 #ifndef CHROME_BROWSER_GTK_OPTIONS_OPTIONS_LAYOUT_GTK_H_ |
6 #define CHROME_BROWSER_GTK_OPTIONS_OPTIONS_LAYOUT_GTK_H_ | 6 #define CHROME_BROWSER_GTK_OPTIONS_OPTIONS_LAYOUT_GTK_H_ |
7 | 7 |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 | 12 |
13 class OptionsLayoutBuilderGtk { | 13 class OptionsLayoutBuilderGtk { |
14 public: | 14 public: |
15 explicit OptionsLayoutBuilderGtk(); | |
16 | |
17 GtkWidget* get_page_widget() { | 15 GtkWidget* get_page_widget() { |
18 return page_; | 16 return page_; |
19 } | 17 } |
20 | 18 |
21 // Adds an option group to the table. Handles layout and labels the group | 19 // Adds an option group to the table. Handles layout and the placing of |
22 // with the given title. If expandable is true, the content widget will be | 20 // separators between groups. If expandable is true, the content widget will |
23 // allowed to expand and fill any extra space when the dialog is resized. | 21 // be allowed to expand and fill any extra space when the dialog is resized. |
24 void AddOptionGroup(const std::string& title, GtkWidget* content, | 22 virtual void AddOptionGroup(const std::string& title, GtkWidget* content, |
25 bool expandable); | 23 bool expandable) = 0; |
26 | 24 |
27 // Adds a widget without title or special layout. If expandable is true, the | 25 // Adds a widget without title or special layout. If expandable is true, the |
28 // content widget will be allowed to expand and fill any extra space when the | 26 // content widget will be allowed to expand and fill any extra space when the |
29 // dialog is resized. | 27 // dialog is resized. |
30 void AddWidget(GtkWidget* content, bool expandable); | 28 virtual void AddWidget(GtkWidget* content, bool expandable) = 0; |
31 | 29 |
32 private: | 30 // Creates a default option layout builder. The default layout builder |
| 31 // follows the GNOME HIG. |
| 32 static OptionsLayoutBuilderGtk* Create(); |
| 33 |
| 34 // Creates a compact option layout builder, if the screen is compact. |
| 35 // Otherwise, creates a default one. |
| 36 static OptionsLayoutBuilderGtk* CreateOptionallyCompactLayout(); |
| 37 |
| 38 protected: |
33 // The parent widget | 39 // The parent widget |
34 GtkWidget* page_; | 40 GtkWidget* page_; |
35 | 41 |
36 DISALLOW_COPY_AND_ASSIGN(OptionsLayoutBuilderGtk); | |
37 }; | 42 }; |
38 | 43 |
39 #endif // CHROME_BROWSER_GTK_OPTIONS_OPTIONS_LAYOUT_GTK_H_ | 44 #endif // CHROME_BROWSER_GTK_OPTIONS_OPTIONS_LAYOUT_GTK_H_ |
OLD | NEW |