blob: 199fb23d8bc5da7b7b3bb4f4b7cfdb6253880cc1 (
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
|
// 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 CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_VIEW_GTK_H_
#define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_VIEW_GTK_H_
#include <gtk/gtk.h>
#include <string>
#include "base/basictypes.h"
#include "base/scoped_ptr.h"
#include "chrome/browser/autocomplete/autocomplete.h"
#include "chrome/browser/autocomplete/autocomplete_popup_view.h"
#include "webkit/glue/window_open_disposition.h"
class AutocompleteEditModel;
class AutocompleteEditViewGtk;
class AutocompletePopupModel;
class Profile;
class SkBitmap;
class AutocompletePopupViewGtk : public AutocompletePopupView {
public:
AutocompletePopupViewGtk(AutocompleteEditViewGtk* edit_view,
AutocompleteEditModel* edit_model,
Profile* profile);
~AutocompletePopupViewGtk();
// Implement the AutocompletePopupView interface.
virtual bool IsOpen() const { return opened_; }
virtual void InvalidateLine(size_t line);
virtual void UpdatePopupAppearance();
virtual void OnHoverEnabledOrDisabled(bool disabled);
virtual void PaintUpdatesNow();
virtual AutocompletePopupModel* GetModel();
private:
void Show(size_t num_results);
void Hide();
static gboolean HandleExposeThunk(GtkWidget* widget, GdkEventExpose* event,
gpointer userdata) {
return reinterpret_cast<AutocompletePopupViewGtk*>(userdata)->
HandleExpose(widget, event);
}
gboolean HandleExpose(GtkWidget* widget, GdkEventExpose* event);
scoped_ptr<AutocompletePopupModel> model_;
AutocompleteEditViewGtk* edit_view_;
// Our popup window, which is the only widget used, and we paint it on our
// own. This widget shouldn't be exposed outside of this class.
GtkWidget* window_;
// The graphics context created from the window, cached across exposes.
GdkGC* gc_;
// The pango layout object created from the window, cached across exposes.
PangoLayout* layout_;
// Whether our popup is currently open / shown, or closed / hidden.
bool opened_;
DISALLOW_COPY_AND_ASSIGN(AutocompletePopupViewGtk);
};
#endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_VIEW_GTK_H_
|