当前位置: 首页>>代码示例>>C++>>正文


C++ rtgui_rect_height函数代码示例

本文整理汇总了C++中rtgui_rect_height函数的典型用法代码示例。如果您正苦于以下问题:C++ rtgui_rect_height函数的具体用法?C++ rtgui_rect_height怎么用?C++ rtgui_rect_height使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了rtgui_rect_height函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: demo_view

rtgui_view_t *demo_view_buffer_animation(rtgui_workbench_t* workbench)
{
	rtgui_view_t *view;

	view = demo_view(workbench, "DC 缓冲区动画");
	if (view != RT_NULL)
		rtgui_widget_set_event_handler(RTGUI_WIDGET(view), animation_event_handler);

	rtgui_font_get_metrics(RTGUI_WIDGET_FONT(RTGUI_WIDGET(view)), "缓冲动画", &text_rect);
	if (dc_buffer == RT_NULL)
	{
		rtgui_rect_t rect;

		rect.x1 = 0; rect.x2 = rtgui_rect_width(text_rect) + 2;
		rect.y1 = 0; rect.y2 = rtgui_rect_height(text_rect) + 2;

		/* 创建 DC Buffer,长 50,宽 50 */
		dc_buffer = rtgui_dc_buffer_create(rtgui_rect_width(rect), rtgui_rect_height(rect));
		RTGUI_DC_FC(dc_buffer) = RTGUI_WIDGET_BACKGROUND(RTGUI_WIDGET(view));
		rtgui_dc_fill_rect(dc_buffer, &rect);
		RTGUI_DC_FC(dc_buffer) = black;
		rect.x1 = 1; rect.y1 = 1;
		rtgui_dc_draw_text(dc_buffer, "缓冲动画", &rect);
	}

	/* 启动定时器以触发动画 */
	timer = rtgui_timer_create(1, RT_TIMER_FLAG_PERIODIC, timeout, (void*)view);
	rtgui_timer_start(timer);

	return view;
}
开发者ID:CollinsLiu,项目名称:rt-thread-pc,代码行数:31,代码来源:demo_view_buffer_animation.c

示例2: rtgui_image_hdcmm_blit

static void rtgui_image_hdcmm_blit(struct rtgui_image *image, struct rtgui_dc *dc, struct rtgui_rect *dst_rect)
{
    rt_uint8_t *ptr;
    rt_uint16_t y, w, h;
    struct rtgui_image_hdcmm *hdc;

    RT_ASSERT(image != RT_NULL || dc != RT_NULL || dst_rect != RT_NULL);

    /* this dc is not visible */
    if (rtgui_dc_get_visible(dc) != RT_TRUE) return;

    hdc = (struct rtgui_image_hdcmm *) image;
    RT_ASSERT(hdc != RT_NULL);

    /* the minimum rect */
    if (image->w < rtgui_rect_width(*dst_rect)) w = image->w;
    else w = rtgui_rect_width(*dst_rect);
    if (image->h < rtgui_rect_height(*dst_rect)) h = image->h;
    else h = rtgui_rect_height(*dst_rect);


    /* get pixel pointer */
    ptr = hdc->pixels;

    for (y = 0; y < h; y ++)
    {
        dc->engine->blit_line(dc, dst_rect->x1, dst_rect->x1 + w, dst_rect->y1 + y, ptr);
        ptr += hdc->pitch;
    }
}
开发者ID:BernardXiong,项目名称:realtouch,代码行数:30,代码来源:image_hdc.c

示例3: rtgui_list_view_calc

