|
| 1 | +# GIcon component |
| 2 | +The `GIcon` component is a customizable graphical icon with support for animations, events, and various properties to control its appearance and behavior. |
| 3 | + |
| 4 | +## Animation |
| 5 | +The `GIcon` component provides built-in animations for hover and focus effects. These animations transition smoothly between states based on user interactions. |
| 6 | + |
| 7 | +- `hover`: |
| 8 | + - **off**: Transitions to a state where the `hover` effect is disabled across all icons. |
| 9 | + - **on**: Applies a `hover` effect to the icons, transitioning them to a highlighted state. |
| 10 | + - **focus**: Applies a `focus` effect, transitioning the icons into focus mode. |
| 11 | + |
| 12 | +## Event |
| 13 | +The `GIcon` component supports various interaction events, enabling developers to listen and respond to user actions. |
| 14 | + |
| 15 | +- `HoverIn(GIconHoverParam)`: Triggered when the icon is hovered over. |
| 16 | +- `HoverOut(GIconHoverParam)`: Triggered when the hover effect is lost. |
| 17 | +- `Focus(GIconFocusParam)`: Triggered when the icon gains focus. |
| 18 | +- `Clicked(GIconClickedParam)`: Triggered when the icon is clicked. |
| 19 | +- `FocusLost(GIconFocusLostParam)`: Triggered when the icon loses focus. |
| 20 | + |
| 21 | +## Props |
| 22 | + |
| 23 | +| macro | prop | description | type | default | |
| 24 | +|--------|--------------------|---------------------------------------------------------|--------------------|---------| |
| 25 | +| live | theme | Themes for styling the component | `Themes` | - | |
| 26 | +| live | color | Icon color | `Option<Vec4>` | `None` | |
| 27 | +| live | stroke_hover_color | Stroke color on hover | `Option<Vec4>` | `None` | |
| 28 | +| live | stroke_focus_color | Stroke color on focus | `Option<Vec4>` | `None` | |
| 29 | +| live | stroke_width | Stroke width | `f32` | `1.0` | |
| 30 | +| live | cursor | Icon cursor style | `Option<MouseCursor>`| `None` | |
| 31 | +| live | visible | Controls visibility of the icon | `bool` | `true` | |
| 32 | +| live | grab_key_focus | Determines if the icon grabs key focus | `bool` | `true` | |
| 33 | +| live | animation_key | Animation key control | `bool` | `false` | |
| 34 | +| animator | animator | Manages icon animations | `Animator` | - | |
| 35 | +| redraw | draw_icon | Handles redrawing the icon | `DrawQuad` | - | |
| 36 | +| walk | `abs_pos` | Absolute position for layout | `Option<DVec2>` | `None` | |
| 37 | +| walk | `margin` | Margin size around the view | `Margin` | `Margin::default()` | |
| 38 | +| walk | `width` | Width of the view | `Size` | `Size::default()` | |
| 39 | +| walk | `height` | Height of the view | `Size` | `Size::default()` | |
| 40 | +| layout | `scroll` | Scroll position for layout | `DVec2` | `(0.0, 0.0)` | |
| 41 | +| layout | `clip_x` | Clip content horizontally | `bool` | `true` | |
| 42 | +| layout | `clip_y` | Clip content vertically | `bool` | `true` | |
| 43 | +| layout | `padding` | Padding within the view | `Padding` | `Padding::default()` | |
| 44 | +| layout | `align` | Alignment for content | `Align` | `Align::default()` | |
| 45 | +| layout | `flow` | Flow direction of the content | `Flow` | `Flow::default()` | |
| 46 | +| layout | `spacing` | Spacing between elements | `f64` | `0.0` | |
| 47 | +| live | icon_base | Base icon drawable | `Option<DrawGIconBase>`| `None` | |
| 48 | +| live | icon_arrow | Arrow icon drawable | `Option<DrawGIconArrow>`| `None` | |
| 49 | +| live | icon_code | Code icon drawable | `Option<DrawGIconCode>` | `None` | |
| 50 | +| live | icon_emoji | Emoji icon drawable | `Option<DrawGIconEmoji>`| `None` | |
| 51 | +| live | icon_fs | File system icon drawable | `Option<DrawGIconFs>` | `None` | |
| 52 | +| live | icon_ui | UI icon drawable | `Option<DrawGIconUI>` | `None` | |
| 53 | +| live | icon_person | Person icon drawable | `Option<DrawGIconPerson>`| `None` | |
| 54 | +| live | icon_relation | Relation icon drawable | `Option<DrawGIconRelation>`| `None` | |
| 55 | +| live | icon_state | State icon drawable | `Option<DrawGIconState>`| `None` | |
| 56 | +| live | icon_time | Time icon drawable | `Option<DrawGIconTime>`| `None` | |
| 57 | +| live | icon_tool | Tool icon drawable | `Option<DrawGIconTool>`| `None` | |
| 58 | +| rust | draw_type | Controls the type of icon being drawn | `Option<DrawGIconType>`| `None` | |
| 59 | +| live | icon_type | Specifies the type of icon | `IconType` | - | |
| 60 | +| live | event_key | Event key control | `bool` | `true` | |
| 61 | +| rust | scope_path | Path to scope the icon | `Option<HeapLiveIdPath>`| `None` | |
0 commit comments