diff options
| author | [email protected] <[email protected]> | 2010-12-21 23:50:25 +0000 |
|---|---|---|
| committer | [email protected] <[email protected]> | 2010-12-21 23:50:25 +0000 |
| commit | 297405c3c662c8b8f09c1abb9579f151c7128dfe (patch) | |
| tree | 2f6ef1218f38bed35c6557e00c2d32943a3b84b8 /components/rtgui/widgets/listctrl.c | |
| parent | 32d13198df15cfed5164ed510073b4f9a1a6181e (diff) | |
update menu control and add notebook control.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1220 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'components/rtgui/widgets/listctrl.c')
| -rw-r--r-- | components/rtgui/widgets/listctrl.c | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/components/rtgui/widgets/listctrl.c b/components/rtgui/widgets/listctrl.c index 943f5793fb..360b2ad892 100644 --- a/components/rtgui/widgets/listctrl.c +++ b/components/rtgui/widgets/listctrl.c @@ -59,8 +59,8 @@ void rtgui_listctrl_ondraw(struct rtgui_listctrl* ctrl) rect.x2 -= 1; rect.y2 -= 1;
/* draw focused border */
- if (RTGUI_WIDGET_IS_FOCUSED(RTGUI_WIDGET(ctrl)))
- rtgui_dc_draw_focus_rect(dc, &rect);
+ // if (RTGUI_WIDGET_IS_FOCUSED(RTGUI_WIDGET(ctrl)))
+ // rtgui_dc_draw_focus_rect(dc, &rect);
/* get item base rect */
item_rect = rect;
@@ -191,8 +191,8 @@ rt_bool_t rtgui_listctrl_event_handler(struct rtgui_widget* widget, struct rtgui /* update focus border */
rect.x2 -= 1; rect.y2 -= 1;
/* draw focused border */
- if (RTGUI_WIDGET_IS_FOCUSED(RTGUI_WIDGET(ctrl)))
- rtgui_dc_draw_focus_rect(dc, &rect);
+ // if (RTGUI_WIDGET_IS_FOCUSED(RTGUI_WIDGET(ctrl)))
+ // rtgui_dc_draw_focus_rect(dc, &rect);
rtgui_dc_end_drawing(dc);
}
}
@@ -322,3 +322,23 @@ void rtgui_listctrl_set_items(rtgui_listctrl_t* ctrl, rt_uint32_t items, rt_uint rtgui_widget_update(RTGUI_WIDGET(ctrl));
}
+
+rt_bool_t rtgui_listctrl_get_item_rect(rtgui_listctrl_t* ctrl, rt_uint16_t item, rtgui_rect_t* item_rect)
+{
+ if (item < ctrl->items_count)
+ {
+ rt_uint16_t index;
+
+ /* check whether this item in current page */
+ index = (ctrl->current_item / ctrl->page_items) * ctrl->page_items;
+ if (index > item || index + ctrl->page_items <= item) return RT_FALSE;
+
+ rtgui_widget_get_extent(RTGUI_WIDGET(ctrl), item_rect);
+ item_rect->y1 -= 2;
+ item_rect->y1 += (item % ctrl->page_items) * (2 + rtgui_theme_get_selected_height());
+ item_rect->y2 = item_rect->y1 + (2 + rtgui_theme_get_selected_height());
+ return RT_TRUE;
+ }
+
+ return RT_FALSE;
+}
|
