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
CGTKInfoBar.m
1 /*
2 * CGTKInfoBar.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/CGTKInfoBar.h"
33
34 @implementation CGTKInfoBar
35
36 -(void)addButtonTextResponseDictionary:(NSDictionary *)buttonTextDict
37 {
38 CGTKTypeWrapper *wrapper;
39
40 for(NSString *text in buttonTextDict)
41 {
42 wrapper = [buttonTextDict objectForKey:text];
43
44 [self addButtonWithButtonText:text andResponseId:wrapper.gintValue];
45 }
46 }
47
48 -(id)initWithButtonTextResponseDictionary:(NSDictionary *)buttonTextDict
49 {
50 self = [super initWithGObject:(GObject *)gtk_info_bar_new()];
51
52 if(self)
53 {
54 CGTKTypeWrapper *wrapper;
55
56 for(NSString *text in buttonTextDict)
57 {
58 wrapper = [buttonTextDict objectForKey:text];
59
60 [self addButtonWithButtonText:text andResponseId:wrapper.gintValue];
61 }
62 }
63
64 return self;
65 }
66
67 -(id)init
68 {
69 self = [super initWithGObject:(GObject *)gtk_info_bar_new()];
70
71 if(self)
72 {
73 //Do nothing
74 }
75
76 return self;
77 }
78
79 -(GtkInfoBar*)INFOBAR
80 {
81 return GTK_INFO_BAR([self GOBJECT]);
82 }
83
84 -(void)addActionWidgetWithChild:(CGTKWidget*) child andResponseId:(gint) responseId
85 {
86 gtk_info_bar_add_action_widget(GTK_INFO_BAR([self GOBJECT]), [child WIDGET], responseId);
87 }
88
89 -(CGTKWidget*)addButtonWithButtonText:(NSString*) buttonText andResponseId:(gint) responseId
90 {
91 return [[CGTKWidget alloc] initWithGObject:(GObject *)gtk_info_bar_add_button(GTK_INFO_BAR([self GOBJECT]), [buttonText UTF8String], responseId)];
92 }
93
94 -(CGTKWidget*)getActionArea
95 {
96 return [[CGTKWidget alloc] initWithGObject:(GObject *)gtk_info_bar_get_action_area(GTK_INFO_BAR([self GOBJECT]))];
97 }
98
99 -(CGTKWidget*)getContentArea
100 {
101 return [[CGTKWidget alloc] initWithGObject:(GObject *)gtk_info_bar_get_content_area(GTK_INFO_BAR([self GOBJECT]))];
102 }
103
104 -(GtkMessageType)getMessageType
105 {
106 return gtk_info_bar_get_message_type(GTK_INFO_BAR([self GOBJECT]));
107 }
108
109 -(BOOL)getShowCloseButton
110 {
111 return (gtk_info_bar_get_show_close_button(GTK_INFO_BAR([self GOBJECT])) ? YES : NO);
112 }
113
114 -(void)response:(gint) responseId
115 {
116 gtk_info_bar_response(GTK_INFO_BAR([self GOBJECT]), responseId);
117 }
118
119 -(void)setDefaultResponse:(gint) responseId
120 {
121 gtk_info_bar_set_default_response(GTK_INFO_BAR([self GOBJECT]), responseId);
122 }
123
124 -(void)setMessageType:(GtkMessageType) messageType
125 {
126 gtk_info_bar_set_message_type(GTK_INFO_BAR([self GOBJECT]), messageType);
127 }
128
129 -(void)setResponseSensitiveWithResponseId:(gint) responseId andSetting:(BOOL) setting
130 {
131 gtk_info_bar_set_response_sensitive(GTK_INFO_BAR([self GOBJECT]), responseId, (setting ? TRUE : FALSE));
132 }
133
134 -(void)setShowCloseButton:(BOOL) setting
135 {
136 gtk_info_bar_set_show_close_button(GTK_INFO_BAR([self GOBJECT]), (setting ? TRUE : FALSE));
137 }
138
139
140 @end
-[CGTKBase GOBJECT]
GObject * GOBJECT()
Definition: CGTKBase.m:82
CGTKTypeWrapper
Definition: CGTKTypeWrapper.h:38
-[CGTKBase initWithGObject:]
id initWithGObject:(GObject *obj)
Definition: CGTKBase.m:48
-[CGTKWidget WIDGET]
GtkWidget * WIDGET()
Definition: CGTKWidget.m:61
-[CGTKInfoBar getActionArea]
CGTKWidget * getActionArea()
Definition: CGTKInfoBar.m:94
CGTKInfoBar
Definition: CGTKInfoBar.h:34
-[CGTKInfoBar INFOBAR]
GtkInfoBar * INFOBAR()
Definition: CGTKInfoBar.m:79
-[CGTKInfoBar getContentArea]
CGTKWidget * getContentArea()
Definition: CGTKInfoBar.m:99
CGTKWidget
Definition: CGTKWidget.h:34
-[CGTKInfoBar getShowCloseButton]
BOOL getShowCloseButton()
Definition: CGTKInfoBar.m:109
-[CGTKInfoBar init]
id init()
Definition: CGTKInfoBar.m:67
-[CGTKInfoBar getMessageType]
GtkMessageType getMessageType()
Definition: CGTKInfoBar.m:104