Re: Row with different columns at runtime?



Am Freitag, den 08.02.2008, 18:09 +0100 schrieb Johannes Lorenz:
> Hi,
> 
> I am using GTKmm for a little project. I have a problem because I do not know how to solve the following problem:
> 
> I have a List Store. In the most right column shall EITHER be a text,
>  OR be a combo box, OR be a button etc. My programme shall read a file
>  which shall tell it which type (text, combo, button etc.) to use for
>  this column in the current row.
> 
> However, I do not know how I can realize such a dynamic row. Is there a
>  solution?

Seems you have to write your on cell renderer. Maybe you can get it
done, by referencing all the pre-built cell renderers you need, and
forward function calls to the instance matching your data (pseudo code):

struct _FunkyCellRenderer
{
  GtkCellRenderer *text;
  GtkCellRenderer *combo;
  GtkCellRenderer *button;
};

static void
funky_cell_renderer_some_function (GtkCellRenderer *cell, ...)
{
  FunkyCellRenderer *self = FUNKY_CELL_RENDERER (cell);

  switch (self->mode)
    {
       case TEXT_MODE:
         gtk_cell_renderer_some_function (self->text, ...);
         break;

       ...
     }
}

Ciao,
Mathias
-- 
Mathias Hasselmann <mathias hasselmann gmx de>
Openismus GmbH: http://www.openismus.com/
Personal Site: http://taschenorakel.de/

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]