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

CGTKNotebook.m
1 /*
2 * CGTKNotebook.m
3 * This file is part of CoreGTK
4 *
5 * Copyright (C) 2017 - 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, 2017. 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/CGTKNotebook.h"
33
34 @implementation CGTKNotebook
35
36 -(id)init
37 {
38 self = [super initWithGObject:(GObject *)gtk_notebook_new()];
39
40 if(self)
41 {
42 //Do nothing
43 }
44
45 return self;
46 }
47
48 -(GtkNotebook*)NOTEBOOK
49 {
50 return GTK_NOTEBOOK([self GOBJECT]);
51 }
52
53 -(gint)appendPageWithChild:(CGTKWidget*) child andTabLabel:(CGTKWidget*) tabLabel
54 {
55 return gtk_notebook_append_page(GTK_NOTEBOOK([self GOBJECT]), [child WIDGET], [tabLabel WIDGET]);
56 }
57
58 -(gint)appendPageMenuWithChild:(CGTKWidget*) child andTabLabel:(CGTKWidget*) tabLabel andMenuLabel:(CGTKWidget*) menuLabel
59 {
60 return gtk_notebook_append_page_menu(GTK_NOTEBOOK([self GOBJECT]), [child WIDGET], [tabLabel WIDGET], [menuLabel WIDGET]);
61 }
62
63 -(void)detachTab:(CGTKWidget*) child
64 {
65 gtk_notebook_detach_tab(GTK_NOTEBOOK([self GOBJECT]), [child WIDGET]);
66 }
67
68 -(CGTKWidget*)getActionWidget:(GtkPackType) packType
69 {
70 return [[CGTKWidget alloc] initWithGObject:(GObject *)gtk_notebook_get_action_widget(GTK_NOTEBOOK([self GOBJECT]), packType)];
71 }
72
73 -(gint)getCurrentPage
74 {
75 return gtk_notebook_get_current_page(GTK_NOTEBOOK([self GOBJECT]));
76 }
77
78 -(NSString*)getGroupName
79 {
80 return [NSString stringWithUTF8String:gtk_notebook_get_group_name(GTK_NOTEBOOK([self GOBJECT]))];
81 }
82
83 -(CGTKWidget*)getMenuLabel:(CGTKWidget*) child
84 {
85 return [[CGTKWidget alloc] initWithGObject:(GObject *)gtk_notebook_get_menu_label(GTK_NOTEBOOK([self GOBJECT]), [child WIDGET])];
86 }
87
88 -(NSString*)getMenuLabelText:(CGTKWidget*) child
89 {
90 return [NSString stringWithUTF8String:gtk_notebook_get_menu_label_text(GTK_NOTEBOOK([self GOBJECT]), [child WIDGET])];
91 }
92
93 -(gint)getNpages
94 {
95 return gtk_notebook_get_n_pages(GTK_NOTEBOOK([self GOBJECT]));
96 }
97
98 -(CGTKWidget*)getNthPage:(gint) pageNum
99 {
100 return [[CGTKWidget alloc] initWithGObject:(GObject *)gtk_notebook_get_nth_page(GTK_NOTEBOOK([self GOBJECT]), pageNum)];
101 }
102
103 -(BOOL)getScrollable
104 {
105 return (gtk_notebook_get_scrollable(GTK_NOTEBOOK([self GOBJECT])) ? YES : NO);
106 }
107
108 -(BOOL)getShowBorder
109 {
110 return (gtk_notebook_get_show_border(GTK_NOTEBOOK([self GOBJECT])) ? YES : NO);
111 }
112
113 -(BOOL)getShowTabs
114 {
115 return (gtk_notebook_get_show_tabs(GTK_NOTEBOOK([self GOBJECT])) ? YES : NO);
116 }
117
118 -(BOOL)getTabDetachable:(CGTKWidget*) child
119 {
120 return (gtk_notebook_get_tab_detachable(GTK_NOTEBOOK([self GOBJECT]), [child WIDGET]) ? YES : NO);
121 }
122
123 -(guint16)getTabHborder
124 {
125 return gtk_notebook_get_tab_hborder(GTK_NOTEBOOK([self GOBJECT]));
126 }
127
128 -(CGTKWidget*)getTabLabel:(CGTKWidget*) child
129 {
130 return [[CGTKWidget alloc] initWithGObject:(GObject *)gtk_notebook_get_tab_label(GTK_NOTEBOOK([self GOBJECT]), [child WIDGET])];
131 }
132
133 -(NSString*)getTabLabelText:(CGTKWidget*) child
134 {
135 return [NSString stringWithUTF8String:gtk_notebook_get_tab_label_text(GTK_NOTEBOOK([self GOBJECT]), [child WIDGET])];
136 }
137
138 -(GtkPositionType)getTabPos
139 {
140 return gtk_notebook_get_tab_pos(GTK_NOTEBOOK([self GOBJECT]));
141 }
142
143 -(BOOL)getTabReorderable:(CGTKWidget*) child
144 {
145 return (gtk_notebook_get_tab_reorderable(GTK_NOTEBOOK([self GOBJECT]), [child WIDGET]) ? YES : NO);
146 }
147
148 -(guint16)getTabVborder
149 {
150 return gtk_notebook_get_tab_vborder(GTK_NOTEBOOK([self GOBJECT]));
151 }
152
153 -(gint)insertPageWithChild:(CGTKWidget*) child andTabLabel:(CGTKWidget*) tabLabel andPosition:(gint) position
154 {
155 return gtk_notebook_insert_page(GTK_NOTEBOOK([self GOBJECT]), [child WIDGET], [tabLabel WIDGET], position);
156 }
157
158 -(gint)insertPageMenuWithChild:(CGTKWidget*) child andTabLabel:(CGTKWidget*) tabLabel andMenuLabel:(CGTKWidget*) menuLabel andPosition:(gint) position
159 {
160 return gtk_notebook_insert_page_menu(GTK_NOTEBOOK([self GOBJECT]), [child WIDGET], [tabLabel WIDGET], [menuLabel WIDGET], position);
161 }
162
163 -(void)nextPage
164 {
165 gtk_notebook_next_page(GTK_NOTEBOOK([self GOBJECT]));
166 }
167
168 -(gint)pageNum:(CGTKWidget*) child
169 {
170 return gtk_notebook_page_num(GTK_NOTEBOOK([self GOBJECT]), [child WIDGET]);
171 }
172
173 -(void)popupDisable
174 {
175 gtk_notebook_popup_disable(GTK_NOTEBOOK([self GOBJECT]));
176 }
177
178 -(void)popupEnable
179 {
180 gtk_notebook_popup_enable(GTK_NOTEBOOK([self GOBJECT]));
181 }
182
183 -(gint)prependPageWithChild:(CGTKWidget*) child andTabLabel:(CGTKWidget*) tabLabel
184 {
185 return gtk_notebook_prepend_page(GTK_NOTEBOOK([self GOBJECT]), [child WIDGET], [tabLabel WIDGET]);
186 }
187
188 -(gint)prependPageMenuWithChild:(CGTKWidget*) child andTabLabel:(CGTKWidget*) tabLabel andMenuLabel:(CGTKWidget*) menuLabel
189 {
190 return gtk_notebook_prepend_page_menu(GTK_NOTEBOOK([self GOBJECT]), [child WIDGET], [tabLabel WIDGET], [menuLabel WIDGET]);
191 }
192
193 -(void)prevPage
194 {
195 gtk_notebook_prev_page(GTK_NOTEBOOK([self GOBJECT]));
196 }
197
198 -(void)removePage:(gint) pageNum
199 {
200 gtk_notebook_remove_page(GTK_NOTEBOOK([self GOBJECT]), pageNum);
201 }
202
203 -(void)reorderChildWithChild:(CGTKWidget*) child andPosition:(gint) position
204 {
205 gtk_notebook_reorder_child(GTK_NOTEBOOK([self GOBJECT]), [child WIDGET], position);
206 }
207
208 -(void)setActionWidgetWithWidget:(CGTKWidget*) widget andPackType:(GtkPackType) packType
209 {
210 gtk_notebook_set_action_widget(GTK_NOTEBOOK([self GOBJECT]), [widget WIDGET], packType);
211 }
212
213 -(void)setCurrentPage:(gint) pageNum
214 {
215 gtk_notebook_set_current_page(GTK_NOTEBOOK([self GOBJECT]), pageNum);
216 }
217
218 -(void)setGroupName:(NSString*) groupName
219 {
220 gtk_notebook_set_group_name(GTK_NOTEBOOK([self GOBJECT]), [groupName UTF8String]);
221 }
222
223 -(void)setMenuLabelWithChild:(CGTKWidget*) child andMenuLabel:(CGTKWidget*) menuLabel
224 {
225 gtk_notebook_set_menu_label(GTK_NOTEBOOK([self GOBJECT]), [child WIDGET], [menuLabel WIDGET]);
226 }
227
228 -(void)setMenuLabelTextWithChild:(CGTKWidget*) child andMenuText:(NSString*) menuText
229 {
230 gtk_notebook_set_menu_label_text(GTK_NOTEBOOK([self GOBJECT]), [child WIDGET], [menuText UTF8String]);
231 }
232
233 -(void)setScrollable:(BOOL) scrollable
234 {
235 gtk_notebook_set_scrollable(GTK_NOTEBOOK([self GOBJECT]), (scrollable ? TRUE : FALSE));
236 }
237
238 -(void)setShowBorder:(BOOL) showBorder
239 {
240 gtk_notebook_set_show_border(GTK_NOTEBOOK([self GOBJECT]), (showBorder ? TRUE : FALSE));
241 }
242
243 -(void)setShowTabs:(BOOL) showTabs
244 {
245 gtk_notebook_set_show_tabs(GTK_NOTEBOOK([self GOBJECT]), (showTabs ? TRUE : FALSE));
246 }
247
248 -(void)setTabDetachableWithChild:(CGTKWidget*) child andDetachable:(BOOL) detachable
249 {
250 gtk_notebook_set_tab_detachable(GTK_NOTEBOOK([self GOBJECT]), [child WIDGET], (detachable ? TRUE : FALSE));
251 }
252
253 -(void)setTabLabelWithChild:(CGTKWidget*) child andTabLabel:(CGTKWidget*) tabLabel
254 {
255 gtk_notebook_set_tab_label(GTK_NOTEBOOK([self GOBJECT]), [child WIDGET], [tabLabel WIDGET]);
256 }
257
258 -(void)setTabLabelTextWithChild:(CGTKWidget*) child andTabText:(NSString*) tabText
259 {
260 gtk_notebook_set_tab_label_text(GTK_NOTEBOOK([self GOBJECT]), [child WIDGET], [tabText UTF8String]);
261 }
262
263 -(void)setTabPos:(GtkPositionType) pos
264 {
265 gtk_notebook_set_tab_pos(GTK_NOTEBOOK([self GOBJECT]), pos);
266 }
267
268 -(void)setTabReorderableWithChild:(CGTKWidget*) child andReorderable:(BOOL) reorderable
269 {
270 gtk_notebook_set_tab_reorderable(GTK_NOTEBOOK([self GOBJECT]), [child WIDGET], (reorderable ? TRUE : FALSE));
271 }
272
273
274 @end
-[CGTKNotebook getShowTabs]
BOOL getShowTabs()
Definition: CGTKNotebook.m:113
-[CGTKBase GOBJECT]
GObject * GOBJECT()
Definition: CGTKBase.m:82
-[CGTKNotebook getScrollable]
BOOL getScrollable()
Definition: CGTKNotebook.m:103
-[CGTKNotebook getTabVborder]
guint16 getTabVborder()
Definition: CGTKNotebook.m:148
-[CGTKBase initWithGObject:]
id initWithGObject:(GObject *obj)
Definition: CGTKBase.m:48
-[CGTKNotebook nextPage]
void nextPage()
Definition: CGTKNotebook.m:163
-[CGTKNotebook NOTEBOOK]
GtkNotebook * NOTEBOOK()
Definition: CGTKNotebook.m:48
CGTKNotebook
Definition: CGTKNotebook.h:34
-[CGTKWidget WIDGET]
GtkWidget * WIDGET()
Definition: CGTKWidget.m:61
-[CGTKNotebook init]
id init()
Definition: CGTKNotebook.m:36
-[CGTKNotebook prevPage]
void prevPage()
Definition: CGTKNotebook.m:193
-[CGTKNotebook getTabPos]
GtkPositionType getTabPos()
Definition: CGTKNotebook.m:138
-[CGTKNotebook getTabHborder]
guint16 getTabHborder()
Definition: CGTKNotebook.m:123
-[CGTKNotebook popupDisable]
void popupDisable()
Definition: CGTKNotebook.m:173
CGTKWidget
Definition: CGTKWidget.h:34
-[CGTKNotebook getShowBorder]
BOOL getShowBorder()
Definition: CGTKNotebook.m:108
-[CGTKNotebook getGroupName]
NSString * getGroupName()
Definition: CGTKNotebook.m:78
-[CGTKNotebook popupEnable]
void popupEnable()
Definition: CGTKNotebook.m:178
-[CGTKNotebook getNpages]
gint getNpages()
Definition: CGTKNotebook.m:93
-[CGTKNotebook getCurrentPage]
gint getCurrentPage()
Definition: CGTKNotebook.m:73