static void rtgui_list_view_calc(struct rtgui_list_view* view)
{
    rtgui_rect_t rect;
    rt_uint32_t image_width, image_height;
    rt_ubase_t text_width, text_height;
    rt_ubase_t item_width, item_height;

    if (view->items_count == 0) return;

    /* get image width and height */
    if (view->items[0].image != RT_NULL) {
        image_width  = view->items[0].image->w;
        image_height = view->items[0].image->h;
    } else {
        image_width  = 0;
        image_height = 0;
    }

    rtgui_font_get_metrics(RTGUI_WIDGET_FONT(RTGUI_WIDGET(view)), "HHHHHH", &rect);

    text_height = rtgui_rect_height(rect);
    text_width = rtgui_rect_width(rect);

    rtgui_widget_get_rect(RTGUI_WIDGET(view), &rect);

    item_width = (image_width + LIST_MARGIN);
    if (item_width < (text_width + LIST_MARGIN)) item_width = text_width + LIST_MARGIN;
    item_height = image_height + 8 + text_height + LIST_MARGIN;
    if (item_width > item_height) item_height = item_width;
    else item_width = item_height;

    view->row_items = (rtgui_rect_height(rect) - 2 * LIST_MARGIN) / item_height;
    view->col_items = (rtgui_rect_width(rect) - 2 * LIST_MARGIN) / item_width;
    view->page_items = view->row_items * view->col_items;
}
开发者ID:malooei,项目名称:yeejoin-workspace,代码行数:35,代码来源:list_view.c

示例4: rtgui_list_view_calc

static void rtgui_list_view_calc(struct rtgui_list_view* view)
{
	/* get image of first item*/
	rtgui_image_t *image;
	rtgui_rect_t rect;
	rt_ubase_t text_width, text_height;
	rt_ubase_t item_width, item_height;

	if (view->items_count == 0) return;

	image = view->items[0].image;
	rtgui_font_get_metrics(RTGUI_WIDGET_FONT(RTGUI_WIDGET(view)), "HHHHHH", &rect);

	text_height = rtgui_rect_height(rect);
	text_width = rtgui_rect_width(rect);

	rtgui_widget_get_rect(RTGUI_WIDGET(view), &rect);

	item_width = (image->w + LIST_MARGIN);
	if (item_width < (text_width + LIST_MARGIN)) item_width = text_width + LIST_MARGIN;
	item_height = image->h + 3 + text_height + LIST_MARGIN; 

	view->row_items = (rtgui_rect_height(rect) - 2 * LIST_MARGIN) / item_height;
	view->col_items = (rtgui_rect_width(rect) - 2 * LIST_MARGIN) / item_width;
	view->page_items = view->row_items * view->col_items;
}
开发者ID:visitor83,项目名称:fighting_stm32,代码行数:26,代码来源:list_view.c

示例5: rtgui_edit_adjust_scroll

void rtgui_edit_adjust_scroll(rtgui_scrollbar_t *bar)
{
	struct rtgui_edit *edit;
	
	RT_ASSERT(bar != RT_NULL);
	
	if(bar->WIDGET_GROUP != RT_NULL)
	{
		rtgui_rect_t rect;
		rt_uint32_t _left=0,_top=0,_width=RTGUI_DEFAULT_SB_WIDTH,_len=0;

		edit = bar->WIDGET_GROUP;
		rtgui_widget_get_rect(edit, &rect);
		rtgui_widget_rect_to_device(edit,&rect);
		if(bar->orient==RTGUI_HORIZONTAL)
		{
			if(RTGUI_WIDGET_IS_HIDE(edit->hscroll))
			{
				if(edit->max_rows > edit->row_per_page)
				{
					RTGUI_WIDGET_SHOW(edit->hscroll);
					rtgui_scrollbar_set_line_step(edit->hscroll, 1);
					rtgui_scrollbar_set_page_step(edit->hscroll, edit->row_per_page);
					rtgui_scrollbar_set_range(edit->hscroll, edit->max_rows);
				}
				else
					RTGUI_WIDGET_HIDE(edit->vscroll);
				rtgui_widget_update_clip(RTGUI_WIDGET(edit));
			}
			else
			{
				_left = RTGUI_WIDGET_BORDER_SIZE(edit);
				_top = rtgui_rect_height(rect)-RTGUI_WIDGET_BORDER_SIZE(edit)-_width;
				_len = rtgui_rect_width(rect)-RTGUI_WIDGET_BORDER_SIZE(edit)*2;
				
				if(!RTGUI_WIDGET_IS_HIDE(edit->vscroll)) 
					_len -= _width;
				rect.x1 += _left;
				rect.y1 += _top;
				rect.x2 = rect.x1+_len;
				rect.y2 = rect.y1+_width;
			}
		}
		else if(bar->orient==RTGUI_VERTICAL)
		{
			_left = rtgui_rect_width(rect)-RTGUI_WIDGET_BORDER_SIZE(edit)-_width;
			_top = RTGUI_WIDGET_BORDER_SIZE(edit);
			_len = rtgui_rect_height(rect)-RTGUI_WIDGET_BORDER_SIZE(edit)*2;
			
			if(!RTGUI_WIDGET_IS_HIDE(edit->hscroll))  
				_len -= _width;
			rect.x1 += _left;
			rect.y1 += _top;
			rect.x2 = rect.x1+_width;
			rect.y2 = rect.y1+_len;
		}
		rtgui_widget_set_rect(bar,&rect);
	}
}
开发者ID:amsl,项目名称:RTGUI,代码行数:59,代码来源:edit.c

