473,397 Members | 1,972 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

TreeView Design

I am trying to come up with a design for a tree/list view.

The list wants to be able to take any data type, and an object it can
use to render it in the tree. The trouble starts when you have a
variable number of columns.

Below is my current thinking, as inspired by the GTKmm and Qt
interfaces. The problem is the creeping effect of the templates. By
having a base class "TreeModelColumnBase" that isn't templated, and
then a templated derivation, I can have as many columns as I like in
"TreeModelColumnRecord". But how can I set values in it without the
templates creeping there way up to the "TreeModel"?

Hopefully this makes sense, any help is greatly appreciated.

<code>
class TreeModelColumnBase
{
template <typename T>
bool operator = (const T & _Val)
{
// TODO: what can i do here?
}
};

template <typename T, typename Renderer>
class TreeModelColumn : public TreeModelColumnBase
{
private:
Renderer m_Renderer;
T m_ColumnData;
};

class TreeModelColumnRecord
{
private:
std::list<TreeModelColumnBasem_ColumnsList;
};

class TreeModel
{
Iterator begin()
{
return m_RowsList.begin();
}
private:
std::list<TreeModelColumnRecordm_RowsList;

};

Aug 31 '06 #1
1 1809
To make this clearer.

The problem really is how can I have a container that stores various
instances of a templated class, and be able to meaningfully interact
with the classes in that container. For example, assign them.

struct Base;

template <typename T>
struct Derived { T member; };

std::list<Base *myList;

for(std::list<Base *>::iterator it = myList.begin(); it !=
myList.end(); ++ it)
{
it->member = ???
}

Aug 31 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Jim | last post by:
The below problem occurs randomly too, but I've managed to isolate a sequence of events when it always happens: I have two forms (say Form1 and Form2). Form 1 contains a TreeView control. A...
4
by: Ian Powell | last post by:
Hi I've got objects in an sorted ArrayList like: P:\ P:\\DOCS P:\\i386 P:\\i386\ASMS P:\\i386\ASMS\1000 P:\\i386\ASMS\1000\MSFT
1
by: paradox | last post by:
I want to have a TreeView that shows an image on some items, but not all. Basically, if a certain condition is true, a caution icon is placed next to the treeview item. The problem is that, by...
3
by: Hazz | last post by:
I am just beginning to design a Treeview display (winforms) for wine regions. Problem. Some wine growing regions belong to two counties. Eg. Carneros is in both Napa and Sonoma Counties. Although...
6
by: J.S. | last post by:
I have a TreeView control in the left panel of a SplitContainer. When I click on various nodes in the TreeView I would like different sets of buttons and textboxes to appear in the right panel. ...
1
by: Webster | last post by:
Hello, I created a User Control consisting of a TreeView and an ImageList. I've populated the ImageList with pictures (design-time using the Properties Window), and I've added some Nodes to the...
4
by: Andrew Robinson | last post by:
I am using a TreeView to perform navigation and have a few nodes that need to generate a popup menu. For this, I use the SelectedNodeChanged event and then add the relevant "window.open" script to...
2
by: Stuart | last post by:
Hi, For design reasons I need treeview control to display right-to-left, i.e, with its parent nodes to the right and the child nodes indented to the left, however I cannot find a suitable...
18
by: =?Utf-8?B?TGkgV2VuZw==?= | last post by:
Hi, Is there a way for TreeView to have multiple selections? But I am not talking about its checked boxes. I want a way similar to ListView with MultiSelect = True. So I can use or key and...
2
by: Maddy | last post by:
I need to populate a treeview from a text file. The data in it is in the following form 1. (Parent Node) (a) (Child Node) (b) (Child Node) .. .. .. (k) (Child Node)
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.