4bd90011776df63692c89425556c5634b56279b7
[platform/framework/web/crosswalk-tizen.git] / src / runtime / native_window.h
1 // Copyright 2015 Samsung Electronics Co, Ltd. 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 WRT_RUNTIME_NATIVE_WINDOW_H_
6 #define WRT_RUNTIME_NATIVE_WINDOW_H_
7 #include <functional>
8 #include <map>
9
10 #include <Elementary.h>
11
12 namespace wrt {
13
14 class NativeWindow {
15  public:
16   typedef std::function<void(int)> RotationHandler;
17   NativeWindow();
18   virtual ~NativeWindow();
19
20   void Initialize();
21
22   bool initialized() const { return initialized_; }
23   Evas_Object* evas_object() const;
24   void SetContent(Evas_Object* content);
25   void SetRotationLock(int degree);
26   void SetAutoRotation();
27   int AddRotationHandler(RotationHandler handler);
28   void RemoveRotationHandler(int id);
29   int rotation() const { return rotation_; }
30   void Show();
31   void Active();
32   void InActive();
33   void FullScreen(bool enable);
34
35  protected:
36   virtual Evas_Object* CreateWindowInternal() = 0;
37
38  private:
39   static void DidDeleteRequested(void* data, Evas_Object* obj,
40                                  void* event_info);
41   static void DidProfileChanged(void* data, Evas_Object* obj, void* event_info);
42   void DidRotation(int degree);
43   void DidFocusChanged(bool got);
44
45
46   bool initialized_;
47   Evas_Object* window_;
48   Evas_Object* focus_;
49   Evas_Object* content_;
50   int rotation_;
51   int handler_id_;
52   std::map<int, RotationHandler> handler_table_;
53 };
54
55 }  // namespace wrt
56
57
58 #endif  // WRT_RUNTIME_NATIVE_WINDOW_H_