示例6: get_sbar_active_len

/* get active area length */
rt_uint32_t get_sbar_active_len(rtgui_scrollbar_t *bar)
{
	rtgui_rect_t rect;

	rtgui_widget_get_rect(RTGUI_WIDGET(bar), &rect);

	if(bar->orient & RTGUI_VERTICAL)
		return rtgui_rect_height(rect) - 2*rtgui_rect_width(rect);
	else
		return rtgui_rect_width(rect) - 2*rtgui_rect_height(rect);
}
开发者ID:BernardXiong,项目名称:realtouch,代码行数:12,代码来源:scrollbar.c

示例7: rtgui_image_hdc_blit

static void rtgui_image_hdc_blit(struct rtgui_image *image, struct rtgui_dc *dc, struct rtgui_rect *dst_rect)
{
    rt_uint16_t y, w, h;
    struct rtgui_image_hdc *hdc;

    RT_ASSERT(image != RT_NULL || dc != RT_NULL || dst_rect != RT_NULL);

    /* this dc is not visible */
    if (rtgui_dc_get_visible(dc) != RT_TRUE) return;

    hdc = (struct rtgui_image_hdc *) image->data;
    RT_ASSERT(hdc != RT_NULL);

    /* the minimum rect */
    if (image->w < rtgui_rect_width(*dst_rect)) w = image->w;
    else w = rtgui_rect_width(*dst_rect);
    if (image->h < rtgui_rect_height(*dst_rect)) h = image->h;
    else h = rtgui_rect_height(*dst_rect);

    if (hdc->pixels != RT_NULL)
    {
        rt_uint8_t *ptr;

        /* get pixel pointer */
        ptr = hdc->pixels;

        for (y = 0; y < h; y ++)
        {
            dc->engine->blit_line(dc, dst_rect->x1, dst_rect->x1 + w, dst_rect->y1 + y, ptr);
            ptr += hdc->pitch;
        }
    }
    else
    {
        rt_uint8_t *ptr;
        ptr = rtgui_malloc(hdc->pitch);
        if (ptr == RT_NULL) return; /* no memory */

        /* seek to the begin of pixel data */
        rtgui_filerw_seek(hdc->filerw, hdc->pixel_offset, RTGUI_FILE_SEEK_SET);

        for (y = 0; y < h; y ++)
        {
            /* read pixel data */
            if (rtgui_filerw_read(hdc->filerw, ptr, 1, hdc->pitch) != hdc->pitch)
                break; /* read data failed */

            dc->engine->blit_line(dc, dst_rect->x1,  dst_rect->x1 + w, dst_rect->y1 + y, ptr);
        }

        rtgui_free(ptr);
    }
}
开发者ID:BernardXiong,项目名称:realtouch,代码行数:53,代码来源:image_hdc.c

示例8: _rtgui_scrollbar_get_length

