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


C++ CL_Rect函数代码示例

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


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

示例1: get_client_area

void MainWindow::on_resized()
{
	CL_Rect client_area = get_client_area();

	menubar->set_geometry(CL_Rect(client_area.left, client_area.top, client_area.right, client_area.top + 22));
	workspace->set_geometry(CL_Rect(client_area.left, client_area.top + 22, client_area.right, client_area.bottom));
}
开发者ID:PaulFSherwood,项目名称:cplusplus,代码行数:7,代码来源:main_window.cpp

示例2: CL_Rect

CL_Rect CL_ListViewLayoutIcons::get_lineedit_rect(CL_ListViewItem &item, const CL_Size &text_size) const
{
	if (shown_items.empty())
		return CL_Rect(0,0,0,0);
	
	ListViewShownItem si;

	// 1. Find shown items, si.
	std::vector<ListViewShownItem>::const_iterator it;
	for (it=shown_items.begin(); it!=shown_items.end(); ++it)
	{
		if ((*it).item == item)
		{
			si = (*it);
			break;
		}
	}

	if (si.valid == false)
		return CL_Rect(0,0,0,0);

	// 2. Calculate text rect for 'str'.
	CL_Rect text_rect = si.rect_text[0];
	text_rect.right = text_rect.left + text_size.width + 3; // add a few pixels extra to allow cursor to be at end of string without scrolling.

	// 3. Expand text rect with line-edit-offset values defined in css.
	text_rect.top -= lineedit_textrect_offset.top;
	text_rect.left -= lineedit_textrect_offset.left;
	text_rect.bottom += lineedit_textrect_offset.bottom;
	text_rect.right += lineedit_textrect_offset.right;

	return text_rect;
}
开发者ID:animehunter,项目名称:clanlib-2.3,代码行数:33,代码来源:listview_layout_icons.cpp

示例3: CL_Component

Window::Window(const CL_Rect& rect, const std::string& title, CL_Component* parent)
  : CL_Component(rect, parent), impl(new WindowImpl())
{
  impl->titlebar = new Titlebar(CL_Rect(CL_Point(3+16,3), 
                                        CL_Size(get_width()-6-18-18-18, 12+3)), title,
                                this);
  //Fonts::verdana11.draw(8+15, 3, title);

  impl->close = new Icon(CL_Rect(CL_Point(3, 3), CL_Size(18,18)), 
                         make_sprite(datadir + "/images/window/close.png"),
                         "", this);
  impl->minimize = new Icon(CL_Rect(CL_Point(get_width()-3-18-18, 3), CL_Size(18,18)), 
                            make_sprite(datadir + "/images/window/minimize.png"),
                            "", this);
  impl->maximize = new Icon(CL_Rect(CL_Point(get_width()-3-18, 3), CL_Size(18,18)), 
                            make_sprite(datadir + "/images/window/maximize.png"),
                            "", this);

  impl->client_area = new CL_Component(CL_Rect(CL_Point(4, 3+12+7), 
                                               CL_Size(rect.get_width()-10,
                                                       rect.get_height()-28)), this);
  impl->parent  = this;
  impl->is_maximized = false;

  impl->slots.push_back(sig_resize().connect(impl.get(),      &WindowImpl::on_resize));

  impl->slots.push_back(sig_paint().connect(impl.get(),      &WindowImpl::draw));
  impl->slots.push_back(impl->maximize->sig_clicked().connect(impl.get(), &WindowImpl::do_maximize));
  impl->slots.push_back(impl->close->sig_clicked().connect(impl.get(), &WindowImpl::do_close));
}
开发者ID:BackupTheBerlios,项目名称:flexlay-svn,代码行数:30,代码来源:window.cpp

示例4: update_scrollbar

