#ifndef GtkPopupMenu_h
#define GtkPopupMenu_h
#include "GRefPtrGtk.h"
#include "IntPoint.h"
#include "IntSize.h"
#include <wtf/FastMalloc.h>
#include <wtf/Noncopyable.h>
#include <wtf/PassOwnPtr.h>
#include <wtf/text/WTFString.h>
typedef struct _GdkEventKey GdkEventKey;
namespace WebCore {
class GtkPopupMenu {
WTF_MAKE_NONCOPYABLE(GtkPopupMenu);
WTF_MAKE_FAST_ALLOCATED;
public:
static PassOwnPtr<GtkPopupMenu> create()
{
return adoptPtr(new GtkPopupMenu());
}
~GtkPopupMenu();
GtkWidget* platformMenu() const { return m_popup.get(); }
void clear();
void appendSeparator();
void appendItem(GtkAction*);
void popUp(const IntSize&, const IntPoint&, int itemsCount, int selectedItem, const GdkEvent*);
void popDown();
private:
GtkPopupMenu();
void resetTypeAheadFindState();
bool typeAheadFind(GdkEventKey*);
static void menuItemActivated(GtkMenuItem*, GtkPopupMenu*);
static void menuPositionFunction(GtkMenu*, gint*, gint*, gboolean*, GtkPopupMenu*);
static void menuRemoveItem(GtkWidget*, GtkPopupMenu*);
static void selectItemCallback(GtkMenuItem*, GtkPopupMenu*);
static gboolean keyPressEventCallback(GtkWidget*, GdkEventKey*, GtkPopupMenu*);
GRefPtr<GtkWidget> m_popup;
IntPoint m_menuPosition;
String m_currentSearchString;
uint32_t m_previousKeyEventTimestamp;
unsigned int m_previousKeyEventCharacter;
GtkWidget* m_currentlySelectedMenuItem;
unsigned int m_keyPressHandlerID;
};
}
#endif // GtkPopupMenu_h