1 /*!
2 	@file
3 	@author		Albert Semenov
4 	@date		02/2010
5 */
6 #ifndef BERKELIUM_WIDGET_H_
7 #define BERKELIUM_WIDGET_H_
8 
9 #include "MyGUI_Prerequest.h"
10 #include "MyGUI_Canvas.h"
11 #include "Buffer.h"
12 
13 namespace Berkelium
14 {
15 	class Window;
16 }
17 
18 namespace MyGUI
19 {
20 
21 	class BerkeliumDelegate;
22 
23 	class MYGUI_EXPORT_DLL BerkeliumWidget :
24 		public Canvas
25 	{
26 		// для вызова закрытого конструктора
27 		friend class BerkeliumWidgetFactory;
28 
29 		MYGUI_RTTI_DERIVED( BerkeliumWidget )
30 
31 	public:
32 		BerkeliumWidget();
33 
34 		void loadURL(const std::string& _url);
35 		Berkelium::Window* getBerkeliumWindow();
36 
37 		void setWindowDelegate(BerkeliumDelegate* _windowDelegate);
38 
39 	protected:
40 		void initialiseOverride() override;
41 		void shutdownOverride() override;
42 
43 		void setPropertyOverride(const std::string& _key, const std::string& _value) override;
44 
45 		void onMouseDrag(int _left, int _top, MouseButton _id) override;
46 		void onMouseMove(int _left, int _top) override;
47 		void onMouseWheel(int _rel) override;
48 		void onMouseButtonPressed(int _left, int _top, MouseButton _id) override;
49 		void onMouseButtonReleased(int _left, int _top, MouseButton _id) override;
50 		void onKeyLostFocus(Widget* _new) override;
51 		void onKeySetFocus(Widget* _old) override;
52 		void onKeyButtonPressed(KeyCode _key, Char _char) override;
53 		void onKeyButtonReleased(KeyCode _key) override;
54 
55 	private:
56 		void notifyUpdateCanvas(Canvas* _canvas, Canvas::Event _event);
57 		void notifyFrameStart(float _time);
58 		void update();
59 		void updateSize();
60 
61 	private:
62 		Berkelium::Window* mWindow;
63 		int mOldWidth;
64 		int mOldHeight;
65 		helpers::Buffer mBuffer;
66 
67 		BerkeliumDelegate* mWindowDelegate;
68 	};
69 
70 } // namespace MyGUI
71 
72 #endif // BERKELIUM_WIDGET_H_
73