void CL_TreeView_Silver::on_resize(int old_width, int old_height)
{
	int header_height = 20;

	int width = treeview->get_width();
	int height = treeview->get_height();

	// Position the header area
	header_area->set_position(CL_Rect(0, 0, width, header_height));

	// Position the client area
	CL_Component *client_area = treeview->get_client_area();
	if(treeview->is_header_visible())
	{
		client_area->set_position(CL_Rect(1, header_height, width - 1, height - 1));
		header_area->show(true);
	}
	else
	{
		client_area->set_position(CL_Rect(1, 1, width - 1, height - 1));
		header_area->show(false);
	}

	update_scrollbar(false);

	// Scrollbar was added, shrink other areas
	if(visible_scrollbar)
	{
		client_area->set_width(client_area->get_width() - 19);
		header_area->set_width(header_area->get_width() - 19);

		// Position the scrollbar
		scrollbar->set_position(CL_Rect(width - 19, 0, width, height));
	}
}
开发者ID:BackupTheBerlios,项目名称:flexlay-svn,代码行数:35,代码来源:treeview_silver.cpp

示例5: main

int main()
{
  Flexlay flexlay;
  flexlay.init();

  Editor editor;

  GUIManager* gui = editor.get_gui_manager();

  new CL_Button(CL_Rect(CL_Point(50, 50), 
                        CL_Size(100, 25)),
                "Hello World", gui->get_component());

  EditorMap m;
  Tileset tileset(32);
  TilemapLayer tilemap(tileset, 20, 10);
  
  m.add_layer(tilemap.to_layer());

  TilemapLayer::set_current(tilemap);

  EditorMapComponent editor_map(CL_Rect(0, 0, 799, 599), gui->get_component());
  Workspace workspace(799, 599);
  editor_map.set_workspace(workspace);
  workspace.set_map(m);
 
  new CL_Button(CL_Rect(CL_Point(50, 150), 
                        CL_Size(100, 25)),
                "Quit", gui->get_component());

  gui->run();
 
  flexlay.deinit();
}
开发者ID:BackupTheBerlios,项目名称:flexlay-svn,代码行数:34,代码来源:simpleed.cpp

示例6: CL_Size

void
TitlebarImpl::draw()
{
  CL_Display::push_translate(parent->get_screen_x(), parent->get_screen_y());

  // FIXME: Hack should be done via has_mouse_over(), but that doesn't include child components
  if (parent->get_parent()->get_position().is_inside(CL_Point(CL_Mouse::get_x(),
                                                              CL_Mouse::get_y())))
    //parent->get_parent()->has_mouse_over())
  {
    CL_Display::fill_rect(CL_Rect(CL_Point(0, 0),
                                  CL_Size(parent->get_width()-1, parent->get_height())),
                          CL_Color(250, 250, 250));
  }
  else
  {
    CL_Display::fill_rect(CL_Rect(CL_Point(0, 0),
                                  CL_Size(parent->get_width()-1, parent->get_height())),
                          CL_Color(240, 240, 240));
  }

  Fonts::verdana11.draw(4, 0, title);

  CL_Display::pop_modelview();
}
开发者ID:Flexlay,项目名称:flexlay,代码行数:25,代码来源:titlebar.cpp

示例7: CL_Rect

void CL_PixelCanvas::set_clip_rect(const CL_Rect &new_clip_rect)
{
	clip_rect = CL_Rect(0, 0, colorbuffer0.size.width, colorbuffer0.size.height);
	clip_rect.overlap(new_clip_rect);
	if (clip_rect.get_width() < 0 || clip_rect.get_height() < 0)
		clip_rect = CL_Rect(0,0,0,0);
	cliprect_set = true;
	pipeline->queue(new(pipeline.get()) CL_PixelCommandSetClipRect(clip_rect));
}
开发者ID:PaulFSherwood,项目名称:cplusplus,代码行数:9,代码来源:pixel_canvas.cpp

示例8: switch

