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 » Global style changes using Chameleon...
Global style changes using Chameleon... [message #15247] Fri, 11 April 2008 16:48 Go to previous message
tvanriper is currently offline  tvanriper
Messages: 85
Registered: September 2007
Location: Germantown, MD, USA
Member
Introduction

I wanted my application to use custom graphics and colors for a lot of things, to include my buttons, text boxes, and tab headers.

I found it very tedious to do this for every single control in every single dialog in my application, though. This gets extremely rough if your application has quite a few dialogs in it, and you want everything to look uniform.

So, I figured the whole point of Chameleon was to make this kind of thing easier, and I set about figuring out how to use it this way. Documentation is scarce, since it's pretty new... but I can read source code well enough, so I thought I'd give it a try.

Hopefully, I can describe what I learned in some fashion, so others can more easily use this bit of technology. If I have more time, and if nobody else beats me to it, I'll try my hand at writing a decent guide for the help topics later.

Using Chameleon for global style changes

If you're looking to use Chameleon for this sort of purpose, you need to remember the word 'Write'. All of the Chameleon functions intended to help you modify the initial values tend to have the word 'Write' in it somewhere.

So, for example, if you want to change the color of the 'paper' attribute, so anything using SColorPaper will use your color instead of the default, you have to call SColorPaper_Write( [your color here] ).

You can even use LabelBoxTextColor_Write to help change the default color of your label box texts.

Here's a quick, but non-exhaustive, list of attributes whose colors you can change:


  • SColorPaper_Write
  • SColorText_Write
  • SColorHighlight_Write
  • SColorHighlightText_Write
  • SColorMenu_Write
  • SColorMenuText_Write
  • SColorDisabled_Write
  • SColorFace_Write
  • SColorShadow_Write
  • LabelBoxTextColor_Write


You may want to hunt around for others, as needed.

This said, sometimes you might want to modify the default graphics for a particular item... maybe you want a different look to your progress bar, or your buttons.

The best approach for this, I think, involves calling the Write() function for your particular style, and modifying the object directly.

Here's an example using the Write() function:

Button::Style& button_style = Button::StyleNormal().Write();
button_style.look[0] = MyButton::Get(0);
button_style.look[1] = MyButton::Get(1);
button_style.look[2] = MyButton::Get(2);
button_style.look[3] = MyButton::Get(3);
button_style.textcolor[0] = White;
button_style.textcolor[1] = White;
button_style.textcolor[2] = White;
button_style.textcolor[3] = Gray;


Edit:

Edited to reflect some of the information mentioned in this thread.

[Updated on: Tue, 15 April 2008 20:51]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: HeaderCtrl adjustment...
Next Topic: Does SetStyle needs a refresh ?
Goto Forum:
  


Current Time: Sat Apr 27 21:20:13 CEST 2024

Total time taken to generate the page: 0.05221 seconds