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 » Look and Chameleon Technology » Chameleon-ized EditField
Re: Chameleon-ized EditField [message #10352 is a reply to message #9193] Tue, 03 July 2007 18:41 Go to previous messageGo to previous message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
Currently disabled EditFields show pink if they have invalid data, which doesn't make sense to me, so I've added an extra check (and it now caches the result of IsShowEnabled since it's called 5 times):

void EditField::Paint(Draw& w)
{
	Size sz = GetSize();
	bool f = HasBorder();
	bool enabled = IsShowEnabled();
	const EditField::Style *st = style ? style : &StyleDefault();
	Color paper = enabled && !IsReadOnly() ? (HasFocus() ? st->focus : st->paper) : st->disabled;
	if(nobg)
		paper = Null;
	Color ink = enabled ? st->text : st->textdisabled;
	if(convert && enabled && convert->Scan(text).IsError())
		paper = st->invalid;
	int fcy = font.Info().GetHeight();
	int yy = GetTy();
	w.DrawRect(0, 0, 2, sz.cy, paper);
	w.DrawRect(0, 0, sz.cx, yy, paper);
	w.DrawRect(0, yy + fcy, sz.cx, sz.cy - yy - fcy, paper);
	w.DrawRect(sz.cx - 2, 0, 2, sz.cy, paper);
	w.Clipoff(2, yy, sz.cx - 4, fcy);
	int x = -sc;
	if(IsNull(text) && !IsNull(nulltext)) {
		const wchar *txt = nulltext;
		Paints(w, x, fcy, txt, nullink, paper, nulltext.GetLength(), false);
	}
	else {
		const wchar *txt = text;
		int l, h;
		if(GetSelection(l, h)) {
			Paints(w, x, fcy, txt, ink, paper, l, password);
			Paints(w, x, fcy, txt, enabled ? st->selectedtext : paper,
			                       enabled ? st->selected : ink, h - l, password);
			Paints(w, x, fcy, txt, ink, paper, text.GetLength() - h, password);
		}
		else
			Paints(w, x, fcy, txt, ink, paper, text.GetLength(), password);
	}
	w.DrawRect(x, 0, 9999, fcy, paper);
	w.End();
//	w.DrawRect(dropcaret, LtBlue());
	DrawTiles(w, dropcaret, CtrlImg::checkers());
}

Could this be added to Uppsrc please?

James
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: OS X Aqua look and feel?
Next Topic: Native Icon Themeing
Goto Forum:
  


Current Time: Tue May 07 06:36:11 CEST 2024

Total time taken to generate the page: 0.02733 seconds