blob: a55bb9133c7f9765424c2c2f44c58a6389166c9d (
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
|
// Copyright (c) 2011 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_COMBOBOX_NATIVE_COMBOBOX_GTK_H_
#define VIEWS_CONTROLS_COMBOBOX_NATIVE_COMBOBOX_GTK_H_
#pragma once
#include "ui/base/gtk/gtk_signal.h"
#include "views/controls/combobox/native_combobox_wrapper.h"
#include "views/controls/native_control_gtk.h"
namespace views {
class NativeComboboxGtk : public NativeControlGtk,
public NativeComboboxWrapper {
public:
explicit NativeComboboxGtk(Combobox* combobox);
virtual ~NativeComboboxGtk();
// Overridden from NativeComboboxWrapper:
virtual void UpdateFromModel() OVERRIDE;
virtual void UpdateSelectedItem() OVERRIDE;
virtual void UpdateEnabled() OVERRIDE;
virtual int GetSelectedItem() const OVERRIDE;
virtual bool IsDropdownOpen() const OVERRIDE;
virtual gfx::Size GetPreferredSize() OVERRIDE;
virtual View* GetView() OVERRIDE;
virtual void SetFocus() OVERRIDE;
virtual bool HandleKeyPressed(const views::KeyEvent& event) OVERRIDE;
virtual bool HandleKeyReleased(const views::KeyEvent& event) OVERRIDE;
virtual void HandleFocus() OVERRIDE;
virtual void HandleBlur() OVERRIDE;
virtual gfx::NativeView GetTestingHandle() const OVERRIDE;
protected:
// Overridden from NativeControlGtk:
virtual void CreateNativeControl() OVERRIDE;
virtual void NativeControlCreated(GtkWidget* widget) OVERRIDE;
private:
void SelectionChanged();
void FocusedMenuItemChanged();
CHROMEGTK_CALLBACK_0(NativeComboboxGtk, void, CallChanged);
CHROMEGTK_CALLBACK_0(NativeComboboxGtk, gboolean, CallPopUp);
CHROMEGTK_CALLBACK_1(NativeComboboxGtk, void, CallMenuMoveCurrent,
GtkMenuDirectionType);
// The combobox we are bound to.
Combobox* combobox_;
// The combo box's pop-up menu.
GtkMenu* menu_;
// The preferred size from the last size_request.
gfx::Size preferred_size_;
DISALLOW_COPY_AND_ASSIGN(NativeComboboxGtk);
};
} // namespace views
#endif // VIEWS_CONTROLS_COMBOBOX_NATIVE_COMBOBOX_GTK_H_
|