CoreGTK 3.10.0 CoreGTK is an Objective-C language binding for the GTK+ widget toolkit

- Main Page
- Classes
- Files

- File List

All Classes Functions Variables
CGTKColorSelection.m
1 /*
2 * CGTKColorSelection.m
3 * This file is part of CoreGTK
4 *
5 * Copyright (C) 2015 - Tyler Burton
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22 /*
23 * Modified by the CoreGTK Team, 2015. See the AUTHORS file for a
24 * list of people on the CoreGTK Team.
25 * See the ChangeLog files for a list of changes.
26 *
27 */
28
29 /*
30 * Objective-C imports
31 */
32 #import "CoreGTK/CGTKColorSelection.h"
33
34 @implementation CGTKColorSelection
35
36 +(BOOL)paletteFromStringWithStr:(NSString*) str andColors:(GdkColor**) colors andNcolors:(gint*) ncolors
37 {
38 return (gtk_color_selection_palette_from_string([str UTF8String], colors, ncolors) ? YES : NO);
39 }
40
41 +(NSString*)paletteToStringWithColors:(GdkColor*) colors andNcolors:(gint) ncolors
42 {
43 return [NSString stringWithUTF8String:gtk_color_selection_palette_to_string(colors, ncolors)];
44 }
45
46 +(GtkColorSelectionChangePaletteWithScreenFunc)setChangePaletteWithScreenHook:(GtkColorSelectionChangePaletteWithScreenFunc) func
47 {
48 return gtk_color_selection_set_change_palette_with_screen_hook(func);
49 }
50
51 -(id)init
52 {
53 self = [super initWithGObject:(GObject *)gtk_color_selection_new()];
54
55 if(self)
56 {
57 //Do nothing
58 }
59
60 return self;
61 }
62
63 -(GtkColorSelection*)COLORSELECTION
64 {
65 return GTK_COLOR_SELECTION([self GOBJECT]);
66 }
67
68 -(guint16)getCurrentAlpha
69 {
70 return gtk_color_selection_get_current_alpha(GTK_COLOR_SELECTION([self GOBJECT]));
71 }
72
73 -(void)getCurrentColor:(GdkColor*) color
74 {
75 gtk_color_selection_get_current_color(GTK_COLOR_SELECTION([self GOBJECT]), color);
76 }
77
78 -(void)getCurrentRgba:(GdkRGBA*) rgba
79 {
80 gtk_color_selection_get_current_rgba(GTK_COLOR_SELECTION([self GOBJECT]), rgba);
81 }
82
83 -(BOOL)getHasOpacityControl
84 {
85 return (gtk_color_selection_get_has_opacity_control(GTK_COLOR_SELECTION([self GOBJECT])) ? YES : NO);
86 }
87
88 -(BOOL)getHasPalette
89 {
90 return (gtk_color_selection_get_has_palette(GTK_COLOR_SELECTION([self GOBJECT])) ? YES : NO);
91 }
92
93 -(guint16)getPreviousAlpha
94 {
95 return gtk_color_selection_get_previous_alpha(GTK_COLOR_SELECTION([self GOBJECT]));
96 }
97
98 -(void)getPreviousColor:(GdkColor*) color
99 {
100 gtk_color_selection_get_previous_color(GTK_COLOR_SELECTION([self GOBJECT]), color);
101 }
102
103 -(void)getPreviousRgba:(GdkRGBA*) rgba
104 {
105 gtk_color_selection_get_previous_rgba(GTK_COLOR_SELECTION([self GOBJECT]), rgba);
106 }
107
108 -(BOOL)isAdjusting
109 {
110 return (gtk_color_selection_is_adjusting(GTK_COLOR_SELECTION([self GOBJECT])) ? YES : NO);
111 }
112
113 -(void)setCurrentAlpha:(guint16) alpha
114 {
115 gtk_color_selection_set_current_alpha(GTK_COLOR_SELECTION([self GOBJECT]), alpha);
116 }
117
118 -(void)setCurrentColor:(const GdkColor*) color
119 {
120 gtk_color_selection_set_current_color(GTK_COLOR_SELECTION([self GOBJECT]), color);
121 }
122
123 -(void)setCurrentRgba:(const GdkRGBA*) rgba
124 {
125 gtk_color_selection_set_current_rgba(GTK_COLOR_SELECTION([self GOBJECT]), rgba);
126 }
127
128 -(void)setHasOpacityControl:(BOOL) hasOpacity
129 {
130 gtk_color_selection_set_has_opacity_control(GTK_COLOR_SELECTION([self GOBJECT]), (hasOpacity ? TRUE : FALSE));
131 }
132
133 -(void)setHasPalette:(BOOL) hasPalette
134 {
135 gtk_color_selection_set_has_palette(GTK_COLOR_SELECTION([self GOBJECT]), (hasPalette ? TRUE : FALSE));
136 }
137
138 -(void)setPreviousAlpha:(guint16) alpha
139 {
140 gtk_color_selection_set_previous_alpha(GTK_COLOR_SELECTION([self GOBJECT]), alpha);
141 }
142
143 -(void)setPreviousColor:(const GdkColor*) color
144 {
145 gtk_color_selection_set_previous_color(GTK_COLOR_SELECTION([self GOBJECT]), color);
146 }
147
148 -(void)setPreviousRgba:(const GdkRGBA*) rgba
149 {
150 gtk_color_selection_set_previous_rgba(GTK_COLOR_SELECTION([self GOBJECT]), rgba);
151 }
152
153
154 @end
-[CGTKBase GOBJECT]
GObject * GOBJECT()
Definition: CGTKBase.m:82
-[CGTKColorSelection getHasOpacityControl]
BOOL getHasOpacityControl()
Definition: CGTKColorSelection.m:83
-[CGTKBase initWithGObject:]
id initWithGObject:(GObject *obj)
Definition: CGTKBase.m:48
-[CGTKColorSelection getHasPalette]
BOOL getHasPalette()
Definition: CGTKColorSelection.m:88
-[CGTKColorSelection init]
id init()
Definition: CGTKColorSelection.m:51
-[CGTKColorSelection getPreviousAlpha]
guint16 getPreviousAlpha()
Definition: CGTKColorSelection.m:93
-[CGTKColorSelection getCurrentAlpha]
guint16 getCurrentAlpha()
Definition: CGTKColorSelection.m:68
-[CGTKColorSelection isAdjusting]
BOOL isAdjusting()
Definition: CGTKColorSelection.m:108
-[CGTKColorSelection COLORSELECTION]
GtkColorSelection * COLORSELECTION()
Definition: CGTKColorSelection.m:63
CGTKColorSelection
Definition: CGTKColorSelection.h:34