2
* Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
3
* Copyright (C) 2011 Igalia S.L.
5
* This library is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU Library General Public
7
* License as published by the Free Software Foundation; either
8
* version 2 of the License, or (at your option) any later version.
10
* This library is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
* Library General Public License for more details.
15
* You should have received a copy of the GNU Library General Public License
16
* along with this library; see the file COPYING.LIB. If not, write to
17
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
* Boston, MA 02110-1301, USA.
21
#ifndef GtkPopupMenu_h
22
#define GtkPopupMenu_h
24
#include "GRefPtrGtk.h"
27
#include <wtf/FastAllocBase.h>
28
#include <wtf/Noncopyable.h>
29
#include <wtf/PassOwnPtr.h>
30
#include <wtf/text/WTFString.h>
32
typedef struct _GdkEventKey GdkEventKey;
37
WTF_MAKE_NONCOPYABLE(GtkPopupMenu);
38
WTF_MAKE_FAST_ALLOCATED;
41
static PassOwnPtr<GtkPopupMenu> create()
43
return adoptPtr(new GtkPopupMenu());
48
GtkWidget* platformMenu() const { return m_popup.get(); }
50
void appendSeparator();
51
void appendItem(GtkAction*);
52
void popUp(const IntSize&, const IntPoint&, int itemsCount, int selectedItem, const GdkEvent*);
58
void resetTypeAheadFindState();
59
bool typeAheadFind(GdkEventKey*);
61
static void menuItemActivated(GtkMenuItem*, GtkPopupMenu*);
62
static void menuPositionFunction(GtkMenu*, gint*, gint*, gboolean*, GtkPopupMenu*);
63
static void menuRemoveItem(GtkWidget*, GtkPopupMenu*);
64
static void selectItemCallback(GtkMenuItem*, GtkPopupMenu*);
65
static gboolean keyPressEventCallback(GtkWidget*, GdkEventKey*, GtkPopupMenu*);
67
GRefPtr<GtkWidget> m_popup;
68
IntPoint m_menuPosition;
69
String m_currentSearchString;
70
uint32_t m_previousKeyEventTimestamp;
71
unsigned int m_previousKeyEventCharacter;
72
GtkWidget* m_currentlySelectedMenuItem;
73
unsigned int m_keyPressHandlerID;
78
#endif // GtkPopupMenu_h