~ubuntu-branches/debian/sid/gnome-color-chooser/sid

« back to all changes in this revision

Viewing changes to src/modwidget.cc

  • Committer: Bazaar Package Importer
  • Author(s): Werner Pantke
  • Date: 2008-01-11 14:09:32 UTC
  • Revision ID: james.westby@ubuntu.com-20080111140932-sdtlwa781q52bclm
Tags: upstream-0.2.3
ImportĀ upstreamĀ versionĀ 0.2.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright (C) 2006-2007 W. Pantke <gnome-color-chooser@punk-ass-bitch.org>
 
2
//  
 
3
// This program is free software; you can redistribute it and/or modify
 
4
// it under the terms of the GNU General Public License as published by
 
5
// the Free Software Foundation; either version 2 of the License, or
 
6
// (at your option) any later version.
 
7
// 
 
8
// This program is distributed in the hope that it will be useful,
 
9
// but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
// GNU General Public License for more details.
 
12
// 
 
13
// You should have received a copy of the GNU General Public License
 
14
// along with this program; if not, write to the Free Software 
 
15
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
16
 
 
17
#include "modwidget.h"
 
18
 
 
19
 
 
20
void ModWidget::init(int id, TreeHandler* config)
 
21
{
 
22
  this->isEngineWidget  = false;
 
23
  this->isParamWidget   = false;
 
24
  this->isProfileWidget = false;
 
25
  this->id = id;
 
26
  this->setConfig(config);
 
27
  ModWidget::register_widget(this);
 
28
  this->reload();
 
29
}
 
30
 
 
31
void ModWidget::init(string category, string id, TreeHandler* config)
 
32
{
 
33
  this->isEngineWidget  = false;
 
34
  this->isParamWidget   = true;
 
35
  this->isProfileWidget = false;
 
36
  this->id_string = id;
 
37
  this->category = category;
 
38
  this->setConfig(config);
 
39
//  ModWidget::register_widget(this); // Don't register param widgets!!
 
40
  this->reload();
 
41
}
 
42
 
 
43
void ModWidget::init(string category, TreeHandler* config) // as engine widget
 
44
{
 
45
  this->isEngineWidget  = true;
 
46
  this->isParamWidget   = false;
 
47
  this->isProfileWidget = false;
 
48
  this->category = category;
 
49
  this->setConfig(config);
 
50
  ModWidget::register_widget(this);
 
51
  this->reload();
 
52
}
 
53
 
 
54
void ModWidget::init(TreeHandler* config) // as profile widget
 
55
{
 
56
  this->isEngineWidget  = false;
 
57
  this->isParamWidget   = false;
 
58
  this->isProfileWidget = true;
 
59
  this->setConfig(config);
 
60
  ModWidget::register_widget(this);
 
61
  this->reload();
 
62
}
 
63
 
 
64
 
 
65
void ModWidget::setConfig(TreeHandler* config)
 
66
{
 
67
  this->m_pConfig = config;
 
68
}
 
69
 
 
70
GType ModWidget::get_base_type()
 
71
{
 
72
  return gtk_widget_get_type();
 
73
}
 
74
 
 
75
void ModWidget::register_widget(ModWidget* new_widget)
 
76
{
 
77
  if(widgets == NULL)
 
78
  {
 
79
    widgets = new Widget();
 
80
    widgets->p = new_widget;
 
81
  }
 
82
  else
 
83
  {
 
84
    Widget *widget = widgets;
 
85
    while(widget->next != NULL)
 
86
      widget = widget->next;
 
87
 
 
88
    widget->next = new Widget();
 
89
    if(widget->next)
 
90
      widget->next->p = new_widget;
 
91
  }
 
92
}
 
93
 
 
94
 
 
95
void ModWidget::reload_all_widgets()
 
96
{
 
97
  Widget *widget = widgets;
 
98
  while(widget != NULL)
 
99
  {
 
100
    if(widget->p)
 
101
      widget->p->reload();
 
102
 
 
103
    widget = widget->next;
 
104
  }
 
105
}
 
106
 
 
107
ModWidget::Widget::Widget()
 
108
{
 
109
  p    = NULL;
 
110
  next = NULL;
 
111
}