Commit Graph

63 Commits

Author SHA1 Message Date
e912e2bd03 Go module update 2023-12-08 19:54:43 -08:00
28280f08bd
Merge pull request #1 from SketchyMaze/dependabot/go_modules/golang.org/x/image-0.5.0
Bump golang.org/x/image from 0.0.0-20211028202545-6944b10bf410 to 0.5.0
2023-12-08 19:54:08 -08:00
14bd7446ef
Merge branch 'master' into dependabot/go_modules/golang.org/x/image-0.5.0 2023-12-08 19:54:00 -08:00
98dfa2cce5 Image: add ReplaceFromImage and Destroy to cleanup textures 2023-12-08 19:50:24 -08:00
8716c479e9 ListBox, ScrollBar, Magic Form and forms demo 2023-04-08 21:18:24 -07:00
dependabot[bot]
43b95a9232
Bump golang.org/x/image from 0.0.0-20211028202545-6944b10bf410 to 0.5.0
Bumps [golang.org/x/image](https://github.com/golang/image) from 0.0.0-20211028202545-6944b10bf410 to 0.5.0.
- [Release notes](https://github.com/golang/image/releases)
- [Commits](https://github.com/golang/image/commits/v0.5.0)

---
updated-dependencies:
- dependency-name: golang.org/x/image
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-07 00:10:29 +00:00
d82ef0b751 Checkbox: SetText and better BoolVar watch for CheckButton 2022-10-09 17:41:59 -07:00
c99e79d9b0 Pack() or Place() multiple times updates the config 2022-09-24 18:44:45 -07:00
3b653e503c Window manager: call Close() instead of Hide() so that WindowClose event handlers fire always 2022-04-09 14:19:20 -07:00
c9c7b33647 Tooltips: how to draw on top of all widgets
By default, Tooltips will present after their associated widget presents
(if the mouse cursor is hovering over that widget, and the tooltip
should appear). But the tooltip is not guaranteed to draw "on top" of
neighboring doodads, unless you choose your Edge carefully depending on
the order you're drawing your widgets.

To solve this, Tooltips can be supervised to DrawOnTop() when they're
activated. To opt in, you simply call the Tooltip.Supervise() function
with your supervisor.
2022-03-05 22:41:20 -08:00
76ddda352d Bugfix: Window focus linked list
It used to be possible to confuse the window manager in the
CloseActiveWindow() function and the linked list got all broken. Seems
more reliable now! Added function PrintWindows() to inspect the linked
lists.
2022-02-19 20:14:52 -08:00
49b5cfd037 Cleanup debug code 2022-01-01 18:49:25 -08:00
fee6e1e105 New widget: ColorPicker, plus other changes
New properties are added to EventData for Supervisor events:

* Widget: a reference to the widget which is receiving the event.
* Clicked (bool): for MouseMove events records if the primary button is pressed.
* func RelativePoint(): returns a version of EventData.Point adjusted to be
  relative to the Widget (0,0 at the Widget's absolute position on screen).

Other changes:

* Destroy() method for the Widget interface: widgets that need to free up resources
  on teardown should define this, the BaseWidget provides a no-op implementation.
* Window.Resize() will properly resize a Window.
* Window.Center(w, h int) to easily center a window on screen.
2022-01-01 18:43:36 -08:00
0a6054baa6 TabFrame: SetTabsHidden Option
SetTabsHidden(bool) can hide the tab row on a TabFrame, leaving only the
content frames behind. This way the caller can provide the transition
changes via SetTab and use the TabFrame only for its management
features.
2021-12-26 20:52:13 -08:00
79210ae8c9 Add Supervisor.CloseActiveWindow() 2021-10-06 22:19:43 -07:00
49992aad2a Change URL of GitHub mirror. 2021-10-06 19:50:00 -07:00
e8d4e7008b MouseMove event and increase window title font size 2021-10-03 21:46:36 -07:00
f6703bf1ba Height fix in TabFrame 2021-09-03 20:51:05 -07:00
5d16f5d50c New Widget: TabFrame
* Added the TabFrame widget with an example program and screenshot
* Button: FixedColor=true to set a consistent background color and not
  worry about it with mouseover/down events.
2021-07-25 20:53:09 -07:00
e7e8b4b2c1 Image: defer SDL2 texture loading until Present 2021-07-19 21:23:55 -07:00
b87b4825af Checkbox updates, SelectBox images 2021-06-13 19:59:22 -07:00
9a25ec3782 SelectBox: Ability to set the current value 2021-06-06 14:18:43 -07:00
6df7bade48 Add SelectBox Widget 2021-06-06 13:44:05 -07:00
8f91971b62 Fix MenuButton location for dropdown menu 2021-06-03 19:09:40 -07:00
Noah Petherbridge
ff76b831ad Update example apps and documentation 2021-06-03 12:27:48 -07:00
b7190fe958 Frame: do not draw hidden widgets 2021-01-03 17:05:04 -08:00
c32601391a Add MaxPageButtons to the Pager widget 2020-11-19 20:58:41 -08:00
8433b1b216 Add Size() method to ui.Window that returns the window body size 2020-11-15 18:07:06 -08:00
e2a561fbd0 Add the Pager Widget 2020-07-09 19:31:46 -07:00
0e027a9fee CheckButton Styles, Supervisor fixes 2020-07-09 19:29:44 -07:00
e675ead0ed WIP Themes Support 2020-06-17 18:04:18 -07:00
4206330398 Add Supervisor.GetModal() function 2020-06-04 21:58:45 -07:00
53c0fed7be Merge pull request 'Menus and Menu Bars' (#2) from menus into master 2020-06-05 02:49:26 +00:00
07cefb6499 Menus and Menu Bars
* New and completed widgets: Menu, MenuButton and MenuBar.
* MenuButton is a kind of Button that opens a popup Menu when clicked.
* MenuBar is a container of buttons designed to be attached to the top
  of an application window ("File, Edit, View, Help")
* Supervisor manages the popup menus with its new concept of a Modal
  Widget. Modal widgets take exclusive event priority for all mouse and
  key events. The pop-up menu is a modal window, which means you must
  click an option inside the menu OR clicking outside the menu will
  close it and eat your click event (widgets outside the modal don't
  receive events, but the modal itself gets an event that you've done
  this).
2020-06-04 00:50:23 -07:00
d27636ea48 IsPointInWindow: not in hidden windows 2020-04-21 19:55:57 -07:00
6d6629d3c0 Add helper function IsPointInWindow 2020-04-12 16:49:21 -07:00
36db160533 Window Manager Buttons and Bugfixes
* Fix Supervisor event issues wrt. the window manager feature: if a
  focused window exists and Supervisor is running events for the "other"
  widgets not in managed windows, and the mouse cursor is over the
  rectangle of THE focused window, no widget under the cursor receives
  active (hover, click) events. Prevents being able to click "through"
  the window and interact with widgets and other windows below.
* Adds Close, Maximize and Minimize buttons to windows. Maximize is
  still buggy and Minimize is implementation-defined behavior with no
  default event handler configured.
* eg/windows has an example of the Window Manager for SDL2 and
  WebAssembly targets.
2020-04-08 17:29:04 -07:00
7d9ba79cd2 Window Manager Basics, Work in Progress
* Adds Window Manager support to the Supervisor, so that Window widgets
  can be dragged by their title bar, clicked to focus, etc.
* Create a ui.Window as normal, but instead of Packing or Placing it
  into a parent container as before, you call .Supervise() and give it
  your Supervisor. The window registers itself to be managed and drawn
  by the Supervisor itself.
* Supervisor manages the focused window order using a doubly linked
  list. When a window takes focus it moves to the top of the list.
  Widgets in the active window take event priority.
* Extended DragDrop API to support holding a widget pointer in the drag
  operation.
* Changed widget event Handle functions to return an error: so that they
  could return ErrStopPropagation to prevent events going to more
  widgets once handled (for important events).

Some bugs remain around overlapping windows and event propagation.
2020-04-06 22:57:28 -07:00
49f108f302 Prevent tooltips from clipping outside window boundaries 2020-03-09 22:24:04 -07:00
911585ea4d Update README 2020-03-09 17:32:28 -07:00
fb9127f0d5 Add version number and documentation 2020-03-09 17:29:17 -07:00
f9b305679a Tooltip Widget and Event Refactor
* Tooltip can be added to any target widget (e.g. Button) and pop up on
  mouse over.
* Refactor the event system. Instead of passing a render.Point to all
  event handlers, pass an EventData struct which can hold the Point or
  the render.Engine.
* Add event types Computed and Present, so a widget can set a handler on
  whenever its Computed or Present method is called.
2020-03-09 17:13:33 -07:00
0846fe22fc Place Strategy for Frame Widget 2020-03-08 22:07:46 -07:00
4ba563d48d Supervisor, Frame Pack and Misc Fixes
* Button: do not call MoveTo inside of Compute().
* Label: do not call MoveTo inside of Compute().
* MainWindow: add OnLoop callback function support so you can run custom code
  each loop and react to the event.State before the UI updates.
* Supervisor: locate widgets using AbsolutePosition() instead of w.Point()
  to play nice with Frame and Window packed widgets.
* Widget interface: rename Adopt() to SetParent() which makes more sense for
  what the function actually does.
* Window: set itself as the parent of the body Frame so that the Supervisor
  can locate widgets anywhere inside a window's frames.

Frame packing fixes:

* Widgets with Expand:true grow their space with ResizeAuto to preserve the
  FixedSize() boolean, instead of being hard-resized to fill the Frame.
* Widgets that Fill their space are resized with ResizeAuto too.

Outstanding bugs:

* Labels don't expand (window title bars, etc.)
2019-12-29 00:00:03 -08:00
9d6b172878 Rename Anchor to Side in Frame.Pack() config 2019-12-28 21:47:46 -08:00
3e73a6effb Change types int32 -> int per upstream render library 2019-12-27 19:12:00 -08:00
039f0e6338 Fix some import paths 2019-12-27 16:46:38 -08:00
70f8e5b02a Add GoDoc link to README 2019-12-27 16:23:19 -08:00
40e451814e Add GitHub mirror information to README 2019-12-27 16:09:13 -08:00
2f5b498ca1 Add README, LICENSE and Examples 2019-12-27 16:06:24 -08:00