void
TileMapPaintToolImpl::draw()
{
  TilemapLayer tilemap = TilemapLayer::current();

  if (tilemap.is_null())
    return;

  switch(mode)
  {
    case TileMapPaintToolImpl::SELECTING:
      if (CL_Keyboard::get_keycode(CL_KEY_LSHIFT))
        selection.draw(CL_Color(255,  128, 128, 100));
      else 
        selection.draw();
      break;
      
    default:
      int tile_size = tilemap.get_tileset().get_tile_size();

      // Draw the brush:
      for(int y = 0; y < brush.get_height(); ++y)
        for(int x = 0; x < brush.get_width(); ++x)
        {
          Tile* tile = tilemap.get_tileset().create(brush.at(x, y));
                
          if (tile)
          {
            CL_Sprite sprite = tile->get_sprite();
            sprite.set_alpha(0.5f);
            sprite.draw((current_tile.x + x) * tile_size, 
                        (current_tile.y + y) * tile_size);

            CL_Display::fill_rect(CL_Rect(CL_Point((current_tile.x + x) * tile_size, 
                                                   (current_tile.y + y) * tile_size),
                                          CL_Size(tile_size, tile_size)),
                                  CL_Color(255, 255, 255, 100));
          }
          else if (brush.is_opaque())
          {
            CL_Display::fill_rect(CL_Rect(CL_Point((current_tile.x + x) * tile_size, 
                                                   (current_tile.y + y) * tile_size),
                                          CL_Size(tile_size, tile_size)),
                                  CL_Color(255, 255, 255, 100));
          }
          else
          {
            CL_Display::fill_rect(CL_Rect(CL_Point((current_tile.x + x) * tile_size, 
                                                   (current_tile.y + y) * tile_size),
                                          CL_Size(tile_size, tile_size)),
                                  CL_Color(255, 255, 255, 50));
          }
        }
      break;
  }
}
开发者ID:Karkus476,项目名称:flexlay,代码行数:56,代码来源:tilemap_paint_tool.cpp

示例9: CL_Rect

std::vector<CL_ClanImageStretch::ImagePart> CL_ClanImageStretch::calc_stretch_image_parts(const CL_Rect &dest, CL_Image &sprite, int sizing_left, int sizing_top, int sizing_right, int sizing_bottom)
{
	int src_width = sprite.get_width();
	int src_height = sprite.get_height();
	int dest_width = dest.get_width();
	int dest_height = dest.get_height();

	int src_grid_x[4];
	int src_grid_y[4];
	int dest_grid_x[4];
	int dest_grid_y[4];

	int rows = 0;
	int cols = 0;

	src_grid_x[cols++] = 0;
	src_grid_x[cols++] = sizing_left;
	src_grid_x[cols++] = src_width - sizing_right;
	src_grid_x[cols++] = src_width;

	src_grid_y[rows++] = 0;
	src_grid_y[rows++] = sizing_top;
	src_grid_y[rows++] = src_height - sizing_bottom;
	src_grid_y[rows++] = src_height;

	rows = 0;
	cols = 0;

	dest_grid_x[cols++] = dest.left;
	dest_grid_x[cols++] = dest.left + sizing_left;
	dest_grid_x[cols++] = dest.right - sizing_right;
	dest_grid_x[cols++] = dest.right;

	dest_grid_y[rows++] = dest.top;
	dest_grid_y[rows++] = dest.top + sizing_top;
	dest_grid_y[rows++] = dest.bottom - sizing_bottom;
	dest_grid_y[rows++] = dest.bottom;

	std::vector<ImagePart> image_parts;
	for (int y = 0; y < rows-1; y++)
	{
		for (int x = 0; x < cols-1; x++)
		{
			ImagePart part;
			part.source_rect = CL_Rect(src_grid_x[x], src_grid_y[y], src_grid_x[x+1], src_grid_y[y+1]);
			part.dest_rect = CL_Rect(dest_grid_x[x], dest_grid_y[y], dest_grid_x[x+1], dest_grid_y[y+1]);
			if (part.source_rect.get_width() > 0 && part.source_rect.get_height() > 0 &&
				part.dest_rect.get_width() > 0 && part.dest_rect.get_height() > 0)
			{
				image_parts.push_back(part);
			}
		}
	}

	return image_parts;
}
开发者ID:PaulFSherwood,项目名称:cplusplus,代码行数:56,代码来源:clan_image_stretch.cpp

