Free Electron
NativeWindow.h
Go to the documentation of this file.
1 /* Copyright (C) 2003-2021 Free Electron Organization
2  Any use of this software requires a license. If a valid license
3  was not distributed with this file, visit freeelectron.org. */
4 
5 /** @file */
6 
7 #ifndef __native_NativeWindow_h__
8 #define __native_NativeWindow_h__
9 
10 namespace fe
11 {
12 namespace ext
13 {
14 
15 /**************************************************************************//**
16  @brief Implementation of a window using the raw native system
17 
18  @ingroup native
19 *//***************************************************************************/
20 class FE_DL_EXPORT NativeWindow:
21  public ChainSignaler,
22  public Initialize<NativeWindow>,
23  virtual public WindowI,
24  virtual public HandlerI
25 {
26  public:
27  NativeWindow(void);
28 virtual ~NativeWindow(void);
29  void initialize(void);
30  void startup(void);
31 
32  //* As WindowI
33 virtual
34 const Box2i& geometry(void) { return m_box; }
35 virtual void setPosition(I32 x,I32 y)
36  { set(m_box,x,y); }
37 virtual void setSize(U32 x,U32 y)
38  { resize(m_box,I32(x),I32(y)); }
39 virtual void setTitle(const String &title);
40 
41 virtual Result open(const String title);
42 virtual Result close(void);
43 
44 virtual void makeCurrent(void);
45 virtual void releaseCurrent(void);
46 virtual void setBackground(const Color& color);
47 virtual const Color& background(void) const;
48 virtual void clear(void);
49 virtual void swapBuffers(void);
50 
51 virtual sp<Component> getEventContextI(void) { return m_spEventContextI;}
52 
53  //* As HandlerI
54 virtual void handleBind(sp<SignalerI> spSignalerI,
55  sp<Layout> spLayout);
56 virtual void handle(Record &record);
57 
58  //* As NativeWindow
59 
60  /** @brief Get the native format window handle
61 
62  @internal */
63  FE_WINDOW_HANDLE* windowHandle(void) { return &m_windowHandle; }
64  /** @brief Set the native format window handle
65 
66  @internal */
67  void setWindowHandle(const FE_WINDOW_HANDLE &set)
68  { memcpy(&m_windowHandle,&set,
69  sizeof(FE_WINDOW_HANDLE));}
70 
71  /// @internal
72  BWORD created(void) { return m_created; }
73  /// @internal
74  BWORD mapped(void) { return m_mapped; }
75 
76  /// @internal
77  void setPointerMotion(BWORD active);
78 
79  private:
80  /// @internal
81  void setCreated(BWORD set) { m_created=set; }
82  /// @internal
83  void setMapped(BWORD set) { m_mapped=set; }
84 
85  Result nativeInitialize(void);
86  Result nativeStartup(void);
87  Result nativeShutdown(void);
88 
89  void handleEvent(Record &record);
90 
91  Accessor<FE_WINDOW_HANDLE*> m_aWindowHandle;
92 
93  sp<EventContextI> m_spEventContextI;
94  FE_WINDOW_HANDLE m_windowHandle;
95  Box2i m_box;
96  BWORD m_started;
97  BWORD m_created;
98  BWORD m_mapped;
99  BWORD m_lockThreads;
100  WindowEvent m_event;
101  Color m_background;
102  sp<Layout> m_eventLayout;
103 #if FE_2DGL==FE_2D_X_GFX
104  GLXContext m_glxContext;
105 #elif FE_2DGL==FE_2D_GDI
106  void setDCPixelFormat(HDC hdc);
107  HGLRC m_hglrc;
108 #endif
109 };
110 
111 } /* namespace ext */
112 } /* namespace fe */
113 
114 #endif /* __native_NativeWindow_h__ */
BWORD mapped(void)
Definition: NativeWindow.h:74
void setMapped(BWORD set)
Definition: NativeWindow.h:83
FE_WINDOW_HANDLE * windowHandle(void)
Get the native format window handle.
Definition: NativeWindow.h:63
kernel
Definition: namespace.dox:3
Per-class participation in the Initialized <> mechanism.
Definition: Initialized.h:117
The main data access class for the data system.
Definition: Accessor.h:128
Special vector for color (RGBA)
Definition: Color.h:21
Implementation of a window using the raw native system.
Definition: NativeWindow.h:20
void setWindowHandle(const FE_WINDOW_HANDLE &set)
Set the native format window handle.
Definition: NativeWindow.h:67
BWORD created(void)
Definition: NativeWindow.h:72
General interface to a window.
Definition: WindowI.h:24
Interface to handle signals from an SignalerI.
Definition: HandlerI.h:22
Generalized windowing event.
Definition: WindowEvent.h:43
Automatically reference-counted string container.
Definition: String.h:128
void setCreated(BWORD set)
Definition: NativeWindow.h:81
Result
Generalized return value indicating success or failure, and why.
Definition: Result.h:24
Reference to an instance of a Layout.
Definition: RecordSB.h:35
Intrusive Smart Pointer.
Definition: src/core/ptr.h:53
SignalerI that calls registered HandlerI instances in order.
Definition: ChainSignaler.h:29