rt_uint32_t _rtgui_scrollbar_get_length(rtgui_scrollbar_t *bar)
{
	rtgui_rect_t rect;
	rt_uint32_t result;

	rtgui_widget_get_rect(RTGUI_WIDGET(bar), &rect);

	if(bar->orient & RTGUI_VERTICAL)
		result = rtgui_rect_height(rect) - 2*rtgui_rect_width(rect) - bar->thumb_len;
	else
		result = rtgui_rect_width(rect) - 2*rtgui_rect_height(rect) - bar->thumb_len;

	return result;
}
开发者ID:BernardXiong,项目名称:realtouch,代码行数:14,代码来源:scrollbar.c

示例9: _calc_width

static void _calc_width(rtgui_textview_t *textview)
{
	rtgui_rect_t rect;
	rt_uint16_t width, height;

	width = rtgui_rect_width(RTGUI_WIDGET(textview)->extent) - 6;
	height = rtgui_rect_height(RTGUI_WIDGET(textview)->extent);

	rtgui_font_get_metrics(RTGUI_WIDGET_FONT(RTGUI_WIDGET(textview)), "W", &rect);
	textview->line_width = width / rtgui_rect_width(rect) + 1;
	textview->line_page_count = height / (rtgui_rect_height(rect) + 3);

	/* set minimal value */
	if (textview->line_page_count == 0) textview->line_page_count = 1;
}
开发者ID:Paolo-Maffei,项目名称:rt-thread-stm32f4discovery,代码行数:15,代码来源:textview.c

示例10: _draw_textview

static void _draw_textview(rtgui_textview_t *textview)
{
	struct rtgui_dc* dc;
	struct rtgui_rect rect, font_rect;
	char* line;
	rt_ubase_t line_index, item_height;

	rtgui_font_get_metrics(RTGUI_WIDGET_FONT(RTGUI_WIDGET(textview)), "W", &font_rect);
	item_height = rtgui_rect_height(font_rect) + 3;

	dc = rtgui_dc_begin_drawing(RTGUI_WIDGET(textview));
	if (dc == RT_NULL) return ;

	/* fill rect */
	rtgui_widget_get_rect(RTGUI_WIDGET(textview), &rect);
	rtgui_dc_fill_rect(dc, &rect);

	rect.x1 += 3;
	rect.x2 -= 3;

	for (line_index = textview->line_current; 
		(line_index < textview->line_current + textview->line_page_count) &&
		(line_index < textview->line_count); 
		line_index ++)
	{
		line = (char* )_get_line_text(textview, line_index);
		rtgui_dc_draw_text(dc, line, &rect);

		rect.y1 += item_height;
	}

	rtgui_dc_end_drawing(dc);
}
开发者ID:Paolo-Maffei,项目名称:rt-thread-stm32f4discovery,代码行数:33,代码来源:textview.c

示例11: _rtgui_listctrl_scrollbar_onmouse

static void _rtgui_listctrl_scrollbar_onmouse(struct rtgui_listctrl* ctrl, struct rtgui_event_mouse* mouse)
{
	rtgui_rect_t rect;
	rt_uint32_t height, y1;
	rt_uint16_t old_item;

	/* get scrollbar rect */
	_rtgui_listctrl_get_scrollbar_rect(ctrl, &rect);
	height = rtgui_rect_height(rect);
	height = height / ((ctrl->items_count + (ctrl->page_items - 1))/ctrl->page_items);
	y1 = (ctrl->current_item / ctrl->page_items) * height;

	rect.y1 = rect.y1 + y1; rect.y2 = rect.y1 + height;
	rtgui_widget_rect_to_device(RTGUI_WIDGET(ctrl), &rect);

	old_item = ctrl->current_item;
	if (mouse->y < rect.y1)
	{
		if (ctrl->current_item - ctrl->page_items >= 0)
			ctrl->current_item -= ctrl->page_items;
		rtgui_listctrl_update_current(ctrl, old_item);
	}
	else if (mouse->y > rect.y2)
	{
		if (ctrl->current_item + ctrl->page_items < ctrl->items_count - 1)
			ctrl->current_item += ctrl->page_items;
		else
			ctrl->current_item = ((ctrl->current_item / ctrl->page_items) + 1) * ctrl->page_items;
		rtgui_listctrl_update_current(ctrl, old_item);
	}
}
开发者ID:lyyyuna,项目名称:rtt_ex,代码行数:31,代码来源:listctrl.c