示例10: CL_Gradient

void PlayNode::Draw(CL_Rect area)
{
	CL_Display::fill_rect(area, CL_Gradient(CL_Color(0,0,54), CL_Color(54,0,100), CL_Color(100, 50, 0), CL_Color(100, 0, 55)));
	
	mapRect = CL_Rect(area.left + 300, area.top + 100, area.right - 100, area.bottom - 100);
	mapNode->Draw(mapRect);

	inventoryRect = CL_Rect(area.left + 50, area.top + 100, area.left + 250, area.bottom - 100);
	inventoryNode->Draw(inventoryRect);
}
开发者ID:riseven,项目名称:Laberinto,代码行数:10,代码来源:PlayNode.cpp

示例11: CL_Component

TileEditor::TileEditor(int x, int y, int w, int h, CL_Component* parent)
  : CL_Component(CL_Rect(CL_Rect(CL_Point(x, y), 
                                 CL_Size(w, h))), // FIXME: make this editable via script
                 parent)
{
  tile = 0;
  slots.connect(sig_paint(),      this, &TileEditor::draw);
  slots.connect(sig_mouse_move(), this, &TileEditor::mouse_move);
  slots.connect(sig_mouse_down(), this, &TileEditor::mouse_down);
  slots.connect(sig_mouse_up  (), this, &TileEditor::mouse_up);
}
开发者ID:BackupTheBerlios,项目名称:flexlay-svn,代码行数:11,代码来源:tile_editor.cpp

示例12: get_width

CL_PixelBuffer CL_DisplayWindow_OpenGL::get_buffer(int i) const
{
	if (i == 0) 
	{
		return gc.get_pixeldata(CL_Rect(0, 0, get_width(), get_height()), CL_FRONT);
	}
	else
	{
		return gc.get_pixeldata(CL_Rect(0, 0, get_width(), get_height()), CL_BACK);
	}
}
开发者ID:BackupTheBerlios,项目名称:flexlay-svn,代码行数:11,代码来源:display_window_opengl.cpp

示例13: filedialog

CL_FileDialog_Generic::CL_FileDialog_Generic(
	CL_FileDialog *self,
	const std::string &title,
	const std::string &file,
	const std::string &filter)
	: filedialog(self)
{
	behavior = CL_FileDialog::quit_always;
	button = CL_FileDialog::button_none;
	// TODO: Calculate proper size
	int width = 400;
	int height = 315;
	int x = (CL_Display::get_width() - width) / 2;
	int y = (CL_Display::get_height() - height) / 2;
	filedialog->set_position(CL_Rect(x, y, x + width, y + height));
	filedialog->set_title(title);

	CL_Component *client_area = filedialog->get_client_area();

	width = client_area->get_width();

	label_dir = new CL_Label(CL_Point(10, 12), "Directory:", client_area);
	input_dir = new CL_InputBox(CL_Rect(65, 10, width - 120, 30), client_area);
	input_dir->enable(false);

	button_parent = new CL_Button(CL_Rect(width - 115, 9, width - 65, 28), "Parent", client_area);
	button_createdir = new CL_Button(CL_Rect(width - 60, 9, width - 10, 28), "New", client_area);

	treeview_files = new CL_TreeView(CL_Rect(10, 32, width - 10, 197), client_area);
	treeview_files->add_column("Filename", 200);
	treeview_files->add_column("Size", 80);
	treeview_files->add_column("Type", 100);
	treeview_files->show_root_decoration(false);

	label_file = new CL_Label(CL_Point(10, 207), "Filename:", client_area);
	input_file = new CL_InputBox(CL_Rect(65, 205, width - 10, 225), client_area);

	label_filter = new CL_Label(CL_Point(10, 232), "Filter:", client_area);
	input_filter = new CL_InputBox(CL_Rect(65, 230, width - 10, 250), client_area);

	button_ok = new CL_Button(CL_Rect(10, 260, 100, 280), "OK", client_area);
	button_cancel = new CL_Button(CL_Rect(width - 110, 260, width - 10, 280), "Cancel", client_area);

	slots.connect(self->sig_set_options(), this, &CL_FileDialog_Generic::on_set_options);
	slots.connect(treeview_files->sig_selection_changed(), this, &CL_FileDialog_Generic::on_file_activated);
	slots.connect(button_ok->sig_clicked(), this, &CL_FileDialog_Generic::on_button_quit, true);
	slots.connect(button_cancel->sig_clicked(), this, &CL_FileDialog_Generic::on_button_quit, false);
	slots.connect(button_parent->sig_clicked(), this, &CL_FileDialog_Generic::on_button_parent);
	slots.connect(button_createdir->sig_clicked(), this, &CL_FileDialog_Generic::on_button_createdir);
	slots.connect(input_file->sig_return_pressed(), this, &CL_FileDialog_Generic::on_edit_file);
	slots.connect(input_filter->sig_return_pressed(), this, &CL_FileDialog_Generic::on_edit_filter);
	slots.connect(input_dir->sig_return_pressed(), this, &CL_FileDialog_Generic::on_edit_dir);
	
	set_file(file, false);
	set_filter(filter, false);
	show_hidden = false;

	read_dir();
}
开发者ID:BackupTheBerlios,项目名称:flexlay-svn,代码行数:59,代码来源:filedialog_generic.cpp

