This commit defines a new enum: `ImMouseButton`, which is used in the
public-facing API of mouse-related methods.
The discriminant values of the ImMouseButton enum are the value used
internally by ImGui to represent the buttons of the mouse.
This commit adds two methods to the drawing APIs: with_clip_rect and
with_clip_rect_intersect.
Both wrap ImDrawList_PushClipRect and ImDrawList_PopClipRect.
However, with_clip_rect_intersect sets the `intersect` argument of
ImDrawList_PushClipRect to `true`.
As `add_rect_filled_multicolor` does not have any option, the `build`
pattern is not used and calling `add_rect_filled_multicolor` directly
draws the rectangle on the window.
This patch uses bitflags to set the whether the corners are rounded.
Hence the `ImDrawCornerFlags` struct is defined, but only used
internally.
Externally, the valule of the flags can be changed with methods on the
`Rect` structure such as `round_top_right` or `round_bot_left`.
This patch wraps both ImDrawList_AddRectFilled and ImDrawList_AddRect.
ImDrawList_AddRectFilled is seen as a particular case of `add_rect`
where `filled` is set to `true`.
This patch makes the basic structure for a wrapper around Dear ImGui's
drawing API.
1. Implement `with_window_draw_list` method on Ui. Call this method to
get access to the `WindowDrawList` object. This object holds the methods
to access ImGui's drawing API.
2. Dear ImGui uses the ImU32 (an unsigned c_int) to represent colors in
the drawing API. This commit wraps this type with ImColor for
convenience. Any color representation (3or4-tuples, 3or4-arrays, ImU32
or ImVec4) can be converted into ImColor for convenience.
3. Difference between WindowDrawList and ChannelsSplit: Most drawing
functions can be called on WindowDrawList and ChannelsSplit objects.
However for safety, some functions can only be called on WindowDrawList
or ChannelsSplit instance. For example `channels_set_current` can only
be called after channels have been split. To avoid code duplication,
functions common to WindowDrawList and ChannelsSplit are implemented
within the `impl_draw_list_methods` macro.
4. Implement drawing functions (in this commit, add_line only). Calling
`add_line` returns a default representation of the line to be drawn, but
does not draw it. Then parameters, such as thickness, can be set. You
must call `build` to draw the line. All drawing functions will be
implemented following this pattern.
This reverts commit 0d10358942409cf8fad6fcb730dbedfbd7149df7.
`get_window_size` already exists and it's very easy to get just one
of the dimentions. As a result, delete get_window_width and
get_window_height.