summaryrefslogtreecommitdiffstats
path: root/kate/kpybrowser/pybrowsenode.cpp
blob: 866924bf94af31cd542c813843af110b9be5e0cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
/***************************************************************************
                          pybrowsenode.cpp  -  description
                             -------------------
    begin                : Mon Aug 27 2001
    copyright            : (C) 2001 by Christian Bird
    email                : chrisb@lineo.com
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#include "pybrowsenode.h"

static const char *py_class_xpm[] = {
  "16 16 10 1",
  "       c None",
  ".      c #000000",
  "+      c #A4E8FC",
  "@      c #24D0FC",
  "#      c #001CD0",
  "$      c #0080E8",
  "%      c #C0FFFF",
  "&      c #00FFFF",
  "*      c #008080",
  "=      c #00C0C0",
  "     ..         ",
  "    .++..       ",
  "   .+++@@.      ",
  "  .@@@@@#...    ",
  "  .$$@@##.%%..  ",
  "  .$$$##.%%%&&. ",
  "  .$$$#.&&&&&*. ",
  "   ...#.==&&**. ",
  "   .++..===***. ",
  "  .+++@@.==**.  ",
  " .@@@@@#..=*.   ",
  " .$$@@##. ..    ",
  " .$$$###.       ",
  " .$$$##.        ",
  "  ..$#.         ",
  "    ..          "
};

static const char *py_method_xpm[] = {
  "16 16 5 1",
  "       c None",
  ".      c #000000",
  "+      c #FCFC80",
  "@      c #E0BC38",
  "#      c #F0DC5C",
  "                ",
  "                ",
  "                ",
  "          ..    ",
  "         .++..  ",
  "        .+++++. ",
  "       .+++++@. ",
  "    .. .##++@@. ",
  "   .++..###@@@. ",
  "  .+++++.##@@.  ",
  " .+++++@..#@.   ",
  " .##++@@. ..    ",
  " .###@@@.       ",
  " .###@@.        ",
  "  ..#@.         ",
  "    ..          "
};

static const char *py_function_xpm[] = {
  "16 16 6 1",
  "       c None",
  ".      c #240000",
  "+      c #000000",
  "@      c #FCFC80",
  "#      c #E0BC38",
  "$      c #F0DC5C",
  " ........       ",
  ".        .      ",
  ".        .      ",
  " ........ ++    ",
  "         +@@++  ",
  "        +@@@@@+ ",
  "       +@@@@@#+ ",
  "    ++ +$$@@##+ ",
  "   +@@++$$$###+ ",
  "  +@@@@@+$$##+  ",
  " +@@@@@#++$#+   ",
  " +$$@@##+ ++    ",
  " +$$$###+       ",
  " +$$$##+        ",
  "  ++$#+         ",
  "    ++          "
};


PyBrowseNode::PyBrowseNode (QListViewItem * parent, const QString &name,
			    const QString &signature, int nodeType):
QListViewItem (parent, signature)
{
  init (name, signature, nodeType);
}

PyBrowseNode::PyBrowseNode (QListView * parent, const QString &name,
			    const QString &signature, int nodeType):
QListViewItem (parent, signature)
{
  init (name, signature, nodeType);
}

void
PyBrowseNode::init (const QString &a_name, const QString &a_signature, int nodeType)
{
  node_type = nodeType;
  if (nodeType == PYCLASS)
    setPixmap (0, QPixmap (py_class_xpm));
  if (nodeType == PYMETHOD)
    setPixmap (0, QPixmap (py_method_xpm));
  if (nodeType == PYFUNCTION)
    setPixmap (0, QPixmap (py_function_xpm));

  name = a_name;
  signature = a_signature;
}

PyBrowseNode::~PyBrowseNode ()
{
  setPixmap (0, QPixmap (py_class_xpm));
}

void
PyBrowseNode::setName (const QString &a_name)
{
  name = a_name;
  setText (0, name);
}

QString
PyBrowseNode::getName ()const
{
  return name;
}

void
PyBrowseNode::setSig (const QString &a_signature)
{
  signature = a_signature;

}

QString
PyBrowseNode::getSig ()const
{
  return signature;
}

void
PyBrowseNode::setLine (int a_line)
{
  line = a_line;
}

int
PyBrowseNode::getLine ()const
{
  return line;
}


void
PyBrowseNode::setType (int type)
{
  node_type = type;
}

int
PyBrowseNode::getType ()const
{
  return node_type;
}

void
PyBrowseNode::setClass (const QString &a_method_class)
{
  node_class = a_method_class;
}

QString
PyBrowseNode::getClass ()const
{
  return node_class;
}

QString
PyBrowseNode::getQualifiedName ()const
{
  if (node_type == PYCLASS)
    return node_class;
  if (node_type == PYMETHOD)
    return node_class + "::" + name;
   if (node_type == PYFUNCTION)
      return name;
   return name;
}