Skip to content

Commit

Permalink
feat: add cursor_on_hover parameter to change mouse cursor
Browse files Browse the repository at this point in the history
This parameter has been added only to groups and buttons
  • Loading branch information
SamuMazzi committed Oct 9, 2024
1 parent e4d8729 commit d5baef6
Show file tree
Hide file tree
Showing 10 changed files with 85 additions and 8 deletions.
14 changes: 12 additions & 2 deletions dearpygui/_dearpygui.pyi

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions dearpygui/_dearpygui_RTD.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 19 additions & 6 deletions dearpygui/dearpygui.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions dearpygui/demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -3252,6 +3252,21 @@ def _event_handler(sender, data):
for handler in dpg.get_item_children("__demo_mouse_handler", 1):
dpg.set_item_callback(handler, _event_handler)

with dpg.tree_node(label="Mouse Cursors"):
cursors = [("Arrow", dpg.mvMouseCursor_Arrow), ("TextInput", dpg.mvMouseCursor_TextInput),
("ResizeAll", dpg.mvMouseCursor_ResizeAll), ("ResizeNS", dpg.mvMouseCursor_ResizeNS),
("ResizeEW", dpg.mvMouseCursor_ResizeEW), ("ResizeNESW", dpg.mvMouseCursor_ResizeNESW),
("ResizeNWSE", dpg.mvMouseCursor_ResizeNWSE), ("Hand", dpg.mvMouseCursor_Hand),
("NotAllowed", dpg.mvMouseCursor_NotAllowed)]
dpg.add_text("Hover to see mouse cursors:")
with dpg.tooltip(dpg.last_item()):
dpg.add_text("Your application can render a different mouse cursor based on what ImGui::GetMouseCursor() returns.\n"
"If software cursor rendering (io.MouseDrawCursor) is set ImGui will draw the right cursor for you,\n"
"otherwise your backend needs to handle it.")
for i in range(len(cursors)):
with dpg.group(horizontal=True, cursor_on_hover=cursors[i][1]):
dpg.add_text(cursors[i][0], bullet=True)

with dpg.collapsing_header(label="Drag & Drop"):

with dpg.tree_node(label="Help"):
Expand Down
Loading

0 comments on commit d5baef6

Please sign in to comment.