示例14: CL_Size

void
WindowImpl::on_resize(int, int)
{
  titlebar->set_position(CL_Rect(CL_Point(3+16,3), CL_Size(parent->get_width()-6-18-18-18, 12+3)));
  close->set_position(3, 3);
  minimize->set_position(parent->get_width()-3-18-18, 3);
  maximize->set_position(parent->get_width()-3-18, 3);
  CL_Rect rect = parent->get_position();
  client_area->set_position(CL_Rect(CL_Point(4, 3+12+7), 
                                    CL_Size(rect.get_width()-10,
                                            rect.get_height()-28)));
}
开发者ID:BackupTheBerlios,项目名称:flexlay-svn,代码行数:12,代码来源:window.cpp

示例15: CL_Rect

void CL_TreeView_Silver::on_paint_header()
{
	// Header
	if(treeview->is_header_visible())
	{
		CL_Rect rect = header_area->get_screen_rect();

		// Header background
		CL_Display::fill_rect(
			CL_Rect(
				rect.left + 1,
				rect.top + 1,
				rect.left + rect.get_width() - 1,
				rect.top + rect.get_height() - 4),
			CL_Gradient(
				CL_Color(245, 246, 247), CL_Color(245, 246, 247), CL_Color(235, 238, 241), CL_Color(235, 238, 241)));

		CL_Display::fill_rect(
			CL_Rect(
				rect.left + 1,
				rect.top + rect.get_height() - 4,
				rect.left + rect.get_width() - 1,
				rect.top + rect.get_height()),
			CL_Gradient(
				CL_Color(235, 238, 241), CL_Color(235, 238, 241), CL_Color(186, 187, 188), CL_Color(186, 187, 188)));

		// Draw columns
		int x = 0;
		int columns = treeview->get_column_count();
		for(int i = 0; i < columns; ++i)
		{
			font->draw(
				rect.left + x + 6,
				rect.top + 4, treeview->get_column_name(i));
				
			x += treeview->get_column_width(i);
			
			CL_Display::draw_line(
				rect.left + x,
				rect.top + 1,
				rect.left + x,
				rect.top + rect.get_height(),
				CL_Color(128, 142, 159));
			CL_Display::draw_line(
				rect.left + x + 1,
				rect.top + 1,
				rect.left + x + 1,
				rect.top + rect.get_height(),
				CL_Color::white);
		}
	}
}
开发者ID:BackupTheBerlios,项目名称:flexlay-svn,代码行数:52,代码来源:treeview_silver.cpp


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