Window.h 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718
  1. #ifndef Fenster_H
  2. #define Fenster_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 TextFeld; //! TextField.h
  10. class Rahmen; //! Border.h
  11. class Bildschirm; //! Screen.h
  12. class AlphaFeld; //! AlphaField.h
  13. class Schrift; //! Font.h
  14. class Text; //! Text.h
  15. class Bild; //! Image.h
  16. class WFenster; //! from this file
  17. class WFensterArray; //! from this file
  18. class Fenster; //! 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. //! StopNachrichtenSchleife is called somewhere in the program
  34. DLLEXPORT void StartNachrichtenSchleife();
  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 StartNachrichtenSchleife
  38. //! stops waiting and exits immediately
  39. DLLEXPORT void StopNachrichtenSchleife(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, TastaturEreignis& te);
  44. //! Class for a Windows API window
  45. class WFenster : 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. MausAktion mausAktion;
  54. std::function<void(void*, void*)> vCloseAktion;
  55. std::function<void(void*, void*)> nCloseAktion;
  56. TastaturAktion tastaturAktion;
  57. Bildschirm* screen;
  58. int mx, my;
  59. bool verschiebbar;
  60. HWND rahmen;
  61. HBITMAP bitmap;
  62. HDC hdc;
  63. public:
  64. //--Constructor--
  65. DLLEXPORT WFenster();
  66. //--Constructor--
  67. //! \param hwnd A handle to the window that should be managed by this
  68. //! class
  69. DLLEXPORT WFenster(HWND hWnd);
  70. //--Destructor--
  71. DLLEXPORT ~WFenster();
  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 erstellen(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 erstellenEx(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 setAnzeigeModus(int mod);
  90. //! Sets the focus to the window so that keyboard input is received
  91. DLLEXPORT bool setFokus();
  92. //! Sets the position of the window on the screen
  93. //! \param pos The position in pixels
  94. DLLEXPORT void setPosition(const Punkt& 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(Punkt& groesse);
  102. //! Sets the size of the window on the screen
  103. //! \param breite The width in pixels
  104. //! \param h\u00f6he The height in pixels
  105. DLLEXPORT void setSize(int breite, int hoehe);
  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 Punkt& pos, const Punkt& 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 setBildschirm(Bildschirm* screen);
  114. //! Destroys the window
  115. DLLEXPORT void zerstoeren();
  116. //! Processes mouse messages. Calls MausAktion and forwards events
  117. //! to the screen with objects if MausAktion returns 1
  118. //! \param me The event triggered by the mouse input
  119. DLLEXPORT void doMausAktion(MausEreignis& me);
  120. //! Calls the pre-close callback function
  121. DLLEXPORT void doVSchliessAktion();
  122. //! Calls the post-close callback function
  123. DLLEXPORT void doNSchliessAktion();
  124. //! Processes keyboard messages. Calls TastaturAktion and forwards
  125. //! events to the screen with objects if TastaturAktion returns 1
  126. //! \param me The event triggered by the keyboard input
  127. DLLEXPORT void doTastaturAktion(TastaturEreignis& et);
  128. //! Makes the window frame visible if ladeRahmenFenster 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 setMausEreignisParameter(void* p);
  133. //! Sets the parameter passed to the callback function on close
  134. //! \param p The parameter
  135. DLLEXPORT void setSchliessEreignisParameter(void* p);
  136. //! Sets the parameter passed to the callback function on a keyboard
  137. //! event
  138. //! \param p The parameter
  139. DLLEXPORT void setTastaturEreignisParameter(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 setMausAktion(MausAktion ak);
  146. //! Sets the callback function to be called before closing.
  147. //! \param ak A pointer to the callback function
  148. DLLEXPORT void setVSchliessAktion(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 setNSchliessAktion(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 _nurNummernTE and _nurHexTE also from
  157. //! KeyboardEvent.h \param ak A pointer to the callback function
  158. DLLEXPORT void setTastaturAktion(TastaturAktion ak);
  159. //! Sets the handle to the window that should be managed by this class
  160. //! \param hwnd The handle
  161. DLLEXPORT void setFensterHandle(HWND hWnd);
  162. //! Specifies whether the window can be moved by dragging with the mouse
  163. //! \param verschiebbar 1 if the window may be moved
  164. DLLEXPORT void setVerschiebbar(bool verschiebbar);
  165. //! Sets a transparent frame around the window
  166. //! \param zBild 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 ladeRahmenFenster(Bild* zBild,
  170. HINSTANCE
  171. hinst); //! sets a transparent frame around the window
  172. //! Returns the handle of the managed window
  173. DLLEXPORT HWND getFensterHandle() const;
  174. //! Returns the position of the window in pixels
  175. DLLEXPORT Punkt getPosition() const;
  176. //! Returns the size of the window in pixels
  177. DLLEXPORT Punkt getGroesse() const;
  178. //! Returns the size of the window body in pixels
  179. DLLEXPORT Punkt getKoerperGroesse() const;
  180. //! Returns the width of the window body in pixels
  181. DLLEXPORT int getKoerperBreite() const;
  182. //! Returns the height of the window body in pixels
  183. DLLEXPORT int getKoerperHoehe() const;
  184. //! Returns whether a callback function for a mouse event was set
  185. DLLEXPORT bool hatMausAktion() const;
  186. //! Returns whether a callback function for the event before
  187. //! closing the window was set
  188. DLLEXPORT bool hatVSchliessAktion() const;
  189. //! Returns whether a callback function for the event after
  190. //! closing the window was set
  191. DLLEXPORT bool hatNSchliessAktion() const;
  192. //! Returns whether a callback function for a keyboard event
  193. //! was set
  194. DLLEXPORT bool hatTastaturAktion() const;
  195. //! Returns the screen to whose drawings the events are forwarded
  196. DLLEXPORT Bildschirm* getBildschirm() const;
  197. //! Returns the screen without increased reference counter to whose
  198. //! drawings the events are forwarded
  199. DLLEXPORT Bildschirm* zBildschirm() const;
  200. //! Returns whether the window is movable
  201. DLLEXPORT bool istVerschiebbar() const;
  202. };
  203. //! Manages all Windows API windows in the framework
  204. class WFensterArray
  205. {
  206. private:
  207. WFensterArray* next;
  208. WFenster* This;
  209. public:
  210. //! Constructor
  211. DLLEXPORT WFensterArray();
  212. //! Destructor
  213. DLLEXPORT ~WFensterArray();
  214. //! Adds a new window
  215. //! \param fenster The window
  216. DLLEXPORT bool addFenster(WFenster* fenster);
  217. //! Removes a window
  218. //! \param fenster The window
  219. DLLEXPORT bool removeFenster(WFenster* fenster);
  220. //! Returns the next element
  221. DLLEXPORT WFensterArray* getNext();
  222. //! Sets the next element to 0
  223. DLLEXPORT void setNext0();
  224. //! Deletes the element
  225. DLLEXPORT void del();
  226. //! Sends the pre-close event to a specific window
  227. //! \param hWnd The handle to the window
  228. DLLEXPORT bool sendVSchliessMessage(HWND hWnd);
  229. //! Sends the post-close event to a specific window
  230. //! \param hWnd The handle to the window
  231. DLLEXPORT bool sendNSchliessMessage(HWND hwnd);
  232. //! Sends a mouse event to a specific window
  233. //! \param hWnd The handle to the window
  234. //! \param me The event triggered by the mouse input
  235. DLLEXPORT bool sendMausMessage(HWND hWnd, MausEreignis& me);
  236. //! Sends a keyboard event to a specific window
  237. //! \param hWnd The handle to the window
  238. //! \param me The event triggered by the keyboard input
  239. DLLEXPORT bool sendTastaturMessage(HWND hwnd, TastaturEreignis& te);
  240. //! Sends the event triggered by opening the window to a specific
  241. //! window \param hWnd The handle to the window
  242. DLLEXPORT bool sendRestoreMessage(HWND hwnd);
  243. //! Returns the window of this entry
  244. DLLEXPORT WFenster* getThis();
  245. };
  246. //! Creates a Windows API popup window with a message
  247. //! \param hWnd A handle to the window that should be blocked until
  248. //! the popup window is closed. Can be 0 \param titel The title
  249. //! of the popup window \param meldung The message to display in the
  250. //! window \param style Determines the icon displayed in the window.
  251. //! Example: MB_ICONERROR, MB_ICONINFORMATION
  252. DLLEXPORT void WMessageBox(
  253. HWND hWnd, Text* titel, Text* meldung, UINT style);
  254. #endif
  255. //! Window class in the program
  256. class Fenster : public Zeichnung
  257. {
  258. public:
  259. class Style : public Zeichnung::Style
  260. {
  261. public:
  262. //! Determines whether the window body has a background
  263. static const __int64 BodyHintergrund = 0x000000008;
  264. //! Determines whether alpha blending is used when drawing
  265. //! the body background
  266. static const __int64 BodyHAlpha = 0x000000010;
  267. //! Determines whether an image is used as the body background
  268. static const __int64 BodyHBild = 0x000000020;
  269. //! Determines whether the body has a color gradient
  270. static const __int64 BodyBuffered = 0x000000040;
  271. //! Determines whether the window has a title bar
  272. static const __int64 Titel = 0x000000080;
  273. //! Determines whether the title bar has a background
  274. static const __int64 TitelHintergrund = 0x000000100;
  275. //! Determines whether alpha blending is used when drawing
  276. //! the title background
  277. static const __int64 TitelHAlpha = 0x000000200;
  278. //! Determines whether an image is used for the title background
  279. static const __int64 TitelHBild = 0x000000400;
  280. //! Determines whether the title bar has a color gradient
  281. static const __int64 TitelBuffered = 0x000000800;
  282. //! Determines whether a close button is displayed in the title bar
  283. static const __int64 Closable = 0x000001000;
  284. //! Determines whether the close button has a background
  285. static const __int64 ClosingHintergrund = 0x000002000;
  286. //! Determines whether alpha blending is used when drawing
  287. //! the close button background
  288. static const __int64 ClosingHAlpha = 0x000004000;
  289. //! Determines whether an image is used for the close button background
  290. static const __int64 ClosingHBild = 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 ClosingKlickBuffer = 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 Beweglich = 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 edge
  301. static const __int64 BreiteChangeable = 0x000080000;
  302. //! Determines whether the user can change the height of the window
  303. //! by holding the left mouse button on the top or bottom window edge
  304. static const __int64 HeightChangeable = 0x000100000;
  305. //! Determines whether the user can change the title bar height
  306. //! by holding the left mouse button on the bottom edge of the title bar
  307. static const __int64 TitelHeightChangeable = 0x000200000;
  308. //! Determines whether there is a minimum window width
  309. static const __int64 MinBr = 0x000400000;
  310. //! Determines whether there is a maximum window width
  311. static const __int64 MaxBr = 0x000800000;
  312. //! Determines whether there is a minimum window height
  313. static const __int64 MinHi = 0x001000000;
  314. //! Determines whether there is a maximum window height
  315. static const __int64 MaxHi = 0x002000000;
  316. //! Determines whether there is a minimum body width
  317. static const __int64 BodyMinBr = 0x004000000;
  318. //! Determines whether there is a maximum body width
  319. static const __int64 BodyMaxBr = 0x008000000;
  320. //! Determines whether there is a minimum body height
  321. static const __int64 BodyMinHi = 0x010000000;
  322. //! Determines whether there is a maximum body height
  323. static const __int64 BodyMaxHi = 0x020000000;
  324. //! Determines whether a scrollbar appears at the right window edge
  325. static const __int64 VScroll = 0x040000000;
  326. //! Determines whether a scrollbar appears at the bottom window edge
  327. static const __int64 HScroll = 0x080000000;
  328. //! Determines whether mouse events should also be processed by
  329. //! drawings behind the window
  330. static const __int64 METransparenz = 0x100000000;
  331. //! Determines whether the window has a border
  332. static const __int64 Rahmen = 0x200000000;
  333. //! Determines whether the left side of the window is fixed when
  334. //! the size is changeable
  335. static const __int64 LeftPositionFixed = 0x400000000;
  336. //! Determines whether the right side of the window is fixed when
  337. //! the size is changeable
  338. static const __int64 RightPositionFixed = 0x800000000;
  339. //! Determines whether the top side of the window is fixed when
  340. //! the size is changeable
  341. static const __int64 TopPositionFixed = 0x1000000000;
  342. //! Determines whether the bottom side of the window is fixed when
  343. //! the size is changeable
  344. static const __int64 BottomPositionFixed = 0x2000000000;
  345. //! Determines whether the position and size of the title text field
  346. //! should remain unchanged
  347. static const __int64 CustomTitle = 0x4000000000;
  348. //! Combines flags MinHeight, MaxHeight, MaxWidth, MaxHeight
  349. static const __int64 min_max = MinHi | MaxHi | MaxBr | MaxHi;
  350. //! Combines flags BodyMinWidth, BodyMaxWidth, BodyMinHeight,
  351. //! BodyMaxWidth
  352. static const __int64 body_min_max
  353. = BodyMinBr | BodyMaxBr | BodyMinHi | BodyMaxBr;
  354. //! Combines flags VScroll, HScroll
  355. static const __int64 scroll = VScroll | HScroll;
  356. //! Combines flags TitleHeightChangeable, HeightChangeable,
  357. //! WidthChangeable, Movable
  358. static const __int64 nichtfixiert = TitelHeightChangeable
  359. | HeightChangeable
  360. | BreiteChangeable | Beweglich;
  361. //! Combines flags Visible, Enabled, Border, Title,
  362. //! TitleBuffered, Closable, ClosingImage, ClosingClickBuffer,
  363. //! Movable
  364. static const __int64 normal
  365. = Sichtbar | Erlaubt | Rahmen | Titel | TitelBuffered | Closable
  366. | ClosingHBild | ClosingKlickBuffer | Beweglich
  367. | MEIgnoreVerarbeitet | MEIgnoreSichtbar | MEIgnoreParentInside
  368. | MEIgnoreInside;
  369. };
  370. private:
  371. MausAktion closingMe;
  372. void* closingMeParam;
  373. Rahmen* rahmen;
  374. TextFeld* titel;
  375. RCArray<Zeichnung>* members;
  376. int bgBodyColor;
  377. Bild* bgBodyPicture;
  378. AlphaFeld* bodyBuffer;
  379. int bgClosingFarbe;
  380. Bild* bgClosingBild;
  381. AlphaFeld* closeBuffer;
  382. AlphaFeld* closeKlickBuffer;
  383. VScrollBar* vScroll;
  384. HScrollBar* hScroll;
  385. Punkt min, max;
  386. Punkt kMin, kMax;
  387. bool closeKlick, klick;
  388. int moving;
  389. int mx, my;
  390. protected:
  391. //! Processes mouse messages
  392. //! \param me The event triggered by the mouse input
  393. DLLEXPORT void doMausEreignis(MausEreignis& me, bool userRet) override;
  394. public:
  395. //! Constructor
  396. DLLEXPORT Fenster();
  397. //! Destructor
  398. DLLEXPORT virtual ~Fenster();
  399. //! Sets a pointer to the window border
  400. //! \param ram The border
  401. DLLEXPORT void setRahmenZ(Rahmen* ram);
  402. //! Sets the color of the window border
  403. //! \param f The color in A8R8G8B8 format
  404. DLLEXPORT void setRFarbe(int f);
  405. //! Sets the width of the window border
  406. //! \param br The width in pixels
  407. DLLEXPORT void setRBreite(int br);
  408. //! Sets the title of the window
  409. //! \param txt The text
  410. DLLEXPORT void setTitel(Text* txt);
  411. //! Sets a pointer to the title text
  412. //! \param txt The new text
  413. DLLEXPORT void setTitelZ(Text* txt);
  414. //! Sets the title of the window
  415. //! \param txt The text
  416. DLLEXPORT void setTitel(const char* txt);
  417. //! Sets a pointer to the TextFeld that draws the title text
  418. //! \param tf The TextFeld
  419. DLLEXPORT void setTTextFeldZ(TextFeld* tf);
  420. //! Sets the font used for the title
  421. //! \param schrift The font
  422. DLLEXPORT void setTSchriftZ(Schrift* schrift);
  423. //! Sets the color of the font used for the title
  424. //! \param f The color in A8R8G8B8 format
  425. DLLEXPORT void setTSFarbe(int f);
  426. //! Sets the size of the font used for the title
  427. //! \param gr The height of a line in pixels
  428. DLLEXPORT void setTSSize(int gr);
  429. //! Sets the background color of the title
  430. //! \param f The color in A8R8G8B8 format
  431. DLLEXPORT void setTBgFarbe(int f);
  432. //! Sets a pointer to the color gradient of the title
  433. //! \param af The color gradient
  434. DLLEXPORT void setTAlphaFeldZ(AlphaFeld* af);
  435. //! Sets the color of the color gradient of the title
  436. //! \param f The color in A8R8G8B8 format
  437. DLLEXPORT void setTAfFarbe(int f);
  438. //! Sets the strength of the color gradient of the title
  439. //! \param st The strength
  440. DLLEXPORT void setTAfStrength(int st);
  441. //! Sets the background image of the title by copying
  442. //! \param b The image to copy
  443. DLLEXPORT void setTBgBild(Bild* b);
  444. //! Sets a pointer to the background image of the title
  445. //! \param b The image
  446. DLLEXPORT void setTBgBildZ(Bild* b);
  447. //! Sets a pointer to the border of the title
  448. //! \param ram The border
  449. DLLEXPORT void setTRahmenZ(Rahmen* ram);
  450. //! Sets the color of the border of the title
  451. //! \param f The color in A8R8G8B8 format
  452. DLLEXPORT void setTRFarbe(int f);
  453. //! Sets the width of the border of the title
  454. //! \param br The width in pixels
  455. DLLEXPORT void setTRBreite(int br);
  456. //! Sets the background color of the body
  457. //! \param f The color in A8R8G8B8 format
  458. DLLEXPORT void setKBgFarbe(int f);
  459. //! Sets the background image of the body by copying
  460. //! \param b The image to copy
  461. DLLEXPORT void setKBgBild(Bild* b);
  462. //! Sets a pointer to the background image of the body
  463. //! \param b The image
  464. DLLEXPORT void setKBgBildZ(Bild* b);
  465. //! Sets a pointer to the color gradient of the body
  466. //! \param af The color gradient
  467. DLLEXPORT void setKAlphaFeldZ(AlphaFeld* af);
  468. //! Sets the color of the color gradient of the body
  469. //! \param f The color in A8R8G8B8 format
  470. DLLEXPORT void setKAfFarbe(int f);
  471. //! Sets the strength of the color gradient of the body
  472. //! \param st The strength
  473. DLLEXPORT void setKAfStrength(int st);
  474. //! Sets the parameter of the callback function called when the close
  475. //! button receives a mouse event \param param The parameter
  476. DLLEXPORT void setClosingMeParam(void* param);
  477. //! Sets the callback function called when the close button receives
  478. //! a mouse event. If the callback returns 0 or was not set, the mouse
  479. //! event is not further processed by the drawing. The window is not
  480. //! closed automatically but should be closed in the callback by calling
  481. //! removeStyle( Fenster::Style::Sichtbar );
  482. //! \param ak A pointer to the callback function
  483. DLLEXPORT void setClosingMe(MausAktion closingMe);
  484. //! Sets the background color of the close button
  485. //! \param f The color in A8R8G8B8 format
  486. DLLEXPORT void setSBgFarbe(int f);
  487. //! Sets the background image of the close button by copying
  488. //! \param b The image to copy
  489. DLLEXPORT void setSBgBild(Bild* b);
  490. //! Sets a pointer to the background image of the close button
  491. //! \param b The image
  492. DLLEXPORT void setSBgBildZ(Bild* b);
  493. //! Sets a pointer to the color gradient of the close button
  494. //! \param af The color gradient
  495. DLLEXPORT void setSAlphaFeldZ(AlphaFeld* af);
  496. //! Sets the color of the color gradient of the close button
  497. //! \param f The color in A8R8G8B8 format
  498. DLLEXPORT void setSAfFarbe(int f);
  499. //! Sets the strength of the color gradient of the close button
  500. //! \param st The strength
  501. DLLEXPORT void setSAfStrength(int st);
  502. //! Sets a pointer to the color gradient used when clicking the
  503. //! close button \param af The color gradient
  504. DLLEXPORT void setSKAlphaFeldZ(AlphaFeld* af);
  505. //! Sets the color of the color gradient used when clicking the
  506. //! close button \param f The color in A8R8G8B8 format
  507. DLLEXPORT void setSKAfFarbe(int f);
  508. //! Sets the strength of the color gradient used when clicking the
  509. //! close button \param st The strength
  510. DLLEXPORT void setSKAfStrength(int st);
  511. //! Sets the minimum size of the window
  512. //! \param mx The minimum width in pixels
  513. //! \param my The minimum height in pixels
  514. DLLEXPORT void setMin(int mx, int my);
  515. //! Sets the minimum size of the window
  516. //! \param min The minimum width and height in pixels
  517. DLLEXPORT void setMin(const Punkt& min);
  518. //! Sets the maximum size of the window
  519. //! \param mx The maximum width in pixels
  520. //! \param my The maximum height in pixels
  521. DLLEXPORT void setMax(int mx, int my);
  522. //! Sets the maximum size of the window
  523. //! \param min The maximum width and height in pixels
  524. DLLEXPORT void setMax(const Punkt& max);
  525. //! Sets the minimum size of the window body
  526. //! \param mx The minimum width in pixels
  527. //! \param my The minimum height in pixels
  528. DLLEXPORT void setKMin(int mx, int my);
  529. //! Sets the minimum size of the window body
  530. //! \param min The minimum width and height in pixels
  531. DLLEXPORT void setKMin(const Punkt& min);
  532. //! Sets the maximum size of the window body
  533. //! \param mx The maximum width in pixels
  534. //! \param my The maximum height in pixels
  535. DLLEXPORT void setKMax(int mx, int my);
  536. //! Sets the maximum size of the window body
  537. //! \param min The maximum width and height in pixels
  538. DLLEXPORT void setKMax(const Punkt& max);
  539. //! Sets a pointer to the scrollbar at the bottom of the window
  540. //! \param hScroll The scrollbar
  541. DLLEXPORT void setHScrollBarZ(HScrollBar* hScroll);
  542. //! Sets a pointer to the scrollbar at the right of the window
  543. //! \param vScroll The scrollbar
  544. DLLEXPORT void setVScrollBarZ(VScrollBar* vScroll);
  545. //! Sets the maximum scroll width of the window body
  546. //! \param max The width in pixels
  547. DLLEXPORT void setHSBMax(int max);
  548. //! Sets the maximum scroll height of the window body
  549. //! \param max The height in pixels
  550. DLLEXPORT void setVSBMax(int max);
  551. //! Scrolls to a specific x position in the window body
  552. //! \param scroll The number of pixels the content should be shifted left
  553. DLLEXPORT void setHSBScroll(int scroll);
  554. //! Scrolls to a specific y position in the window body
  555. //! \param scroll The number of pixels the content should be shifted up
  556. DLLEXPORT void setVSBScroll(int scroll);
  557. //! Updates the horizontal scrollbar so that the max scroll size is set
  558. //! to the width of the content
  559. DLLEXPORT void updateHScroll();
  560. //! Updates the vertical scrollbar so that the max scroll size is set to
  561. //! the height of the content
  562. DLLEXPORT void updateVScroll();
  563. //! Adds a drawing to the window
  564. //! \param obj The drawing
  565. DLLEXPORT virtual void addMember(Zeichnung* obj);
  566. //! sets the position of a member to index. This changes the order of
  567. //! rendering and the order input events are processed
  568. DLLEXPORT void setMemberIndex(Zeichnung* zMember, int index);
  569. //! Removes a drawing from the window
  570. //! \param zObj The drawing (without increased reference counter)
  571. DLLEXPORT virtual void removeMember(Zeichnung* zObj);
  572. //! Removes all drawings from the window
  573. DLLEXPORT virtual void removeAll();
  574. //! Updates the object. Called by the framework
  575. //! \param tickVal The time in seconds since the last call
  576. //! of this function \return 1 if something changed
  577. //! and the image needs to be redrawn. 0 otherwise
  578. DLLEXPORT bool tick(double tickval) override;
  579. //! Processes keyboard messages
  580. //! \param me The event triggered by the keyboard input
  581. DLLEXPORT void doTastaturEreignis(TastaturEreignis& te) override;
  582. //! Draws the window to zRObj if it is visible
  583. //! \param zRObj The image to draw into
  584. DLLEXPORT void render(Bild& zRObj) override;
  585. //! Returns the inner width of the drawing in pixels
  586. DLLEXPORT int getInnenBreite() const override;
  587. //! Returns the inner height of the drawing in pixels
  588. DLLEXPORT int getInnenHeight() const override;
  589. //! Returns the border of the window
  590. DLLEXPORT Rahmen* getRahmen() const;
  591. //! Returns the border of the window without increased reference counter
  592. DLLEXPORT Rahmen* zRahmen() const;
  593. //! Returns the color of the window border in A8R8G8B8 format
  594. DLLEXPORT int getRFarbe() const;
  595. //! Returns the width of the window border in pixels
  596. DLLEXPORT int getRBreite() const;
  597. //! Returns the title of the window
  598. DLLEXPORT Text* getTitel() const;
  599. //! Returns the title of the window without increased reference counter
  600. DLLEXPORT Text* zTitel() const;
  601. //! Returns the TextFeld used to draw the title
  602. DLLEXPORT TextFeld* getTTextFeld() const;
  603. //! Returns the TextFeld without increased reference counter used
  604. //! to draw the title
  605. DLLEXPORT TextFeld* zTTextFeld() const;
  606. //! Returns the font used for the title
  607. DLLEXPORT Schrift* getTSchrift() const;
  608. //! Returns the font without increased reference counter used for the title
  609. DLLEXPORT Schrift* zTSchrift() const;
  610. //! Returns the font color of the title in A8R8G8B8 format
  611. DLLEXPORT int getTSFarbe() const;
  612. //! Returns the height of a line of the title in pixels
  613. DLLEXPORT int getTSSize() const;
  614. //! Returns the background color of the title in A8R8G8B8 format
  615. DLLEXPORT int getTBgFarbe() const;
  616. //! Returns the color gradient of the title
  617. DLLEXPORT AlphaFeld* getTAlphaFeld() const;
  618. //! Returns the color gradient of the title without increased reference counter
  619. DLLEXPORT AlphaFeld* zTAlphaFeld() const;
  620. //! Returns the color of the color gradient of the title in A8R8G8B8 format
  621. DLLEXPORT int getTAfFarbe() const;
  622. //! Returns the strength of the color gradient of the title
  623. DLLEXPORT int getTAfStrength() const;
  624. //! Returns the background image of the title
  625. DLLEXPORT Bild* getTBgBild() const;
  626. //! Returns the background image of the title without increased reference counter
  627. DLLEXPORT Bild* zTBgBild() const;
  628. //! Returns the border of the title
  629. DLLEXPORT Rahmen* getTRahmen() const;
  630. //! Returns the border of the title without increased reference counter
  631. DLLEXPORT Rahmen* zTRahmen() const;
  632. //! Returns the color of the title border in A8R8G8B8 format
  633. DLLEXPORT int getTRFarbe() const;
  634. //! Returns the width of the title border
  635. DLLEXPORT int getTRBreite() const;
  636. //! Returns the background color of the body
  637. DLLEXPORT int getKBgFarbe() const;
  638. //! Returns the background image of the body
  639. DLLEXPORT Bild* getKBgBild() const;
  640. //! Returns the background image of the body without increased reference counter
  641. DLLEXPORT Bild* zKBgBild() const;
  642. //! Returns the color gradient of the body
  643. DLLEXPORT AlphaFeld* getKAlphaFeld() const;
  644. //! Returns the color gradient of the body without increased reference counter
  645. DLLEXPORT AlphaFeld* zKAlphaFeld() const;
  646. //! Returns the color of the color gradient of the body in A8R8G8B8 format
  647. DLLEXPORT int getKAfFarbe() const;
  648. //! Returns the strength of the color gradient of the body
  649. DLLEXPORT int getKAfStrength() const;
  650. //! Returns the background color of the close button in A8R8G8B8 format
  651. DLLEXPORT int getSBgFarbe() const;
  652. //! Returns the background image of the close button
  653. DLLEXPORT Bild* getSBgBild() const;
  654. //! Returns the background image of the close button without increased
  655. //! reference counter
  656. DLLEXPORT Bild* zSBgBild() const;
  657. //! Returns the color gradient of the close button
  658. DLLEXPORT AlphaFeld* getSAlphaFeld() const;
  659. //! Returns the color gradient of the close button without increased
  660. //! reference counter
  661. DLLEXPORT AlphaFeld* zSAlphaFeld() const;
  662. //! Returns the color of the color gradient of the close button in
  663. //! A8R8G8B8 format
  664. DLLEXPORT int getSAfFarbe() const;
  665. //! Returns the strength of the color gradient of the close button
  666. DLLEXPORT int getSAfStrength() const;
  667. //! Returns the color gradient used when the close button is pressed
  668. DLLEXPORT AlphaFeld* getSKAlphaFeld() const;
  669. //! Returns the color gradient without increased reference counter
  670. //! used when the close button is pressed
  671. DLLEXPORT AlphaFeld* zSKAlphaFeld() const;
  672. //! Returns the color of the color gradient in A8R8G8B8 format
  673. //! used when the close button is pressed
  674. DLLEXPORT int getSKAfFarbe() const;
  675. //! Returns the strength of the color gradient used when the close
  676. //! button is pressed
  677. DLLEXPORT int getSKAfStrength() const;
  678. //! Returns the minimum window size in pixels
  679. DLLEXPORT const Punkt& getMin() const;
  680. //! Returns the maximum window size in pixels
  681. DLLEXPORT const Punkt& getMax() const;
  682. //! Returns the minimum body size in pixels
  683. DLLEXPORT const Punkt& getKMin() const;
  684. //! Returns the maximum body size in pixels
  685. DLLEXPORT const Punkt& getKMax() const;
  686. //! Returns the scrollbar from the right window edge
  687. DLLEXPORT VScrollBar* getVScrollBar() const;
  688. //! Returns the scrollbar from the right window edge without increased
  689. //! reference counter
  690. DLLEXPORT VScrollBar* zVScrollBar() const;
  691. //! Returns the scrollbar from the bottom window edge
  692. DLLEXPORT HScrollBar* getHScrollBar() const;
  693. //! Returns the scrollbar from the bottom window edge without increased
  694. //! reference counter
  695. DLLEXPORT HScrollBar* zHScrollBar() const;
  696. //! Returns a list of drawings contained in the window
  697. DLLEXPORT const RCArray<Zeichnung>& getMembers() const;
  698. //! Returns the width needed by the children of the window
  699. DLLEXPORT int getNeededChildWidth() const;
  700. //! Returns the height needed by the children of the window
  701. DLLEXPORT int getNeededChildHeight() const;
  702. //! Creates a copy of the window that can be modified without
  703. //! affecting the original
  704. DLLEXPORT Zeichnung* dublizieren() const override;
  705. };
  706. } // namespace Framework
  707. #endif