blob: 4b609d968d434b2ac3f7469800d0700ce88e6d1a (
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
|
// Copyright (c) 2009 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.
#ifndef VIEWS_CONTROLS_BUTTON_NATIVE_BUTTON_GTK_H_
#define VIEWS_CONTROLS_BUTTON_NATIVE_BUTTON_GTK_H_
#include "views/controls/button/native_button_wrapper.h"
#include "views/controls/native_control_gtk.h"
namespace views {
// A View that hosts a native GTK button.
class NativeButtonGtk : public NativeControlGtk, public NativeButtonWrapper {
public:
explicit NativeButtonGtk(NativeButton* native_button);
virtual ~NativeButtonGtk();
// Overridden from NativeButtonWrapper:
virtual void UpdateLabel();
virtual void UpdateFont();
virtual void UpdateEnabled();
virtual void UpdateDefault();
virtual View* GetView();
virtual void SetFocus();
virtual bool UsesNativeLabel() const;
virtual gfx::NativeView GetTestingHandle() const;
// Overridden from View:
virtual gfx::Size GetPreferredSize();
protected:
virtual void CreateNativeControl();
virtual void NativeControlCreated(GtkWidget* widget);
// Returns true if this button is actually a checkbox or radio button.
virtual bool IsCheckbox() const { return false; }
private:
static void CallClicked(GtkButton* widget, NativeButtonGtk* button);
// Invoked when the user clicks on the button.
void OnClicked();
// The NativeButton we are bound to.
NativeButton* native_button_;
// The preferred size from the last size_request. We save this until we are
// notified that data may have caused the preferred size to change because
// otherwise it seems every time we call gtk_widget_size_request the size
// returned is a little larger (?!).
gfx::Size preferred_size_;
DISALLOW_COPY_AND_ASSIGN(NativeButtonGtk);
};
class NativeCheckboxGtk : public NativeButtonGtk {
public:
explicit NativeCheckboxGtk(Checkbox* checkbox);
private:
virtual void CreateNativeControl();
// Returns true if this button is actually a checkbox or radio button.
virtual bool IsCheckbox() const { return true; }
DISALLOW_COPY_AND_ASSIGN(NativeCheckboxGtk);
};
} // namespace views
#endif // #ifndef VIEWS_CONTROLS_BUTTON_NATIVE_BUTTON_GTK_H_
|