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 » TreeCtrl » Changing tree control style
Re: Changing tree control style [message #29767 is a reply to message #29764] Mon, 15 November 2010 17:05 Go to previous messageGo to previous message
koldo is currently offline  koldo
Messages: 3360
Registered: August 2008
Senior Veteran
Quote:

AFAIK it's not true. I've checked code in CtrlCore and it support dashed lines without Painter to be included, see DrawWin32.cpp @ 144 and DrawX11.cpp @ 307.

Hello Andrei

Sorry, it is not negative color, it is negative width. See this in DrawWin32.cpp @ 144:
void SystemDraw::SetDrawPen(int width, Color color) {
...
	if(width != lastPen || color != lastPenColor) {
		static int penstyle[] = {
			PS_NULL, PS_SOLID, PS_DASH,
		#ifndef PLATFORM_WINCE
			PS_DOT, PS_DASHDOT, PS_DASHDOTDOT
		#endif
		};
		HPEN oldPen = actPen;
		actPen = CreatePen(width < 0 ? penstyle[-width - 1] : PS_SOLID,
			               width < 0 ? 0 : width, GetColor(color));
...
	}
}


And this in DrawX1132.cpp @ 307, see variable "i":
void SystemDraw::SetLineStyle(int width) {
...
	if(width < PEN_SOLID) {
		static const char dash[] = { 18, 6 };
		static const char dot[] = { 3, 3 };
		static const char dashdot[] = { 9, 6, 3, 6 };
		static const char dashdotdot[] = { 9, 3, 3, 3, 3, 3 };
		static struct {
			const char *dash;
			int   len;
		} ds[] = {
			{ dash, __countof(dash) },
			{ dot, __countof(dot) },
			{ dashdot, __countof(dashdot) },
			{ dashdotdot, __countof(dashdotdot) }
		};
		int i = -(width - PEN_DASH);
		ASSERT(i >= 0 && i < 4);
		XSetDashes(Xdisplay, gc, 0, ds[i].dash, ds[i].len);
	}
	XSetLineAttributes(Xdisplay, gc, max(width, 1),
	                   width < PEN_SOLID ? LineOnOffDash : LineSolid, CapRound, JoinRound);
}

A width == -3 means dashed, -4 means dotted, ..., all with a thin line.


Best regards
IƱaki
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Anomaly in tree control
Next Topic: PROPOSAL: TreeCtrl optionally owns Ctrl's in Node
Goto Forum:
  


Current Time: Wed May 08 02:44:43 CEST 2024

Total time taken to generate the page: 0.03193 seconds