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
CGTKButton.m
1 /*
2 * CGTKButton.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/CGTKButton.h"
33
34 @implementation CGTKButton
35
36 -(id)init
37 {
38 self = [super initWithGObject:(GObject *)gtk_button_new()];
39
40 if(self)
41 {
42 //Do nothing
43 }
44
45 return self;
46 }
47
48 -(id)initFromIconNameWithIconName:(NSString*) iconName andSize:(GtkIconSize) size
49 {
50 self = [super initWithGObject:(GObject *)gtk_button_new_from_icon_name([iconName UTF8String], size)];
51
52 if(self)
53 {
54 //Do nothing
55 }
56
57 return self;
58 }
59
60 -(id)initFromStock:(NSString*) stockId
61 {
62 self = [super initWithGObject:(GObject *)gtk_button_new_from_stock([stockId UTF8String])];
63
64 if(self)
65 {
66 //Do nothing
67 }
68
69 return self;
70 }
71
72 -(id)initWithLabel:(NSString*) label
73 {
74 self = [super initWithGObject:(GObject *)gtk_button_new_with_label([label UTF8String])];
75
76 if(self)
77 {
78 //Do nothing
79 }
80
81 return self;
82 }
83
84 -(id)initWithMnemonic:(NSString*) label
85 {
86 self = [super initWithGObject:(GObject *)gtk_button_new_with_mnemonic([label UTF8String])];
87
88 if(self)
89 {
90 //Do nothing
91 }
92
93 return self;
94 }
95
96 -(GtkButton*)BUTTON
97 {
98 return GTK_BUTTON([self GOBJECT]);
99 }
100
101 -(void)clicked
102 {
103 gtk_button_clicked(GTK_BUTTON([self GOBJECT]));
104 }
105
106 -(void)enter
107 {
108 gtk_button_enter(GTK_BUTTON([self GOBJECT]));
109 }
110
111 -(void)getAlignmentWithXalign:(gfloat*) xalign andYalign:(gfloat*) yalign
112 {
113 gtk_button_get_alignment(GTK_BUTTON([self GOBJECT]), xalign, yalign);
114 }
115
116 -(BOOL)getAlwaysShowImage
117 {
118 return (gtk_button_get_always_show_image(GTK_BUTTON([self GOBJECT])) ? YES : NO);
119 }
120
121 -(GdkWindow*)getEventWindow
122 {
123 return gtk_button_get_event_window(GTK_BUTTON([self GOBJECT]));
124 }
125
126 -(BOOL)getFocusOnClick
127 {
128 return (gtk_button_get_focus_on_click(GTK_BUTTON([self GOBJECT])) ? YES : NO);
129 }
130
131 -(CGTKWidget*)getImage
132 {
133 return [[CGTKWidget alloc] initWithGObject:(GObject *)gtk_button_get_image(GTK_BUTTON([self GOBJECT]))];
134 }
135
136 -(GtkPositionType)getImagePosition
137 {
138 return gtk_button_get_image_position(GTK_BUTTON([self GOBJECT]));
139 }
140
141 -(NSString*)getLabel
142 {
143 return [NSString stringWithUTF8String:gtk_button_get_label(GTK_BUTTON([self GOBJECT]))];
144 }
145
146 -(GtkReliefStyle)getRelief
147 {
148 return gtk_button_get_relief(GTK_BUTTON([self GOBJECT]));
149 }
150
151 -(BOOL)getUseStock
152 {
153 return (gtk_button_get_use_stock(GTK_BUTTON([self GOBJECT])) ? YES : NO);
154 }
155
156 -(BOOL)getUseUnderline
157 {
158 return (gtk_button_get_use_underline(GTK_BUTTON([self GOBJECT])) ? YES : NO);
159 }
160
161 -(void)leave
162 {
163 gtk_button_leave(GTK_BUTTON([self GOBJECT]));
164 }
165
166 -(void)pressed
167 {
168 gtk_button_pressed(GTK_BUTTON([self GOBJECT]));
169 }
170
171 -(void)released
172 {
173 gtk_button_released(GTK_BUTTON([self GOBJECT]));
174 }
175
176 -(void)setAlignmentWithXalign:(gfloat) xalign andYalign:(gfloat) yalign
177 {
178 gtk_button_set_alignment(GTK_BUTTON([self GOBJECT]), xalign, yalign);
179 }
180
181 -(void)setAlwaysShowImage:(BOOL) alwaysShow
182 {
183 gtk_button_set_always_show_image(GTK_BUTTON([self GOBJECT]), (alwaysShow ? TRUE : FALSE));
184 }
185
186 -(void)setFocusOnClick:(BOOL) focusOnClick
187 {
188 gtk_button_set_focus_on_click(GTK_BUTTON([self GOBJECT]), (focusOnClick ? TRUE : FALSE));
189 }
190
191 -(void)setImage:(CGTKWidget*) image
192 {
193 gtk_button_set_image(GTK_BUTTON([self GOBJECT]), [image WIDGET]);
194 }
195
196 -(void)setImagePosition:(GtkPositionType) position
197 {
198 gtk_button_set_image_position(GTK_BUTTON([self GOBJECT]), position);
199 }
200
201 -(void)setLabel:(NSString*) label
202 {
203 gtk_button_set_label(GTK_BUTTON([self GOBJECT]), [label UTF8String]);
204 }
205
206 -(void)setRelief:(GtkReliefStyle) newstyle
207 {
208 gtk_button_set_relief(GTK_BUTTON([self GOBJECT]), newstyle);
209 }
210
211 -(void)setUseStock:(BOOL) useStock
212 {
213 gtk_button_set_use_stock(GTK_BUTTON([self GOBJECT]), (useStock ? TRUE : FALSE));
214 }
215
216 -(void)setUseUnderline:(BOOL) useUnderline
217 {
218 gtk_button_set_use_underline(GTK_BUTTON([self GOBJECT]), (useUnderline ? TRUE : FALSE));
219 }
220
221
222 @end
-[CGTKBase GOBJECT]
GObject * GOBJECT()
Definition: CGTKBase.m:82
-[CGTKButton leave]
void leave()
Definition: CGTKButton.m:161
-[CGTKBase initWithGObject:]
id initWithGObject:(GObject *obj)
Definition: CGTKBase.m:48
-[CGTKButton released]
void released()
Definition: CGTKButton.m:171
-[CGTKButton getUseUnderline]
BOOL getUseUnderline()
Definition: CGTKButton.m:156
-[CGTKButton init]
id init()
Definition: CGTKButton.m:36
-[CGTKButton getFocusOnClick]
BOOL getFocusOnClick()
Definition: CGTKButton.m:126
CGTKButton
Definition: CGTKButton.h:34
-[CGTKButton pressed]
void pressed()
Definition: CGTKButton.m:166
-[CGTKWidget WIDGET]
GtkWidget * WIDGET()
Definition: CGTKWidget.m:61
-[CGTKButton getUseStock]
BOOL getUseStock()
Definition: CGTKButton.m:151
-[CGTKButton getAlwaysShowImage]
BOOL getAlwaysShowImage()
Definition: CGTKButton.m:116
-[CGTKButton getRelief]
GtkReliefStyle getRelief()
Definition: CGTKButton.m:146
-[CGTKButton enter]
void enter()
Definition: CGTKButton.m:106
-[CGTKButton getImage]
CGTKWidget * getImage()
Definition: CGTKButton.m:131
-[CGTKButton BUTTON]
GtkButton * BUTTON()
Definition: CGTKButton.m:96
-[CGTKButton getImagePosition]
GtkPositionType getImagePosition()
Definition: CGTKButton.m:136
-[CGTKButton getLabel]
NSString * getLabel()
Definition: CGTKButton.m:141
CGTKWidget
Definition: CGTKWidget.h:34
-[CGTKButton getEventWindow]
GdkWindow * getEventWindow()
Definition: CGTKButton.m:121
-[CGTKButton clicked]
void clicked()
Definition: CGTKButton.m:101