示例12: rtgui_textbox_init_caret

static void rtgui_textbox_init_caret(rtgui_textbox_t *box, rt_uint16_t position)
{
	int x, y;
	rtgui_color_t color;
	rtgui_rect_t rect;
	int ofs = 0;

	RT_ASSERT(box != RT_NULL);

	if (!RTGUI_WIDGET_IS_FOCUSED(box))
		return;

	rtgui_textbox_get_caret_rect(box, &box->caret_rect, position);
	rect = box->caret_rect;
	rtgui_widget_rect_to_device(RTGUI_WIDGET(box), &rect);

	if (box->caret == RT_NULL)
		box->caret = rtgui_malloc(rtgui_rect_width(rect) * rtgui_rect_height(rect) * sizeof(rtgui_color_t));

	for (x = rect.x1; x < rect.x2; x++)
	{
		for (y = rect.y1; y < rect.y2; y++)
		{
			rtgui_graphic_driver_get_default()->ops->get_pixel(&color, x, y);
			*(box->caret + ofs) = color;
			ofs++;
		}
	}
}
开发者ID:xiiing,项目名称:RTGUI,代码行数:29,代码来源:textbox.c

示例13: app_list_view_onmouse

static rt_bool_t app_list_view_onmouse(struct app_list_view *view,
                                       struct rtgui_event_mouse *emouse)
{
    if (rtgui_rect_contains_point(&view->view_rect,
                                  emouse->x, emouse->y) == RT_EOK)
    {
        rt_uint16_t index;
        rt_uint16_t old_item;

        /* get old item */
        old_item = view->current_item;

        {
            rt_uint16_t x, y;
            rt_uint16_t item_height, item_width;


            item_width = (rtgui_rect_width(view->view_rect) - 2 * LIST_MARGIN) /
                         view->col_items;
            item_height = (rtgui_rect_height(view->view_rect) - 4) / view->row_items;
            x = emouse->x - view->view_rect.x1;
            y = emouse->y - view->view_rect.y1;

            index = (y / item_height * view->col_items) + x / item_width;

            if ((index + (view->current_page * view->page_items) <
                    view->items_count))
            {

                if (emouse->button & RTGUI_MOUSE_BUTTON_DOWN)
                {
                    view->current_item = index + (view->current_page *
                                                  view->page_items);
                    /* down event */
                    // rtgui_list_view_update_icon(view, old_item);
                }
                else
                {
                    if (view->current_item == index + (view->current_page *
                                                       view->page_items))
                    {
                        rt_kprintf("mouse up,current item:%d\n", view->current_item);
                        /* up event */
                        if (view->on_select != RT_NULL)
                        {
                            view->on_select(&view->items[view->current_item]);
                        }
                    }
                }

            }
        }


        return RT_TRUE;
    }

    return RT_FALSE;
}
开发者ID:003900107,项目名称:realboard-lpc4088,代码行数:59,代码来源:mainmenu.c

示例14: _rtgui_listctrl_get_rect

static void _rtgui_listctrl_get_rect(struct rtgui_listctrl* ctrl, rtgui_rect_t* rect)
{
	rtgui_widget_get_rect(RTGUI_WIDGET(ctrl), rect);
	if (ctrl->items_count > rtgui_rect_height(*rect)/rtgui_theme_get_selected_height())
	{
		rect->x2 = rect->x2 - 8;
	}
}
开发者ID:lyyyuna,项目名称:rtt_ex,代码行数:8,代码来源:listctrl.c

示例15: rtgui_listctrl_set_itemheight

void rtgui_listctrl_set_itemheight(struct rtgui_listctrl *ctrl, int height)
{
    RT_ASSERT(ctrl != RT_NULL);
    if (height <= 0) return;

    ctrl->item_height = height;
    ctrl->page_items = rtgui_rect_height(RTGUI_WIDGET(ctrl)->extent) / (2 + ctrl->item_height);
}
开发者ID:KodakWang,项目名称:RTGUI,代码行数:8,代码来源:listctrl.c


注:本文中的rtgui_rect_height函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。