Window.h 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730
  1. #ifndef Window_H
  2. #define Window_H
  3. #include "Array.h"
  4. #include "Drawing.h"
  5. namespace Framework
  6. {
  7. class VScrollBar; //! Scroll.h
  8. class HScrollBar; //! Scroll.h
  9. class TextField; //! TextField.h
  10. class Border; //! Border.h
  11. class Screen; //! Screen.h
  12. class AlphaField; //! AlphaField.h
  13. class Font; //! Font.h
  14. class Text; //! Text.h
  15. class Image; //! Image.h
  16. class NativeWindow; //! from this file
  17. class NativeWindowArray; //! from this file
  18. class Window; //! from this file
  19. #ifdef WIN32
  20. //! Creates a normal window class of the Windows API
  21. //! \param hInst The HINSTANCE of the program (passed by the Framework to
  22. //! the start function in the Startparam structure)
  23. DLLEXPORT WNDCLASS F_Normal(HINSTANCE hInst);
  24. //! Creates a normal window class of the Windows API
  25. //! \param hInst The HINSTANCE of the program (passed by the Framework to
  26. //! the start function in the Startparam structure)
  27. DLLEXPORT WNDCLASSEX F_NormalEx(HINSTANCE hInst);
  28. //! Framework function that processes all messages from Windows or other
  29. //! processes
  30. DLLEXPORT LRESULT CALLBACK WindowProc(
  31. HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam);
  32. //! Starts a loop that processes user input. The loop runs until
  33. //! StopMessageLoop is called somewhere in the program
  34. DLLEXPORT void StartMessageLoop();
  35. //! Stops the execution of the framework's message loop.
  36. //! \param hwnd A handle to any framework window that can receive
  37. //! messages. Required to send a message so that StartMessageLoop
  38. //! stops waiting and exits immediately
  39. DLLEXPORT void StopMessageLoop(HWND hwnd);
  40. //! Translates a keycode sent by Windows into the character of the
  41. //! pressed key
  42. DLLEXPORT void CalculateEnteredString(
  43. int virtualKeyCode, int scanCode, KeyboardEvent& te);
  44. //! Class for a Windows API window
  45. class NativeWindow : public virtual ReferenceCounter
  46. {
  47. private:
  48. HWND hWnd; //! Handle to the window
  49. int style;
  50. void* makParam;
  51. void* sakParam;
  52. void* takParam;
  53. MouseAction mouseAction;
  54. std::function<void(void*, void*)> preCloseAction;
  55. std::function<void(void*, void*)> postCloseAction;
  56. KeyboardAction keyboardAction;
  57. Screen* screen;
  58. int mx, my;
  59. bool movable;
  60. HWND border;
  61. HBITMAP bitmap;
  62. HDC hdc;
  63. public:
  64. //--Constructor--
  65. DLLEXPORT NativeWindow();
  66. //--Constructor--
  67. //! \param hwnd A handle to the window that should be managed by this
  68. //! class
  69. DLLEXPORT NativeWindow(HWND hWnd);
  70. //--Destructor--
  71. DLLEXPORT ~NativeWindow();
  72. //! Creates the window
  73. //! \param style The style of the window. Example: WS_OVERLAPPEDWINDOW
  74. //! (for a normal window) \param wc The Windows API window class from
  75. //! which a window should be created. Can be created with the F_Normal
  76. //! function. lpszClassName must have been set.
  77. DLLEXPORT void create(int style, WNDCLASS wc);
  78. //! Creates the window
  79. //! \param exStyle The EX style of the window. Example:
  80. //! WS_EX_OVERLAPPEDWINDOW (for a normal window)
  81. //! \param style The style of the window. Example: WS_OVERLAPPEDWINDOW
  82. //! (for a normal window) \param wc The Windows API window class from
  83. //! which a window should be created. Can be created with the F_Normal
  84. //! function. lpszClassName must have been set.
  85. DLLEXPORT void createEx(int exStyle, int style, WNDCLASSEX wc);
  86. //! Sets the display mode of the window
  87. //! \param mod The mode. Example: SW_SHOWNORMAL to show the window
  88. //! and SW_HIDE to minimize it
  89. DLLEXPORT void setDisplayMode(int mod);
  90. //! Sets the focus to the window so that keyboard input is received
  91. DLLEXPORT bool setFocus();
  92. //! Sets the position of the window on the screen
  93. //! \param pos The position in pixels
  94. DLLEXPORT void setPosition(const Point& pos);
  95. //! Sets the position of the window on the screen
  96. //! \param x The X position in pixels
  97. //! \param y The Y position in pixels
  98. DLLEXPORT void setPosition(int x, int y);
  99. //! Sets the size of the window on the screen
  100. //! \param gr\u00f6\u00dfe The size in pixels
  101. DLLEXPORT void setSize(Point& groesse);
  102. //! Sets the size of the window on the screen
  103. //! \param Width The width in pixels
  104. //! \param h\u00f6he The height in pixels
  105. DLLEXPORT void setSize(int Width, int height);
  106. //! Sets the position and size of the window
  107. //! \param pos The position in pixels
  108. //! \param gr\u00f6\u00dfe The size in pixels
  109. DLLEXPORT void setBounds(const Point& pos, const Point& groesse);
  110. //! Sets the screen object used to forward keyboard and mouse input
  111. //! to the framework's objects. Must be called with 0 before the
  112. //! window is destroyed. \param screen The screen object
  113. DLLEXPORT void setScreen(Screen* screen);
  114. //! Destroys the window
  115. DLLEXPORT void destroy();
  116. //! Processes mouse messages. Calls MouseAction and forwards events
  117. //! to the screen with objects if MouseAction returns 1
  118. //! \param me The event triggered by the mouse input
  119. DLLEXPORT void doMouseAction(MouseEvent& me);
  120. //! Calls the pre-close callback function
  121. DLLEXPORT void doPreCloseAction();
  122. //! Calls the post-close callback function
  123. DLLEXPORT void doPostCloseAction();
  124. //! Processes keyboard messages. Calls KeyboardAction and forwards
  125. //! events to the screen with objects if KeyboardAction returns 1
  126. //! \param me The event triggered by the keyboard input
  127. DLLEXPORT void doKeyboardAction(KeyboardEvent& et);
  128. //! Makes the window frame visible if loadBorderWindow was called
  129. DLLEXPORT void doRestoreMessage();
  130. //! Sets the parameter passed to the callback function on a mouse event
  131. //! \param p The parameter
  132. DLLEXPORT void setMouseEventParameter(void* p);
  133. //! Sets the parameter passed to the callback function on close
  134. //! \param p The parameter
  135. DLLEXPORT void setCloseEventParameter(void* p);
  136. //! Sets the parameter passed to the callback function on a keyboard
  137. //! event
  138. //! \param p The parameter
  139. DLLEXPORT void setKeyboardEventParameter(void* p);
  140. //! Sets the callback function to be called on a mouse event.
  141. //! If the callback returns 0 or was not set, the mouse event is not
  142. //! further processed by the window. The standard function __ret1ME
  143. //! can be used, defined in MouseEvent.h and always returns 1
  144. //! \param ak A pointer to the callback function
  145. DLLEXPORT void setMouseAction(MouseAction ak);
  146. //! Sets the callback function to be called before closing.
  147. //! \param ak A pointer to the callback function
  148. DLLEXPORT void setPreCloseAction(std::function<void(void*, void*)> ak);
  149. //! Sets the callback function to be called after closing.
  150. //! \param ak A pointer to the callback function
  151. DLLEXPORT void setPostCloseAction(std::function<void(void*, void*)> ak);
  152. //! Sets the callback function to be called on a keyboard event.
  153. //! If the callback returns 0 or was not set, the keyboard event is not
  154. //! further processed. The standard function __ret1TE can be used,
  155. //! defined in KeyboardEvent.h and always returns 1. Other standard
  156. //! functions are _onlyNumbersTE and _onlyHexTE also from
  157. //! KeyboardEvent.h \param ak A pointer to the callback function
  158. DLLEXPORT void setKeyboardAction(KeyboardAction ak);
  159. //! Sets the handle to the window that should be managed by this class
  160. //! \param hwnd The handle
  161. DLLEXPORT void setWindowHandle(HWND hWnd);
  162. //! Specifies whether the window can be moved by dragging with the mouse
  163. //! \param movable 1 if the window may be moved
  164. DLLEXPORT void setMovable(bool movable);
  165. //! Sets a transparent frame around the window
  166. //! \param zImage An image containing the frame
  167. //! \param hins The HINSTANCE of the program (passed by the Framework to
  168. //! the start function in the Startparam structure)
  169. DLLEXPORT void loadBorderWindow(Image* zImage,
  170. HINSTANCE hinst); //! sets a transparent frame around the window
  171. //! Returns the handle of the managed window
  172. DLLEXPORT HWND getWindowHandle() const;
  173. //! Returns the position of the window in pixels
  174. DLLEXPORT Point getPosition() const;
  175. //! Returns the size of the window in pixels
  176. DLLEXPORT Point getSize() const;
  177. //! Returns the size of the window body in pixels
  178. DLLEXPORT Point getBodySize() const;
  179. //! Returns the width of the window body in pixels
  180. DLLEXPORT int getBodyWidth() const;
  181. //! Returns the height of the window body in pixels
  182. DLLEXPORT int getBodyHeight() const;
  183. //! Returns whether a callback function for a mouse event was set
  184. DLLEXPORT bool hasMouseAction() const;
  185. //! Returns whether a callback function for the event before
  186. //! closing the window was set
  187. DLLEXPORT bool hasPreCloseAction() const;
  188. //! Returns whether a callback function for the event after
  189. //! closing the window was set
  190. DLLEXPORT bool hasPostCloseAction() const;
  191. //! Returns whether a callback function for a keyboard event
  192. //! was set
  193. DLLEXPORT bool hasKeyboardAction() const;
  194. //! Returns the screen to whose drawings the events are forwarded
  195. DLLEXPORT Screen* getScreen() const;
  196. //! Returns the screen without increased reference counter to whose
  197. //! drawings the events are forwarded
  198. DLLEXPORT Screen* zScreen() const;
  199. //! Returns whether the window is movable
  200. DLLEXPORT bool isMovable() const;
  201. };
  202. //! Manages all Windows API windows in the framework
  203. class NativeWindowArray
  204. {
  205. private:
  206. NativeWindowArray* next;
  207. NativeWindow* This;
  208. public:
  209. //! Constructor
  210. DLLEXPORT NativeWindowArray();
  211. //! Destructor
  212. DLLEXPORT ~NativeWindowArray();
  213. //! Adds a new window
  214. //! \param fenster The window
  215. DLLEXPORT bool addWindow(NativeWindow* fenster);
  216. //! Removes a window
  217. //! \param fenster The window
  218. DLLEXPORT bool removeWindow(NativeWindow* fenster);
  219. //! Returns the next element
  220. DLLEXPORT NativeWindowArray* getNext();
  221. //! Sets the next element to 0
  222. DLLEXPORT void setNext0();
  223. //! Deletes the element
  224. DLLEXPORT void del();
  225. //! Sends the pre-close event to a specific window
  226. //! \param hWnd The handle to the window
  227. DLLEXPORT bool sendPreCloseMessage(HWND hWnd);
  228. //! Sends the post-close event to a specific window
  229. //! \param hWnd The handle to the window
  230. DLLEXPORT bool sendPostCloseMessage(HWND hwnd);
  231. //! Sends a mouse event to a specific window
  232. //! \param hWnd The handle to the window
  233. //! \param me The event triggered by the mouse input
  234. DLLEXPORT bool sendMouseMessage(HWND hWnd, MouseEvent& me);
  235. //! Sends a keyboard event to a specific window
  236. //! \param hWnd The handle to the window
  237. //! \param me The event triggered by the keyboard input
  238. DLLEXPORT bool sendKeyboardMessage(HWND hwnd, KeyboardEvent& te);
  239. //! Sends the event triggered by opening the window to a specific
  240. //! window \param hWnd The handle to the window
  241. DLLEXPORT bool sendRestoreMessage(HWND hwnd);
  242. //! Returns the window of this entry
  243. DLLEXPORT NativeWindow* getThis();
  244. };
  245. //! Creates a Windows API popup window with a message
  246. //! \param hWnd A handle to the window that should be blocked until
  247. //! the popup window is closed. Can be 0 \param title The title
  248. //! of the popup window \param meldung The message to display in the
  249. //! window \param style Determines the icon displayed in the window.
  250. //! Example: MB_ICONERROR, MB_ICONINFORMATION
  251. DLLEXPORT void WMessageBox(
  252. HWND hWnd, Text* title, Text* meldung, UINT style);
  253. #endif
  254. //! Window class in the program
  255. class Window : public Drawable
  256. {
  257. public:
  258. class Style : public Drawable::Style
  259. {
  260. public:
  261. //! Determines whether the window body has a background
  262. static const __int64 BodyBackground = 0x000000008;
  263. //! Determines whether alpha blending is used when drawing
  264. //! the body background
  265. static const __int64 BodyBAlpha = 0x000000010;
  266. //! Determines whether an image is used as the body background
  267. static const __int64 BodyBImage = 0x000000020;
  268. //! Determines whether the body has a color gradient
  269. static const __int64 BodyBuffered = 0x000000040;
  270. //! Determines whether the window has a title bar
  271. static const __int64 Title = 0x000000080;
  272. //! Determines whether the title bar has a background
  273. static const __int64 TitleBackground = 0x000000100;
  274. //! Determines whether alpha blending is used when drawing
  275. //! the title background
  276. static const __int64 TitleBAlpha = 0x000000200;
  277. //! Determines whether an image is used for the title background
  278. static const __int64 TitleBImage = 0x000000400;
  279. //! Determines whether the title bar has a color gradient
  280. static const __int64 TitleBuffered = 0x000000800;
  281. //! Determines whether a close button is displayed in the title bar
  282. static const __int64 Closable = 0x000001000;
  283. //! Determines whether the close button has a background
  284. static const __int64 ClosingBackground = 0x000002000;
  285. //! Determines whether alpha blending is used when drawing
  286. //! the close button background
  287. static const __int64 ClosingBAlpha = 0x000004000;
  288. //! Determines whether an image is used for the close button
  289. //! background
  290. static const __int64 ClosingBImage = 0x000008000;
  291. //! Determines whether the close button has a color gradient
  292. static const __int64 ClosingBuffer = 0x000010000;
  293. //! Determines whether the close button has a color gradient
  294. //! while being pressed
  295. static const __int64 ClosingClickBuffer = 0x000020000;
  296. //! Determines whether the user can move the window by holding
  297. //! the left mouse button in the title bar
  298. static const __int64 Movable = 0x000040000;
  299. //! Determines whether the user can change the width of the window
  300. //! by holding the left mouse button on the right or left window
  301. //! edge
  302. static const __int64 WidthChangeable = 0x000080000;
  303. //! Determines whether the user can change the height of the window
  304. //! by holding the left mouse button on the top or bottom window
  305. //! edge
  306. static const __int64 HeightChangeable = 0x000100000;
  307. //! Determines whether the user can change the title bar height
  308. //! by holding the left mouse button on the bottom edge of the title
  309. //! bar
  310. static const __int64 TitleHeightChangeable = 0x000200000;
  311. //! Determines whether there is a minimum window width
  312. static const __int64 MinWidth = 0x000400000;
  313. //! Determines whether there is a maximum window width
  314. static const __int64 MaxWidth = 0x000800000;
  315. //! Determines whether there is a minimum window height
  316. static const __int64 MinHeight = 0x001000000;
  317. //! Determines whether there is a maximum window height
  318. static const __int64 MaxHeight = 0x002000000;
  319. //! Determines whether there is a minimum body width
  320. static const __int64 BodyMinWidth = 0x004000000;
  321. //! Determines whether there is a maximum body width
  322. static const __int64 BodyMaxWidth = 0x008000000;
  323. //! Determines whether there is a minimum body height
  324. static const __int64 BodyMinHeight = 0x010000000;
  325. //! Determines whether there is a maximum body height
  326. static const __int64 BodyMaxHeight = 0x020000000;
  327. //! Determines whether a scrollbar appears at the right window edge
  328. static const __int64 VScroll = 0x040000000;
  329. //! Determines whether a scrollbar appears at the bottom window edge
  330. static const __int64 HScroll = 0x080000000;
  331. //! Determines whether mouse events should also be processed by
  332. //! drawings behind the window
  333. static const __int64 METransparent = 0x100000000;
  334. //! Determines whether the window has a border
  335. static const __int64 Border = 0x200000000;
  336. //! Determines whether the left side of the window is fixed when
  337. //! the size is changeable
  338. static const __int64 LeftPositionFixed = 0x400000000;
  339. //! Determines whether the right side of the window is fixed when
  340. //! the size is changeable
  341. static const __int64 RightPositionFixed = 0x800000000;
  342. //! Determines whether the top side of the window is fixed when
  343. //! the size is changeable
  344. static const __int64 TopPositionFixed = 0x1000000000;
  345. //! Determines whether the bottom side of the window is fixed when
  346. //! the size is changeable
  347. static const __int64 BottomPositionFixed = 0x2000000000;
  348. //! Determines whether the position and size of the title text field
  349. //! should remain unchanged
  350. static const __int64 CustomTitle = 0x4000000000;
  351. //! Combines flags MinHeight, MaxHeight, MaxWidth, MaxHeight
  352. static const __int64 min_max
  353. = MinHeight | MaxHeight | MaxWidth | MaxHeight;
  354. //! Combines flags BodyMinWidth, BodyMaxWidth, BodyMinHeight,
  355. //! BodyMaxWidth
  356. static const __int64 body_min_max
  357. = BodyMinWidth | BodyMaxWidth | BodyMinHeight | BodyMaxWidth;
  358. //! Combines flags VScroll, HScroll
  359. static const __int64 scroll = VScroll | HScroll;
  360. //! Combines flags TitleHeightChangeable, HeightChangeable,
  361. //! WidthChangeable, Movable
  362. static const __int64 notFixed = TitleHeightChangeable
  363. | HeightChangeable | WidthChangeable
  364. | Movable;
  365. //! Combines flags Visible, Enabled, Border, Title,
  366. //! TitleBuffered, Closable, ClosingImage, ClosingClickBuffer,
  367. //! Movable
  368. static const __int64 normal
  369. = Visible | Allowed | Border | Title | TitleBuffered | Closable
  370. | ClosingBImage | ClosingClickBuffer | Movable
  371. | MEIgnoreProcessed | MEIgnoreVisible | MEIgnoreParentInside
  372. | MEIgnoreInside;
  373. };
  374. private:
  375. MouseAction closingMe;
  376. void* closingMeParam;
  377. Border* border;
  378. TextField* title;
  379. RCArray<Drawable>* members;
  380. int bgBodyColor;
  381. Image* bgBodyPicture;
  382. AlphaField* bodyBuffer;
  383. int bgClosingColor;
  384. Image* bgClosingImage;
  385. AlphaField* closeBuffer;
  386. AlphaField* closeClickBuffer;
  387. VScrollBar* vScroll;
  388. HScrollBar* hScroll;
  389. Point min, max;
  390. Point kMin, kMax;
  391. bool closeClick, click;
  392. int moving;
  393. int mx, my;
  394. protected:
  395. //! Processes mouse messages
  396. //! \param me The event triggered by the mouse input
  397. DLLEXPORT void doMouseEvent(MouseEvent& me, bool userRet) override;
  398. public:
  399. //! Constructor
  400. DLLEXPORT Window();
  401. //! Destructor
  402. DLLEXPORT virtual ~Window();
  403. //! Sets a pointer to the window border
  404. //! \param ram The border
  405. DLLEXPORT void setBorderZ(Border* ram);
  406. //! Sets the color of the window border
  407. //! \param f The color in A8R8G8B8 format
  408. DLLEXPORT void setBorderColor(int f);
  409. //! Sets the width of the window border
  410. //! \param br The width in pixels
  411. DLLEXPORT void setBorderWidth(int br);
  412. //! Sets the title of the window
  413. //! \param txt The text
  414. DLLEXPORT void setTitel(Text* txt);
  415. //! Sets a pointer to the title text
  416. //! \param txt The new text
  417. DLLEXPORT void setTitelZ(Text* txt);
  418. //! Sets the title of the window
  419. //! \param txt The text
  420. DLLEXPORT void setTitel(const char* txt);
  421. //! Sets a pointer to the TextField that draws the title text
  422. //! \param tf The TextField
  423. DLLEXPORT void setTTextFieldZ(TextField* tf);
  424. //! Sets the font used for the title
  425. //! \param font The font
  426. DLLEXPORT void setTFontZ(Font* font);
  427. //! Sets the color of the font used for the title
  428. //! \param f The color in A8R8G8B8 format
  429. DLLEXPORT void setTFontColor(int f);
  430. //! Sets the size of the font used for the title
  431. //! \param gr The height of a line in pixels
  432. DLLEXPORT void setTFontSize(int gr);
  433. //! Sets the background color of the title
  434. //! \param f The color in A8R8G8B8 format
  435. DLLEXPORT void setTBgColor(int f);
  436. //! Sets a pointer to the color gradient of the title
  437. //! \param af The color gradient
  438. DLLEXPORT void setTAlphaFieldZ(AlphaField* af);
  439. //! Sets the color of the color gradient of the title
  440. //! \param f The color in A8R8G8B8 format
  441. DLLEXPORT void setTAfColor(int f);
  442. //! Sets the strength of the color gradient of the title
  443. //! \param st The strength
  444. DLLEXPORT void setTAfStrength(int st);
  445. //! Sets the background image of the title by copying
  446. //! \param b The image to copy
  447. DLLEXPORT void setTBgImage(Image* b);
  448. //! Sets a pointer to the background image of the title
  449. //! \param b The image
  450. DLLEXPORT void setTBgImageZ(Image* b);
  451. //! Sets a pointer to the border of the title
  452. //! \param ram The border
  453. DLLEXPORT void setTBorderZ(Border* ram);
  454. //! Sets the color of the border of the title
  455. //! \param f The color in A8R8G8B8 format
  456. DLLEXPORT void setTBorderColor(int f);
  457. //! Sets the width of the border of the title
  458. //! \param br The width in pixels
  459. DLLEXPORT void setTBorderWidth(int br);
  460. //! Sets the background color of the body
  461. //! \param f The color in A8R8G8B8 format
  462. DLLEXPORT void setBodyBgColor(int f);
  463. //! Sets the background image of the body by copying
  464. //! \param b The image to copy
  465. DLLEXPORT void setBodyBgImage(Image* b);
  466. //! Sets a pointer to the background image of the body
  467. //! \param b The image
  468. DLLEXPORT void setBodyBgImageZ(Image* b);
  469. //! Sets a pointer to the color gradient of the body
  470. //! \param af The color gradient
  471. DLLEXPORT void setBodyAlphaFieldZ(AlphaField* af);
  472. //! Sets the color of the color gradient of the body
  473. //! \param f The color in A8R8G8B8 format
  474. DLLEXPORT void setBodyAfColor(int f);
  475. //! Sets the strength of the color gradient of the body
  476. //! \param st The strength
  477. DLLEXPORT void setBodyAfStrength(int st);
  478. //! Sets the parameter of the callback function called when the close
  479. //! button receives a mouse event \param param The parameter
  480. DLLEXPORT void setClosingMeParam(void* param);
  481. //! Sets the callback function called when the close button receives
  482. //! a mouse event. If the callback returns 0 or was not set, the mouse
  483. //! event is not further processed by the drawing. The window is not
  484. //! closed automatically but should be closed in the callback by calling
  485. //! removeStyle( Window::Style::Visible );
  486. //! \param ak A pointer to the callback function
  487. DLLEXPORT void setClosingMe(MouseAction closingMe);
  488. //! Sets the background color of the close button
  489. //! \param f The color in A8R8G8B8 format
  490. DLLEXPORT void setCloseBgColor(int f);
  491. //! Sets the background image of the close button by copying
  492. //! \param b The image to copy
  493. DLLEXPORT void setCloseBgImage(Image* b);
  494. //! Sets a pointer to the background image of the close button
  495. //! \param b The image
  496. DLLEXPORT void setCloseBgImageZ(Image* b);
  497. //! Sets a pointer to the color gradient of the close button
  498. //! \param af The color gradient
  499. DLLEXPORT void setCloseAlphaFieldZ(AlphaField* af);
  500. //! Sets the color of the color gradient of the close button
  501. //! \param f The color in A8R8G8B8 format
  502. DLLEXPORT void setCloseAfColor(int f);
  503. //! Sets the strength of the color gradient of the close button
  504. //! \param st The strength
  505. DLLEXPORT void setCloseAfStrength(int st);
  506. //! Sets a pointer to the color gradient used when clicking the
  507. //! close button \param af The color gradient
  508. DLLEXPORT void setCloseClickAlphaFieldZ(AlphaField* af);
  509. //! Sets the color of the color gradient used when clicking the
  510. //! close button \param f The color in A8R8G8B8 format
  511. DLLEXPORT void setCloseClickAfColor(int f);
  512. //! Sets the strength of the color gradient used when clicking the
  513. //! close button \param st The strength
  514. DLLEXPORT void setCloseClickAfStrength(int st);
  515. //! Sets the minimum size of the window
  516. //! \param mx The minimum width in pixels
  517. //! \param my The minimum height in pixels
  518. DLLEXPORT void setMin(int mx, int my);
  519. //! Sets the minimum size of the window
  520. //! \param min The minimum width and height in pixels
  521. DLLEXPORT void setMin(const Point& min);
  522. //! Sets the maximum size of the window
  523. //! \param mx The maximum width in pixels
  524. //! \param my The maximum height in pixels
  525. DLLEXPORT void setMax(int mx, int my);
  526. //! Sets the maximum size of the window
  527. //! \param min The maximum width and height in pixels
  528. DLLEXPORT void setMax(const Point& max);
  529. //! Sets the minimum size of the window body
  530. //! \param mx The minimum width in pixels
  531. //! \param my The minimum height in pixels
  532. DLLEXPORT void setBodyMin(int mx, int my);
  533. //! Sets the minimum size of the window body
  534. //! \param min The minimum width and height in pixels
  535. DLLEXPORT void setBodyMin(const Point& min);
  536. //! Sets the maximum size of the window body
  537. //! \param mx The maximum width in pixels
  538. //! \param my The maximum height in pixels
  539. DLLEXPORT void setBodyMax(int mx, int my);
  540. //! Sets the maximum size of the window body
  541. //! \param min The maximum width and height in pixels
  542. DLLEXPORT void setBodyMax(const Point& max);
  543. //! Sets a pointer to the scrollbar at the bottom of the window
  544. //! \param hScroll The scrollbar
  545. DLLEXPORT void setHScrollBarZ(HScrollBar* hScroll);
  546. //! Sets a pointer to the scrollbar at the right of the window
  547. //! \param vScroll The scrollbar
  548. DLLEXPORT void setVScrollBarZ(VScrollBar* vScroll);
  549. //! Sets the maximum scroll width of the window body
  550. //! \param max The width in pixels
  551. DLLEXPORT void setHSBMax(int max);
  552. //! Sets the maximum scroll height of the window body
  553. //! \param max The height in pixels
  554. DLLEXPORT void setVSBMax(int max);
  555. //! Scrolls to a specific x position in the window body
  556. //! \param scroll The number of pixels the content should be shifted
  557. //! left
  558. DLLEXPORT void setHSBScroll(int scroll);
  559. //! Scrolls to a specific y position in the window body
  560. //! \param scroll The number of pixels the content should be shifted up
  561. DLLEXPORT void setVSBScroll(int scroll);
  562. //! Updates the horizontal scrollbar so that the max scroll size is set
  563. //! to the width of the content
  564. DLLEXPORT void updateHScroll();
  565. //! Updates the vertical scrollbar so that the max scroll size is set to
  566. //! the height of the content
  567. DLLEXPORT void updateVScroll();
  568. //! Adds a drawing to the window
  569. //! \param obj The drawing
  570. DLLEXPORT virtual void addMember(Drawable* obj);
  571. //! sets the position of a member to index. This changes the order of
  572. //! rendering and the order input events are processed
  573. DLLEXPORT void setMemberIndex(Drawable* zMember, int index);
  574. //! Removes a drawing from the window
  575. //! \param zObj The drawing (without increased reference counter)
  576. DLLEXPORT virtual void removeMember(Drawable* zObj);
  577. //! Removes all drawings from the window
  578. DLLEXPORT virtual void removeAll();
  579. //! Updates the object. Called by the framework
  580. //! \param tickVal The time in seconds since the last call
  581. //! of this function \return 1 if something changed
  582. //! and the image needs to be redrawn. 0 otherwise
  583. DLLEXPORT bool tick(double tickval) override;
  584. //! Processes keyboard messages
  585. //! \param me The event triggered by the keyboard input
  586. DLLEXPORT void doKeyboardEvent(KeyboardEvent& te) override;
  587. //! Draws the window to zRObj if it is visible
  588. //! \param zRObj The image to draw into
  589. DLLEXPORT void render(Image& zRObj) override;
  590. //! Returns the inner width of the drawing in pixels
  591. DLLEXPORT int getInnerWidth() const override;
  592. //! Returns the inner height of the drawing in pixels
  593. DLLEXPORT int getInnerHeight() const override;
  594. //! Returns the border of the window
  595. DLLEXPORT Border* getBorder() const;
  596. //! Returns the border of the window without increased reference counter
  597. DLLEXPORT Border* zBorder() const;
  598. //! Returns the color of the window border in A8R8G8B8 format
  599. DLLEXPORT int getBorderColor() const;
  600. //! Returns the width of the window border in pixels
  601. DLLEXPORT int getBorderWidth() const;
  602. //! Returns the title of the window
  603. DLLEXPORT Text* getTitel() const;
  604. //! Returns the title of the window without increased reference counter
  605. DLLEXPORT Text* zTitel() const;
  606. //! Returns the TextField used to draw the title
  607. DLLEXPORT TextField* getTTextField() const;
  608. //! Returns the TextField without increased reference counter used
  609. //! to draw the title
  610. DLLEXPORT TextField* zTTextField() const;
  611. //! Returns the font used for the title
  612. DLLEXPORT Font* getTFont() const;
  613. //! Returns the font without increased reference counter used for the
  614. //! title
  615. DLLEXPORT Font* zTFont() const;
  616. //! Returns the font color of the title in A8R8G8B8 format
  617. DLLEXPORT int getTFontColor() const;
  618. //! Returns the height of a line of the title in pixels
  619. DLLEXPORT int getTFontSize() const;
  620. //! Returns the background color of the title in A8R8G8B8 format
  621. DLLEXPORT int getTBgColor() const;
  622. //! Returns the color gradient of the title
  623. DLLEXPORT AlphaField* getTAlphaField() const;
  624. //! Returns the color gradient of the title without increased reference
  625. //! counter
  626. DLLEXPORT AlphaField* zTAlphaField() const;
  627. //! Returns the color of the color gradient of the title in A8R8G8B8
  628. //! format
  629. DLLEXPORT int getTAfColor() const;
  630. //! Returns the strength of the color gradient of the title
  631. DLLEXPORT int getTAfStrength() const;
  632. //! Returns the background image of the title
  633. DLLEXPORT Image* getTBgImage() const;
  634. //! Returns the background image of the title without increased
  635. //! reference counter
  636. DLLEXPORT Image* zTBgImage() const;
  637. //! Returns the border of the title
  638. DLLEXPORT Border* getTBorder() const;
  639. //! Returns the border of the title without increased reference counter
  640. DLLEXPORT Border* zTBorder() const;
  641. //! Returns the color of the title border in A8R8G8B8 format
  642. DLLEXPORT int getTBorderColor() const;
  643. //! Returns the width of the title border
  644. DLLEXPORT int getTBorderWidth() const;
  645. //! Returns the background color of the body
  646. DLLEXPORT int getBodyBgColor() const;
  647. //! Returns the background image of the body
  648. DLLEXPORT Image* getBodyBgImage() const;
  649. //! Returns the background image of the body without increased reference
  650. //! counter
  651. DLLEXPORT Image* zBodyBgImage() const;
  652. //! Returns the color gradient of the body
  653. DLLEXPORT AlphaField* getBodyAlphaField() const;
  654. //! Returns the color gradient of the body without increased reference
  655. //! counter
  656. DLLEXPORT AlphaField* zBodyAlphaField() const;
  657. //! Returns the color of the color gradient of the body in A8R8G8B8
  658. //! format
  659. DLLEXPORT int getBodyAfColor() const;
  660. //! Returns the strength of the color gradient of the body
  661. DLLEXPORT int getBodyAfStrength() const;
  662. //! Returns the background color of the close button in A8R8G8B8 format
  663. DLLEXPORT int getCloseBgColor() const;
  664. //! Returns the background image of the close button
  665. DLLEXPORT Image* getCloseBgImage() const;
  666. //! Returns the background image of the close button without increased
  667. //! reference counter
  668. DLLEXPORT Image* zCloseBgImage() const;
  669. //! Returns the color gradient of the close button
  670. DLLEXPORT AlphaField* getCloseAlphaField() const;
  671. //! Returns the color gradient of the close button without increased
  672. //! reference counter
  673. DLLEXPORT AlphaField* zCloseAlphaField() const;
  674. //! Returns the color of the color gradient of the close button in
  675. //! A8R8G8B8 format
  676. DLLEXPORT int getCloseAfColor() const;
  677. //! Returns the strength of the color gradient of the close button
  678. DLLEXPORT int getCloseAfStrength() const;
  679. //! Returns the color gradient used when the close button is pressed
  680. DLLEXPORT AlphaField* getCloseClickAlphaField() const;
  681. //! Returns the color gradient without increased reference counter
  682. //! used when the close button is pressed
  683. DLLEXPORT AlphaField* zCloseClickAlphaField() const;
  684. //! Returns the color of the color gradient in A8R8G8B8 format
  685. //! used when the close button is pressed
  686. DLLEXPORT int getCloseClickAfColor() const;
  687. //! Returns the strength of the color gradient used when the close
  688. //! button is pressed
  689. DLLEXPORT int getCloseClickAfStrength() const;
  690. //! Returns the minimum window size in pixels
  691. DLLEXPORT const Point& getMin() const;
  692. //! Returns the maximum window size in pixels
  693. DLLEXPORT const Point& getMax() const;
  694. //! Returns the minimum body size in pixels
  695. DLLEXPORT const Point& getBodyMin() const;
  696. //! Returns the maximum body size in pixels
  697. DLLEXPORT const Point& getBodyMax() const;
  698. //! Returns the scrollbar from the right window edge
  699. DLLEXPORT VScrollBar* getVScrollBar() const;
  700. //! Returns the scrollbar from the right window edge without increased
  701. //! reference counter
  702. DLLEXPORT VScrollBar* zVScrollBar() const;
  703. //! Returns the scrollbar from the bottom window edge
  704. DLLEXPORT HScrollBar* getHScrollBar() const;
  705. //! Returns the scrollbar from the bottom window edge without increased
  706. //! reference counter
  707. DLLEXPORT HScrollBar* zHScrollBar() const;
  708. //! Returns a list of drawings contained in the window
  709. DLLEXPORT const RCArray<Drawable>& getMembers() const;
  710. //! Returns the width needed by the children of the window
  711. DLLEXPORT int getNeededChildWidth() const;
  712. //! Returns the height needed by the children of the window
  713. DLLEXPORT int getNeededChildHeight() const;
  714. //! Creates a copy of the window that can be modified without
  715. //! affecting the original
  716. DLLEXPORT Drawable* duplicate() const override;
  717. };
  718. } // namespace Framework
  719. #endif