Beispiel #1
0
		static void _m_check_restrict_area(nana::point & pos, const nana::size & size, const nana::rectangle& restr_area)
		{
			if ((pos.x > 0) && (static_cast<int>(size.width) + pos.x > restr_area.right()))
				pos.x = restr_area.right() - static_cast<int>(size.width);

			if (pos.x < restr_area.x)
				pos.x = restr_area.x;

			if ((pos.y > 0) && (static_cast<int>(size.height) + pos.y > restr_area.bottom()))
				pos.y = restr_area.bottom() - static_cast<int>(size.height);

			if (pos.y < restr_area.y)
				pos.y = restr_area.y;
		}
Beispiel #2
0
			void _m_render_edge_nimbus(core_window_t* wd, const nana::rectangle & visual)
			{
				auto r = visual;
				r.pare_off(-static_cast<int>(weight()));
				rectangle good_r;
				if (overlap(r, rectangle{ wd->root_graph->size() }, good_r))
				{
					if ((good_r.x < wd->pos_root.x) || (good_r.y < wd->pos_root.y) || 
						(good_r.right() > visual.right()) || (good_r.bottom() > visual.bottom()))
					{
						auto graph = wd->root_graph;
						nana::paint::pixel_buffer pixbuf(graph->handle(), r);

						pixel_argb_t px0, px1, px2, px3;
						
						px0 = pixbuf.pixel(0, 0);
						px1 = pixbuf.pixel(r.width - 1, 0);
						px2 = pixbuf.pixel(0, r.height - 1);
						px3 = pixbuf.pixel(r.width - 1, r.height - 1);

						good_r.x = good_r.y = 1;
						good_r.width = r.width - 2;
						good_r.height = r.height - 2;
						pixbuf.rectangle(good_r, wd->scheme->activated.get_color(), 0.95, false);

						good_r.x = good_r.y = 0;
						good_r.width = r.width;
						good_r.height = r.height;
						pixbuf.rectangle(good_r, wd->scheme->activated.get_color(), 0.4, false);

						pixbuf.pixel(0, 0, px0);
						pixbuf.pixel(r.width - 1, 0, px1);
						pixbuf.pixel(0, r.height - 1, px2);
						pixbuf.pixel(r.width - 1, r.height - 1, px3);

						pixbuf.paste(wd->root, { r.x, r.y });

						std::vector<typename window_layer::wd_rectangle> overlaps;
						if(window_layer::read_overlaps(wd, visual, overlaps))
						{
							for(auto & wdr : overlaps)
								graph->paste(wd->root, wdr.r, wdr.r.x, wdr.r.y);
						}
					}
					else
						wd->root_graph->paste(wd->root, visual, visual.x, visual.y);
				}
			}
Beispiel #3
0
			void caret_descriptor::effective_range(nana::rectangle rect)
			{
				//Chech rect
				if (rect.width && rect.height && rect.right() > 0 && rect.bottom() > 0)
				{
					if(rect.x < 0)
					{
						rect.width += rect.x;
						rect.x = 0;
					}

					if(rect.y < 0)
					{
						rect.height += rect.y;
						rect.y = 0;
					}

					if(effective_range_ != rect)
					{
						effective_range_ = rect;
						update();
					}
				}
			}