blob: c599bd85613ba1a4fc26b1544da11b55da090f7f [file] [log] [blame]
epoger@google.comec3ed6a2011-07-28 14:26:00 +00001
reed@android.com8a1c16f2008-12-17 15:59:43 +00002/*
epoger@google.comec3ed6a2011-07-28 14:26:00 +00003 * Copyright 2006 The Android Open Source Project
reed@android.com8a1c16f2008-12-17 15:59:43 +00004 *
epoger@google.comec3ed6a2011-07-28 14:26:00 +00005 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
reed@android.com8a1c16f2008-12-17 15:59:43 +00007 */
8
epoger@google.comec3ed6a2011-07-28 14:26:00 +00009
reed@android.com8a1c16f2008-12-17 15:59:43 +000010#ifndef SkOSMenu_DEFINED
11#define SkOSMenu_DEFINED
12
13#include "SkEvent.h"
14#include "SkTDArray.h"
15
16class SkOSMenu {
17public:
18 explicit SkOSMenu(const char title[]);
19 ~SkOSMenu();
20
21 const char* getTitle() const { return fTitle; }
22
23 void appendItem(const char title[], const char eventType[], int32_t eventData);
24
25 // called by SkOSWindow when it receives an OS menu event
26 int countItems() const;
27 const char* getItem(int index, uint32_t* cmdID) const;
28
29 SkEvent* createEvent(uint32_t os_cmd);
30
31private:
32 const char* fTitle;
33
34 struct Item {
35 const char* fTitle;
36 const char* fEventType;
37 uint32_t fEventData;
38 uint32_t fOSCmd; // internal
39 };
40 SkTDArray<Item> fItems;
41
42 // illegal
43 SkOSMenu(const SkOSMenu&);
44 SkOSMenu& operator=(const SkOSMenu&);
45};
46
47#endif
48