UIMLView.h 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591
  1. #pragma once
  2. #include "Array.h"
  3. #include "Trie.h"
  4. #include "UIInitialization.h"
  5. #include "XML.h"
  6. #include "Drawing.h"
  7. namespace Framework
  8. {
  9. class Text;
  10. class ObjTabelle;
  11. class Schrift;
  12. class Bildschirm;
  13. class UIMLContainer;
  14. /**
  15. creates a Zeichnung that views an element of the uiml
  16. tag: defined by subclasses;
  17. basic attributes:
  18. - (__int64) style: sets the style. Default: TextField::Style::TextField
  19. + 0x...: will be interpreted as hex
  20. # ...: will be interpreted as normal __int64
  21. - (string) text-align-horizontal:
  22. + center: adds the style TextFeld::Style::HCenter
  23. - (string) text-align-vertical:
  24. + center: adds the style TextFeld::Style::VCenter
  25. - (int) font-size: sets the font size
  26. - (int) text-color: sets the text color format: 0xAARRGGBB
  27. - disabled: removes the style TextFeld::Style::Editierbar
  28. - (string) width: sets the with
  29. + (int)%: specifies the width in % of the parent element
  30. + (int): specifies the width in pixel
  31. + (expression): calculates the width from an expression that contains
  32. values concatenated by the operators +, -, / or *
  33. + auto: attribute will be ignored here and may be handled by the
  34. subclasses
  35. - (string) height: sets the with
  36. + (int)%: specifies the width in % of the parent element
  37. + (int): specifies the width in pixel
  38. + (expression): calculates the width from an expression that contains
  39. values concatenated by the operators +, -, / or *
  40. + auto: attribute will be ignored here and may be handled by the
  41. subclasses
  42. - (string) align-x: sets the x coordinate of the view. The value of
  43. margin-x will be added
  44. + start: 0
  45. + end: parentWidth
  46. + center: parentWidth / 2 - width / 2
  47. + id of other element: other element x
  48. - (string) margin-x: only available if align-x is specified.
  49. + (int)%: specifies the distance to its x aligned coordinate in
  50. percentage of parentWidth
  51. + (int): specifies the distance to its x aligned coordinate in pixel
  52. + (expression): calculates the distance from an expression that
  53. contains values concatenated by the operators +, -, / or *
  54. - (string) align-y: sets the y coordinate of the view. The value of
  55. margin-y will be added
  56. + start: 0
  57. + end: parentWidth
  58. + center: parentHeight / 2 - height / 2
  59. + id of other element: other element y
  60. - (string) margin-y: only available if align-y is specified.
  61. + (int)%: specifies the distance to its y aligned coordinate in
  62. percentage of parentHeight
  63. + (int): specifies the distance to its y aligned coordinate in pixel
  64. + (expression): calculates the distance from an expression that
  65. contains values concatenated by the operators +, -, / or *
  66. - (string) align-left: sets the x coordinate of the view. The value of
  67. margin-left will be added. Will be ignored when align-x is present.
  68. + start: 0
  69. + end: parentWidth
  70. + center: parentWidth / 2 - width / 2
  71. + id of other element: other element x + other element width
  72. - (string) margin-left: only available if align-left is specified.
  73. + (int)%: specifies the distance to its left aligned coordinate in
  74. percentage of parentWidth
  75. + (int): specifies the distance to its left aligned coordinate in
  76. pixel
  77. + (expression): calculates the distance from an expression that
  78. contains values concatenated by the operators +, -, / or *
  79. - (string) align-right: sets the x coordinate of the view. The value of
  80. margin-right will be subtracted. Will be ignored when align-x or
  81. align-left is present.
  82. + start: -width
  83. + end: parentWidth - width
  84. + center: parentWidth / 2 - width / 2
  85. + id of other element: other element x - width
  86. - (string) margin-right: only available if align-right is specified.
  87. + (int)%: specifies the distance to its right aligned coordinate in
  88. percentage of parentWidth
  89. + (int): specifies the distance to its right aligned coordinate in
  90. pixel
  91. + (expression): calculates the distance from an expression that
  92. contains values concatenated by the operators +, -, / or *
  93. - (string) align-top: sets the y coordinate of the view. The value of
  94. margin-top will be added. Will be ignored when align-y is present.
  95. + start: 0
  96. + end: parentHeight
  97. + center: parentHeight / 2 - height / 2
  98. + id of other element: other element y + other element height
  99. - (string) margin-top: only available if align-top is specified.
  100. + (int)%: specifies the distance to its top aligned coordinate in
  101. percentage of parentHeight
  102. + (int): specifies the distance to its top aligned coordinate in pixel
  103. + (expression): calculates the distance from an expression that
  104. contains values concatenated by the operators +, -, / or *
  105. - (string) align-bottom: sets the y coordinate of the view. The value of
  106. margin-bottom will be subtracted. Will be ignored when align-y or
  107. align-top is present.
  108. + start: -height
  109. + end: parentHeight - height
  110. + center: parentHeight / 2 - height / 2
  111. + id of other element: other element y - height
  112. - (string) margin-bottom: only available if align-bottom is specified.
  113. + (int)%: specifies the distance to its bottom aligned coordinate in
  114. percentage of parentHeight
  115. + (int): specifies the distance to its bottom aligned coordinate in
  116. pixel
  117. + (expression): calculates the distance from an expression that
  118. contains values concatenated by the operators +, -, / or *
  119. - (string) x: sets the x coordinate of the view. overwrites align-left
  120. and align-right and align-x
  121. + (int)%: specifies the x coordinate in percentage of parentWidth
  122. + (int): specifies the x coordinate in pixel
  123. + (expression): calculates the x coordinate from an expression that
  124. contains values concatenated by the operators +, -, / or *
  125. - (string) y: sets the y coordinate of the view. overwrites align-top
  126. and align-bottom and align-y
  127. + (int)%: specifies the y coordinate in percentage of parentHeight
  128. + (int): specifies the y coordinate in pixel
  129. + (expression): calculates the y from an expression that contains
  130. values concatenated by the operators +, -, / or *
  131. additional attributes if the created view is an instance of
  132. ZeichnungHintergrund:
  133. - (int) border: width of the border in pixel
  134. - (int) border-color: color of the border format: 0xAARRGGBB
  135. */
  136. class UIMLElement : public virtual ReferenceCounter
  137. {
  138. public:
  139. DLLEXPORT UIMLElement();
  140. DLLEXPORT virtual ~UIMLElement();
  141. //! Checks whether this UIML element is responsible for a specific xml element
  142. virtual bool isApplicableFor(XML::Element& element) = 0;
  143. //! Creates a new Zeichnung for a given xml element
  144. virtual Zeichnung* parseElement(
  145. XML::Element& element, UIMLContainer& generalFactory)
  146. = 0;
  147. //! Updates a Zeichnung with the data of an xml element. Returns
  148. //! false if the Zeichnung could not be updated and needs to be recreated
  149. virtual bool updateElement(
  150. XML::Element& element, Zeichnung& z, UIMLContainer& generalFactory)
  151. = 0;
  152. //! Applies the layout parameters to a Zeichnung
  153. DLLEXPORT virtual void layout(XML::Element& element,
  154. Zeichnung& z,
  155. int pWidth,
  156. int pHeight,
  157. UIMLContainer& generalLayouter);
  158. /// <summary>
  159. /// calculates the size based on a given attribute value. Allowed values
  160. /// are expression with +, -, * or / operators and percentages of
  161. /// parentSize. uses 0 for each invalid part of the expression
  162. /// </summary>
  163. /// <param name="attributeValue">the expression that should be
  164. /// evaluated</param> <param name="parentSize">the size of the parent in
  165. /// pixel</param> <returns>the resulting size in pixel</returns>
  166. DLLEXPORT int calculateSize(Text attributeValue, int parentSize);
  167. // returns an iterator for all children that are elements and need to be
  168. // layouted
  169. // \param element the current element
  170. DLLEXPORT virtual XML::Editor getChildren(XML::Element& element);
  171. };
  172. class UIMLContainer : public UIMLElement
  173. {
  174. public:
  175. DLLEXPORT UIMLContainer();
  176. DLLEXPORT virtual ~UIMLContainer();
  177. virtual Zeichnung* zZeichnungById(const char* id) = 0;
  178. virtual Zeichnung* getZeichnungById(const char* id) = 0;
  179. virtual Text getZeichnungId(Zeichnung& z) = 0;
  180. virtual void removeZeichnung(Zeichnung& z) = 0;
  181. virtual bool registerZeichnung(const char* id, Zeichnung* z) = 0;
  182. virtual const UIInit& getFactory() = 0;
  183. };
  184. /**
  185. creates a TextFeld instance with style TextField::Style::TextField
  186. tag: &lt;textfield&gt;
  187. additional attributes to UIMLElement:
  188. - (__int64) style: sets the style. Default: TextField::Style::TextField
  189. - (string) text-align-horizontal:
  190. + center: adds the style TextFeld::Style::HCenter
  191. - (string) text-align-vertical:
  192. + center: adds the style TextFeld::Style::VCenter
  193. - (int) font-size: sets the font size
  194. - (int) text-color: sets the text color. format: 0xAARRGGBB
  195. - disabled: removes the style TextFeld::Style::Editierbar
  196. - (string) width: sets the with
  197. + auto: setzt the width to the calculated needed width
  198. - (string) height: sets the height
  199. + auto: setzt the height to the calculated needed height
  200. - (string) vScroll: adds a vertical scroll bar
  201. + auto: the max vertical scroll size is set to the needed text height
  202. and the click scroll per pixel will be set to font size
  203. - (int) hScroll: adds a hotizontal scroll bar
  204. + auto: the max horizontal scroll size is set to the needed text width
  205. and the click scroll per pixel will be set to font size
  206. */
  207. class UIMLTextField : public UIMLElement
  208. {
  209. public:
  210. DLLEXPORT UIMLTextField();
  211. DLLEXPORT bool isApplicableFor(XML::Element& element) override;
  212. DLLEXPORT Zeichnung* parseElement(
  213. XML::Element& element, UIMLContainer& generalFactory) override;
  214. DLLEXPORT bool updateElement(XML::Element& element,
  215. Zeichnung& z,
  216. UIMLContainer& generalFactory) override;
  217. DLLEXPORT void layout(XML::Element& element,
  218. Zeichnung& z,
  219. int pWidth,
  220. int pHeight,
  221. UIMLContainer& generalLayouter) override;
  222. };
  223. class UIMLButton : public UIMLElement
  224. {
  225. public:
  226. DLLEXPORT UIMLButton();
  227. DLLEXPORT bool isApplicableFor(XML::Element& element) override;
  228. DLLEXPORT Zeichnung* parseElement(
  229. XML::Element& element, UIMLContainer& generalFactory) override;
  230. DLLEXPORT bool updateElement(XML::Element& element,
  231. Zeichnung& z,
  232. UIMLContainer& generalFactory) override;
  233. DLLEXPORT void layout(XML::Element& element,
  234. Zeichnung& z,
  235. int pWidth,
  236. int pHeight,
  237. UIMLContainer& generalLayouter) override;
  238. };
  239. class UIMLCheck : public UIMLElement
  240. {
  241. public:
  242. DLLEXPORT UIMLCheck();
  243. DLLEXPORT bool isApplicableFor(XML::Element& element) override;
  244. DLLEXPORT Zeichnung* parseElement(
  245. XML::Element& element, UIMLContainer& generalFactory) override;
  246. DLLEXPORT bool updateElement(XML::Element& element,
  247. Zeichnung& z,
  248. UIMLContainer& generalFactory) override;
  249. DLLEXPORT void layout(XML::Element& element,
  250. Zeichnung& z,
  251. int pWidth,
  252. int pHeight,
  253. UIMLContainer& generalLayouter) override;
  254. };
  255. /**
  256. creates a TextFeld instance with style TextField::Style::Text
  257. tag: &lt;text&gt;
  258. additional attributes to UIMLElement:
  259. - (__int64) style: sets the style. Default: TextField::Style::Text
  260. - (string) text-align-horizontal:
  261. + center: adds the style TextFeld::Style::HCenter
  262. - (string) text-align-vertical:
  263. + center: adds the style TextFeld::Style::VCenter
  264. - (int) font-size: sets the font size
  265. - (int) text-color: sets the text color. format: 0xAARRGGBB
  266. - disabled: removes the style TextFeld::Style::Editierbar
  267. - (string) width: sets the with
  268. + auto: setzt the width to the calculated needed width
  269. - (string) height: sets the height
  270. + auto: setzt the height to the calculated needed height
  271. - (string) vScroll: adds a vertical scroll bar
  272. + auto: the max vertical scroll size is set to the needed text height
  273. and the click scroll per pixel will be set to font size
  274. - (int) hScroll: adds a hotizontal scroll bar
  275. + auto: the max horizontal scroll size is set to the needed text width
  276. and the click scroll per pixel will be set to font size
  277. */
  278. class UIMLText : public UIMLElement
  279. {
  280. public:
  281. DLLEXPORT UIMLText();
  282. DLLEXPORT bool isApplicableFor(XML::Element& element) override;
  283. DLLEXPORT Zeichnung* parseElement(
  284. XML::Element& element, UIMLContainer& generalFactory) override;
  285. DLLEXPORT bool updateElement(XML::Element& element,
  286. Zeichnung& z,
  287. UIMLContainer& generalFactory) override;
  288. DLLEXPORT void layout(XML::Element& element,
  289. Zeichnung& z,
  290. int pWidth,
  291. int pHeight,
  292. UIMLContainer& generalLayouter) override;
  293. };
  294. /**
  295. creates a TextFeld instance with style TextField::Style::TextGebiet
  296. tag: &lt;textarea&gt;
  297. additional attributes to UIMLElement:
  298. - (__int64) style: sets the style. Default: TextField::Style::TextGebiet
  299. - (string) text-align-horizontal:
  300. + center: adds the style TextFeld::Style::HCenter
  301. - (string) text-align-vertical:
  302. + center: adds the style TextFeld::Style::VCenter
  303. - (int) font-size: sets the font size
  304. - (int) text-color: sets the text color. format: 0xAARRGGBB
  305. - disabled: removes the style TextFeld::Style::Editierbar
  306. - (string) width: sets the with
  307. + auto: setzt the width to the calculated needed width
  308. - (string) height: sets the height
  309. + auto: setzt the height to the calculated needed height
  310. - (string) vScroll: adds a vertical scroll bar
  311. + auto: the max vertical scroll size is set to the needed text height
  312. and the click scroll per pixel will be set to font size
  313. - (int) hScroll: adds a hotizontal scroll bar
  314. + auto: the max horizontal scroll size is set to the needed text width
  315. and the click scroll per pixel will be set to font size
  316. */
  317. class UIMLTextArea : public UIMLElement
  318. {
  319. public:
  320. DLLEXPORT UIMLTextArea();
  321. DLLEXPORT bool isApplicableFor(XML::Element& element) override;
  322. DLLEXPORT Zeichnung* parseElement(
  323. XML::Element& element, UIMLContainer& generalFactory) override;
  324. DLLEXPORT bool updateElement(XML::Element& element,
  325. Zeichnung& z,
  326. UIMLContainer& generalFactory) override;
  327. DLLEXPORT void layout(XML::Element& element,
  328. Zeichnung& z,
  329. int pWidth,
  330. int pHeight,
  331. UIMLContainer& generalLayouter) override;
  332. };
  333. class UIMLTable : public UIMLElement
  334. {
  335. public:
  336. DLLEXPORT UIMLTable();
  337. DLLEXPORT bool isApplicableFor(XML::Element& element) override;
  338. DLLEXPORT Zeichnung* parseElement(
  339. XML::Element& element, UIMLContainer& generalFactory) override;
  340. DLLEXPORT bool updateElement(XML::Element& element,
  341. Zeichnung& z,
  342. UIMLContainer& generalFactory) override;
  343. DLLEXPORT void layout(XML::Element& element,
  344. Zeichnung& z,
  345. int pWidth,
  346. int pHeight,
  347. UIMLContainer& generalLayouter) override;
  348. virtual XML::Editor getChildren(XML::Element& element) override;
  349. };
  350. /**
  351. creates a Fenster instance
  352. tag: &lt;frame&gt;
  353. additional attributes to UIMLElement:
  354. - (string) title: the title of the window
  355. - (int) title-height: sets the height of the title
  356. - (int) title-font-size: sets the font size of the title
  357. - (int) title-text-color: sets the color of the title. format:
  358. 0xAARRGGBB
  359. - (string) display: specifies the position of child elements
  360. + column: sets the position of child elements vertically below each
  361. other. any align attribute will overwrite this behaviour.
  362. + row: sets the position of the child elements horizontally beneath
  363. each other. any align attribute will overwrite this behaviour.
  364. - (int) gap: the space between each child element. Only valid if display
  365. is specified.
  366. + (int)%: specifies the y coordinate in percentage of parentHeight
  367. + (int): specifies the y coordinate in pixel
  368. + (expression): calculates the width from an expression that contains
  369. values concatenated by the operators +, -, / or *
  370. - (string) vScroll: adds a vertical scroll bar
  371. + auto: the max vertical scroll size is set to the needed child
  372. elements height
  373. - (int) hScroll: adds a hotizontal scroll bar
  374. + auto: the max horizontal scroll size is set to the needed child
  375. elements width
  376. - (string) width: sets the with
  377. + auto: setzt the width to the calculated needed width
  378. - (string) height: sets the height
  379. + auto: setzt the height to the calculated needed height
  380. */
  381. class UIMLFrame : public UIMLElement
  382. {
  383. public:
  384. DLLEXPORT UIMLFrame();
  385. DLLEXPORT bool isApplicableFor(XML::Element& element) override;
  386. DLLEXPORT Zeichnung* parseElement(
  387. XML::Element& element, UIMLContainer& generalFactory) override;
  388. DLLEXPORT bool updateElement(XML::Element& element,
  389. Zeichnung& z,
  390. UIMLContainer& generalFactory) override;
  391. DLLEXPORT void layout(XML::Element& element,
  392. Zeichnung& z,
  393. int pWidth,
  394. int pHeight,
  395. UIMLContainer& generalLayouter) override;
  396. };
  397. /**
  398. Converts uiml views to Zeichnung implementations and renders them.
  399. The attribute id of each element has to be unique or absent.
  400. All implementations of UIMLElement in the framework are supported by
  401. default. Custom elements can be added by calling addKnownElement with a
  402. custom UIMLElement implementation. Look at the documentation of specific
  403. UIMLElement implementations to view all supported attributes.
  404. example:
  405. \code
  406. <view>
  407. <textfield id="element_at_top_left" align-left="start",
  408. align-top="start", margin-left="5", margin-top="5" width="90%"
  409. height="30"/>
  410. <table id="element_below_textfield" align-left="start",
  411. aliign-top="element_at_top_left", margin-left="5", margin-top="5"
  412. width="90%" height="300">
  413. <tr>
  414. <button id="a_button_in_a_table"/>
  415. <textfield id="a_textfield_in_a_table"/>
  416. </tr>
  417. </table>
  418. </view>
  419. \endcode
  420. */
  421. class UIMLView : public ZeichnungHintergrund,
  422. public UIMLContainer
  423. {
  424. public:
  425. class Style : public ZeichnungHintergrund::Style
  426. {
  427. public:
  428. /// <summary>
  429. /// if this style is set, then the mause event action will be
  430. /// overwritten for all member views. The onMemberMouseEvent
  431. /// function will be executed instead. The style needs to be set
  432. /// before the uiml is parsed
  433. /// </summary>
  434. static const int GlobalMouseEvent = 0x01000;
  435. /// <summary>
  436. /// if this style is set, then the keyvord event action will be
  437. /// overwritten for all member views. The onMemberKeybordEvent
  438. /// function will be executed instead. The style needs to be set
  439. /// before the uiml is parsed
  440. /// </summary>
  441. static const int GlobalTastaturEvent = 0x01000;
  442. };
  443. private:
  444. RCArray<UIMLElement> knownElements;
  445. UIInit init;
  446. RCTrie<Zeichnung>* members;
  447. Array<Zeichnung*> memberList;
  448. RCArray<Text> idList;
  449. XML::Element* dom;
  450. int nextId;
  451. std::function<bool(
  452. XML::Element& element, Zeichnung& member, MausEreignis me)>
  453. onMemberMouseEvent;
  454. std::function<bool(
  455. XML::Element& element, Zeichnung& member, TastaturEreignis te)>
  456. onMemberKeyboardEvent;
  457. //! Processes a mouse event. Called automatically by the framework.
  458. //! \param me The event
  459. DLLEXPORT virtual void doMausEreignis(
  460. MausEreignis& me, bool userRet) override;
  461. public:
  462. //! Creates a UIML View
  463. DLLEXPORT UIMLView();
  464. //! Creates a UIML View from a UIML text
  465. //! \param uiml An xml element according to the KSG UIML standard
  466. //! \param init The UI initialization settings
  467. DLLEXPORT UIMLView(XML::Element* uiml, UIInit& init);
  468. //! Creates a UIML View from a UIML text
  469. //! \param uiml An xml text according to the KSG UIML standard
  470. //! \param init The UI initialization settings
  471. DLLEXPORT UIMLView(Text uiml, UIInit& init);
  472. DLLEXPORT ~UIMLView();
  473. /// <summary>
  474. /// sets a function that is executed if a mouse event on a member view
  475. /// occures and the style Style::GlobalMouseEvent is set.
  476. /// The mouse event will be ignored by the view if false is returned.
  477. /// </summary>
  478. /// <param name="onEventAction">the function to execute if a mouse event
  479. /// occures</param>
  480. DLLEXPORT void setOnMemberMouseEvent(std::function<bool(
  481. XML::Element& element, Zeichnung& member, MausEreignis me)>
  482. onEventAction);
  483. /// <summary>
  484. /// sets a function that is executed if a mouse event on a member view
  485. /// occures and the style Style::GlobalTastaturEvent is set.
  486. /// The mouse event will be ignored by the view if false is returned.
  487. /// </summary>
  488. /// <param name="onEventAction">the function to execute if a mouse event
  489. /// occures</param>
  490. DLLEXPORT void setOnMemberKeyboardEvent(std::function<bool(
  491. XML::Element& element, Zeichnung& member, TastaturEreignis te)>
  492. onEventAction);
  493. //! Removes all known elements that can be used in uiml
  494. DLLEXPORT void removeAllKnownElements();
  495. //! Adds a new known element that can then be used in uiml
  496. DLLEXPORT void addKnownElement(UIMLElement* element);
  497. //! Checks whether an xml element is a known uiml element
  498. DLLEXPORT bool isKnownElement(XML::Element* zElement);
  499. //! Sets the content of the view
  500. //! \param uiml An xml element according to the KSG UIML standard
  501. DLLEXPORT void setUIML(XML::Element* uiml);
  502. //! Sets the content of the view
  503. //! \param uiml An xml text according to the KSG UIML standard
  504. DLLEXPORT void setUIML(Text uiml);
  505. //! Updates all drawings according to the specifications in UIML.
  506. //! Drawings of removed elements are removed and new drawings
  507. //! for new elements are created
  508. DLLEXPORT void update();
  509. //! Updates size and position of all drawings according to the
  510. //! specifications in UIML
  511. DLLEXPORT void layout();
  512. //! Adds an element
  513. //! \param uiml An xml text according to the KSG UIML standard representing
  514. //! the new object \return id of the new element
  515. DLLEXPORT Text addMember(Text uiml);
  516. //! Adds an element to a parent element (currently only works
  517. //! with frame objects) \param uiml An xml text according to the KSG UIML
  518. //! standard representing the new object \return id of the new element
  519. DLLEXPORT Text addMember(Text uiml, Text parentId);
  520. //! Removes an element
  521. //! \param id The id of the element
  522. DLLEXPORT void removeMember(Text id);
  523. //! Returns a drawing that has a specific id in uiml
  524. //! \param id The id of the drawing
  525. DLLEXPORT Zeichnung* zZeichnungById(const char* id) override;
  526. //! Returns a drawing that has a specific id in uiml
  527. //! \param id The id of the drawing
  528. DLLEXPORT Zeichnung* getZeichnungById(const char* id) override;
  529. //! Processes a keyboard event. Called automatically by the framework
  530. //! \param te The event
  531. DLLEXPORT virtual void doTastaturEreignis(TastaturEreignis& te);
  532. //! Updates the drawing background
  533. //! \param tickVal The elapsed time in seconds since the last call
  534. //! of this function \return 1 if the image needs to be redrawn. 0 otherwise
  535. DLLEXPORT bool tick(double tickVal) override;
  536. //! Renders the background of a drawing to rObj
  537. DLLEXPORT void render(Bild& rObj) override;
  538. //! Returns the DOM tree without increased reference counter
  539. //! Changes to the DOM tree should be avoided (only changes to
  540. //! attributes of individual elements are allowed)
  541. DLLEXPORT XML::Element* zDom() const;
  542. //! Returns the DOM tree
  543. //! Changes to the DOM tree should be avoided (only changes to
  544. //! attributes of individual elements are allowed)
  545. DLLEXPORT XML::Element* getDom() const;
  546. DLLEXPORT bool isApplicableFor(XML::Element& element) override;
  547. DLLEXPORT Zeichnung* parseElement(
  548. XML::Element& element, UIMLContainer& generalFactory) override;
  549. DLLEXPORT bool updateElement(XML::Element& element,
  550. Zeichnung& z,
  551. UIMLContainer& generalFactory) override;
  552. DLLEXPORT void layout(XML::Element& element,
  553. Zeichnung& z,
  554. int pWidth,
  555. int pHeight,
  556. UIMLContainer& generalLayouter) override;
  557. DLLEXPORT Text getZeichnungId(Zeichnung& z) override;
  558. DLLEXPORT void removeZeichnung(Zeichnung& z) override;
  559. DLLEXPORT bool registerZeichnung(const char* id, Zeichnung* z) override;
  560. DLLEXPORT const UIInit& getFactory() override;
  561. //! calculates the needed size for all content elements to be visible
  562. DLLEXPORT Punkt calculateContentSize();
  563. };
  564. } // namespace Framework