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 » TreeCtrl - changing plus/minus images
TreeCtrl - changing plus/minus images [message #16971] Wed, 23 July 2008 22:45 Go to previous message
rsrado is currently offline  rsrado
Messages: 1
Registered: July 2008
Location: Bulgaria
Junior Member
I would like to be able to set the plus/minus images to something different than CtrlImg::treeplus() and CtrlImg::treeminus(), in order to achieve some different look and feel.

I tried to find an easy way to do it, but as I couldn't, I made a small modification to the class:

In TreeCtrl.h:
class TreeCtrl : public Ctrl {
...
private:
    Image plusimage, minusimage;
...
public:
     	TreeCtrl& PlusImage(const Image& img)    { plusimage = img; return *this; }
	TreeCtrl& MinusImage(const Image& img)   { minusimage = img; return *this; }
...
}


In TreeCtrl.cpp:
TreeCtrl::TreeCtrl() {
...
	plusimage = CtrlImg::treeplus();
	minusimage = CtrlImg::treeminus();
...
}
...
void TreeCtrl::Paint(Draw& w)
{
....
      //ORIGINAL CODE: Image im = m.isopen ? CtrlImg::treeminus() : CtrlImg::treeplus();
      //REPLACED WITH:
      Image im = m.isopen ? minusimage : plusimage;
...


That worked just fine for me. I would be glad, to know if there is a better way and even more, if this helps somebody in some way.


 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Drag'nDrop on an OptionTree
Next Topic: Basic query: id, key and value in a TreeCtrl.
Goto Forum:
  


Current Time: Fri Apr 19 00:32:02 CEST 2024

Total time taken to generate the page: 0.02421 seconds