Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » ArrayCtrl, HeaderCtrl & GridCtrl » [Minor bug & patch] GridCtrl should use native resizing icons.
[Minor bug & patch] GridCtrl should use native resizing icons. [message #39536] Tue, 26 March 2013 16:02
Klugier is currently offline  Klugier
Messages: 1075
Registered: September 2012
Location: Poland, Kraków
Senior Contributor
Hello,

I have noticed that GridCtrl uses custom "resizing icons". It is very important to change this state. I have written completed patch code (We need to change only few lines of code). Why this patch is so important? Since patched GridCtrl will be more natural on all X11 operating systems.

I have enclosed patch code that uses native system "vertical and horizontal resizing icons" (GridCtrl/GridCtrl.cpp - line 3263):

Image GridCtrl::HorzPosImage() {
	#ifdef PLATFORM_X11
		return Image::SizeHorz();
	#else
		return GridImg::HorzPos();
	#endif 
}

Image GridCtrl::VertPosImage() {
	#ifdef PLATFORM_X11
		return Image::SizeVert();
	#else
		return GridImg::VertPos();
	#endif 
}

Image GridCtrl::CursorImage(Point p, dword keyflags)
{
	if(!moving_header && !moving_body && HasCapture())
	{
		if(resizing_cols && curSplitCol >= 0) {
			return HorzPosImage();
		} if(resizing_rows && curSplitRow >= 0) {
			return VertPosImage ();
		} else
			return Image::Arrow();
	}

	if(moving_header)
	{
		curSplitCol = GetSplitCol(p, -1);
		curSplitRow = GetSplitRow(p, -1);

		if(resize_col_mode == 0 || resize_row_mode == 0)
			MouseAccel(p, fixed_top_click, fixed_left_click, keyflags);

		return Image::Arrow();
	}
	else if(moving_body)
	{
		curSplitRow = GetSplitRow(Point(0, p.y), -1);
		return Image::Arrow();
	}
	else if(mouse_move)
	{
		curSplitCol = GetSplitCol(p);
		curSplitRow = GetSplitRow(p);
		mouse_move = false;
	}

	curResizeCol = curResizeRow = false;

	if(resizing_cols && curSplitCol >= 0 || resizeCol)
	{
		if(curSplitCol >= 0 && hitems[curSplitCol].join > 0)
		{
			int idy = GetMouseRow(p, true, p.y < fixed_height, true);
			if(idy >= 0)
			{
				Item &it = items[vitems[idy].id][hitems[curSplitCol].id];
				if(it.isjoined && it.idx + it.cx != curSplitCol)
					return Image::Arrow();
			}
		}
		curResizeCol = true;
		return HorzPosImage();
	}
	else if(resizing_rows && curSplitRow >= 0 || resizeRow)
	{
		if(curSplitRow >= 0 && vitems[curSplitRow].join > 0)
		{
			int idx = GetMouseCol(p, true, p.x < fixed_width, true);
			if(idx >= 0)
			{
				Item &it = items[vitems[curSplitRow].id][hitems[idx].id];
				if(it.isjoined && it.idy + it.cy != curSplitRow)
					return Image::Arrow();
			}
		}
		curResizeRow = true;
		return VertPosImage ();
	}
	return Image::Arrow();
}


Added 04.04.2014:
Personally, I think that we need more multiplatform code, so I have added two following methods: HorzPosImage & VertPosImage.

Sincerely,
Klugier


U++ - one framework to rule them all.

[Updated on: Thu, 04 April 2013 16:18]

Report message to a moderator

Previous Topic: GridCtrl and popup menu problem
Next Topic: why the gridctrl display character abnormal??
Goto Forum:
  


Current Time: Fri Mar 29 10:57:31 CET 2024

Total time taken to generate the page: 0.01661 seconds