summaryrefslogtreecommitdiffstats
path: root/kdejava/koala/org/kde/koala/KPalette.java
blob: 1d763e1a64cecf3414d9fff9d3a2f10e4a5d15ec (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
//Auto-generated by kalyptus. DO NOT EDIT.
package org.kde.koala;

import org.kde.qt.Qt;
import org.kde.qt.TQColor;
import org.kde.qt.QtSupport;
import java.util.ArrayList;

/**

 Class for handling Palettes.
 This class makes it easy to handle palettes.
 A palette is a set of colors. This class can read
 and write palettes from and to a file.
 This class uses the "GIMP" palette file format.
 This class is totally unrelated to TQPalette.
		@author Waldo Bastian (bastian@kde.org)

		@short    Class for handling Palettes.

*/
public class KPalette implements QtSupport {
	private long _qt;
	private boolean _allocatedInJavaWorld = true;
	protected KPalette(Class dummy){}

	/**	
		 Used to specify whether a palette may be edited.
				@short    Used to specify whether a palette may be edited.
		@see #editable
		@see #setEditable
	*/
	public static final int Yes = 0;
	public static final int No = 1;
	public static final int Ask = 2;

	/**	
		 KPalette constructor. Creates a KPalette from a file
		 the filename is derived from the name.
			@param name The name of palette as returned by getPaletteList()
				@short    KPalette constructor.
	*/
	public KPalette(String name) {
		newKPalette(name);
	}
	private native void newKPalette(String name);
	public KPalette() {
		newKPalette();
	}
	private native void newKPalette();
	/**	
		 KPalette copy constructor.
				@short    KPalette copy constructor.
	*/
	public KPalette(KPalette arg1) {
		newKPalette(arg1);
	}
	private native void newKPalette(KPalette arg1);
	/**	
		 Save the palette
				@return 'true' if successful

		@short    Save the palette
	*/
	public native boolean save();
	/**	
		 Get the description of the palette.
				@return the description of the palette.

		@short    Get the description of the palette.
	*/
	public native String description();
	/**	   	
		 Set the description of the palette.
			@param desc the new description
				@short     	  Set the description of the palette.
	*/
	public native void setDescription(String desc);
	/**	
		 Get the name of the palette. 
				@return the name of the palette

		@short    Get the name of the palette.
	*/
	public native String name();
	/**	
		 Set the name of the palette.
			@param name the name of the palette
				@short    Set the name of the palette.
	*/
	public native void setName(String name);
	/**	
		 Returns whether the palette may be edited.
				@return the state of the palette

		@short    Returns whether the palette may be edited.
	*/
	public native int editable();
	/**	
		 Change whether the palette may be edited.
			@param editable the state of the palette
				@short    Change whether the palette may be edited.
	*/
	public native void setEditable(int editable);
	/**	
		 Return the number of colors in the palette.
				@return the number of colors

		@short    Return the number of colors in the palette.
	*/
	public native int nrColors();
	/**	
		 Find color by index.
			@param index the index of the desired color
				@return The <code>index</code> -th color of the palette, null if not found.

		@short    Find color by index.
	*/
	public native TQColor color(int index);
	/**	
		 Find index by <code>color.</code>
			@param color the color to find
				@return The index of the color in the palette or -1 if the
 color is not found.

		@short    Find index by <code>color.</code>
	*/
	public native int findColor(TQColor color);
	/**	
		 Find color name by <code>index.</code>
			@param index the index of the color
				@return The name of the <code>index</code> -th color.
 Note that not all palettes have named the colors. Null is
 returned if the color does not exist or has no name.

		@short    Find color name by <code>index.</code>
	*/
	public native String colorName(int index);
	/**	
		 Find color name by <code>color.</code>
				@return The name of color according to this palette.
 Note that not all palettes have named the colors.
 Note also that each palette can give the same color
 a different name.

		@short    Find color name by <code>color.</code>
	*/
	public native String colorName(TQColor color);
	/**	
		 Add a color.
			@param newColor The color to add.
			@param newColorName The name of the color, null to remove 
		                     the name.
				@return The index of the added color.

		@short    Add a color.
	*/
	public native int addColor(TQColor newColor, String newColorName);
	public native int addColor(TQColor newColor);
	/**	
		 Change a color.
			@param index Index of the color to change
			@param newColor The new color.
			@param newColorName The new color name, null to remove 
		                     the name.
				@return The index of the new color or -1 if the color couldn't
 be changed.

		@short    Change a color.
	*/
	public native int changeColor(int index, TQColor newColor, String newColorName);
	public native int changeColor(int index, TQColor newColor);
	/**	
		 Change a color.
			@param oldColor The original color
			@param newColor The new color.
			@param newColorName The new color name, null to remove 
		                     the name.
				@return The index of the new color or -1 if the color couldn't
 be changed.

		@short    Change a color.
	*/
	public native int changeColor(TQColor oldColor, TQColor newColor, String newColorName);
	public native int changeColor(TQColor oldColor, TQColor newColor);
	/**	
		 Query which KDE palettes are installed.
				@return A list with a palette names.
    
		@short    Query which KDE palettes are installed.
	*/
	public static native ArrayList getPaletteList();
	/** Deletes the wrapped C++ instance */
	protected native void finalize() throws InternalError;
	/** Delete the wrapped C++ instance ahead of finalize() */
	public native void dispose();
	/** Has the wrapped C++ instance been deleted? */
	public native boolean isDisposed();
}