[email protected] | bdfde861c | 2009-03-10 12:35:31 | [diff] [blame] | 1 | // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_VIEW_GTK_H_ |
| 6 | #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_VIEW_GTK_H_ |
| 7 | |
| 8 | #include <gtk/gtk.h> |
| 9 | |
| 10 | #include <string> |
| 11 | |
| 12 | #include "base/basictypes.h" |
| 13 | #include "base/scoped_ptr.h" |
| 14 | #include "chrome/browser/autocomplete/autocomplete.h" |
| 15 | #include "chrome/browser/autocomplete/autocomplete_popup_view.h" |
| 16 | #include "webkit/glue/window_open_disposition.h" |
| 17 | |
[email protected] | bdfde861c | 2009-03-10 12:35:31 | [diff] [blame] | 18 | class AutocompleteEditModel; |
| 19 | class AutocompleteEditViewGtk; |
[email protected] | f41290e | 2009-04-09 10:21:57 | [diff] [blame] | 20 | class AutocompletePopupModel; |
[email protected] | bdfde861c | 2009-03-10 12:35:31 | [diff] [blame] | 21 | class Profile; |
| 22 | class SkBitmap; |
| 23 | |
| 24 | class AutocompletePopupViewGtk : public AutocompletePopupView { |
| 25 | public: |
| 26 | AutocompletePopupViewGtk(AutocompleteEditViewGtk* edit_view, |
| 27 | AutocompleteEditModel* edit_model, |
| 28 | Profile* profile); |
| 29 | ~AutocompletePopupViewGtk(); |
| 30 | |
| 31 | // Implement the AutocompletePopupView interface. |
| 32 | virtual bool IsOpen() const { return opened_; } |
| 33 | virtual void InvalidateLine(size_t line); |
| 34 | virtual void UpdatePopupAppearance(); |
| 35 | virtual void OnHoverEnabledOrDisabled(bool disabled); |
| 36 | virtual void PaintUpdatesNow(); |
[email protected] | 252a08e | 2009-04-10 20:59:18 | [diff] [blame^] | 37 | virtual AutocompletePopupModel* GetModel(); |
[email protected] | bdfde861c | 2009-03-10 12:35:31 | [diff] [blame] | 38 | |
| 39 | private: |
[email protected] | f41290e | 2009-04-09 10:21:57 | [diff] [blame] | 40 | void Show(size_t num_results); |
[email protected] | bdfde861c | 2009-03-10 12:35:31 | [diff] [blame] | 41 | void Hide(); |
| 42 | |
[email protected] | f41290e | 2009-04-09 10:21:57 | [diff] [blame] | 43 | static gboolean HandleExposeThunk(GtkWidget* widget, GdkEventExpose* event, |
| 44 | gpointer userdata) { |
| 45 | return reinterpret_cast<AutocompletePopupViewGtk*>(userdata)-> |
| 46 | HandleExpose(widget, event); |
| 47 | } |
| 48 | |
| 49 | gboolean HandleExpose(GtkWidget* widget, GdkEventExpose* event); |
| 50 | |
| 51 | PangoFontDescription* font_; |
| 52 | |
[email protected] | bdfde861c | 2009-03-10 12:35:31 | [diff] [blame] | 53 | scoped_ptr<AutocompletePopupModel> model_; |
| 54 | AutocompleteEditViewGtk* edit_view_; |
| 55 | |
| 56 | GtkWidget* window_; |
[email protected] | bdfde861c | 2009-03-10 12:35:31 | [diff] [blame] | 57 | |
| 58 | bool opened_; |
| 59 | |
| 60 | DISALLOW_COPY_AND_ASSIGN(AutocompletePopupViewGtk); |
| 61 | }; |
| 62 | |
| 63 | #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_VIEW_GTK_H_ |