1 /* 2 Package etk provides an Ebitengine tool kit for creating graphical user interfaces. 3 4 # Widgets 5 6 Custom widgets may be created entirely from scratch or may be 7 based on official widgets. 8 9 The following official widgets are available: 10 11 Box - Building block for creating other widgets. 12 Button - Clickable button. 13 Flex - Flexible stack-based layout. Each Flex widget may be oriented horizontally or vertically. 14 Frame - Widget container. All child widgets are displayed at once. Child widgets are not repositioned by default. 15 Grid - Highly customizable cell-based layout. Widgets added to the Grid may span multiple cells. 16 Input - Text input widget. The Input widget is simply a Text widget that also accepts user input. 17 Keyboard - On-screen keyboard. 18 List - List of widgets as selectable items. 19 Select - Dropdown selection widget. 20 Sprite - Resizable image. 21 Text - Text display widget. 22 Window - Widget paging mechanism. Only one widget added to a window is displayed at a time. 23 24 # Input Propagation 25 26 Mouse events are passed to the topmost widget under the mouse. If a widget 27 returns a handled value of false, the event continues to propagate down the 28 stack of widgets under the mouse. 29 30 Clicking or tapping on a widget focuses the widget. This is handled by etk 31 automatically when a widget returns a handled value of true. 32 33 Keyboard events are passed to the focused widget. 34 35 # Focus Propagation 36 37 When attempting to change which widget is focused, etk checks whether the widget 38 to be focused accepts this focus. If it does, the previously focused widget is 39 un-focused. If the widget does not accept the focus, the previously focused 40 widget remains focused. 41 42 # Cursor Unification 43 44 Input events generated by desktop mice and touch screens are unified in etk. 45 These input events are simplified into an image.Point specifying the location 46 of the event and two parameters: clicked and pressed. 47 48 Clicked is true the first frame the mouse event or touch screen event is received. 49 When the mouse click or touch screen tap is released, the widget that was originally 50 clicked or tapped always receives a final event where clicked and pressed are both false. 51 52 # Draw Order 53 54 Each time etk draws a widget it subsequently draws all of the widget's children 55 in the order they are returned. 56 57 # Subpackages 58 59 There are two subpackages in etk: messeji and kibodo. These are available for 60 use without requiring etk. Usually you will not need to reference any 61 subpackages, as etk wraps them to provide widgets with additional features. 62 */ 63 package etk 64