~ubuntu-branches/ubuntu/raring/qtwebkit-source/raring-proposed

« back to all changes in this revision

Viewing changes to Source/WebCore/platform/gtk/GtkPopupMenu.h

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2013-02-18 14:24:18 UTC
  • Revision ID: package-import@ubuntu.com-20130218142418-eon0jmjg3nj438uy
Tags: upstream-2.3
ImportĀ upstreamĀ versionĀ 2.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
 
3
 * Copyright (C) 2011 Igalia S.L.
 
4
 *
 
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.
 
9
 *
 
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.
 
14
 *
 
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.
 
19
 */
 
20
 
 
21
#ifndef GtkPopupMenu_h
 
22
#define GtkPopupMenu_h
 
23
 
 
24
#include "GRefPtrGtk.h"
 
25
#include "IntPoint.h"
 
26
#include "IntSize.h"
 
27
#include <wtf/FastAllocBase.h>
 
28
#include <wtf/Noncopyable.h>
 
29
#include <wtf/PassOwnPtr.h>
 
30
#include <wtf/text/WTFString.h>
 
31
 
 
32
typedef struct _GdkEventKey GdkEventKey;
 
33
 
 
34
namespace WebCore {
 
35
 
 
36
class GtkPopupMenu {
 
37
    WTF_MAKE_NONCOPYABLE(GtkPopupMenu);
 
38
    WTF_MAKE_FAST_ALLOCATED;
 
39
 
 
40
public:
 
41
    static PassOwnPtr<GtkPopupMenu> create()
 
42
    {
 
43
        return adoptPtr(new GtkPopupMenu());
 
44
    }
 
45
 
 
46
    ~GtkPopupMenu();
 
47
 
 
48
    GtkWidget* platformMenu() const { return m_popup.get(); }
 
49
    void clear();
 
50
    void appendSeparator();
 
51
    void appendItem(GtkAction*);
 
52
    void popUp(const IntSize&, const IntPoint&, int itemsCount, int selectedItem, const GdkEvent*);
 
53
    void popDown();
 
54
 
 
55
private:
 
56
    GtkPopupMenu();
 
57
 
 
58
    void resetTypeAheadFindState();
 
59
    bool typeAheadFind(GdkEventKey*);
 
60
 
 
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*);
 
66
 
 
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;
 
74
};
 
75
 
 
76
}
 
77
 
 
78
#endif // GtkPopupMenu_h