CoreGTK  3.10.0
CoreGTK is an Objective-C language binding for the GTK+ widget toolkit
 All Classes Functions Variables
CGTKScale.m
1 /*
2  * CGTKScale.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/CGTKScale.h"
33 
34 @implementation CGTKScale
35 
36 -(id)initWithOrientation:(GtkOrientation) orientation andAdjustment:(GtkAdjustment*) adjustment
37 {
38  self = [super initWithGObject:(GObject *)gtk_scale_new(orientation, adjustment)];
39 
40  if(self)
41  {
42  //Do nothing
43  }
44 
45  return self;
46 }
47 
48 -(id)initWithRangeWithOrientation:(GtkOrientation) orientation andMin:(gdouble) min andMax:(gdouble) max andStep:(gdouble) step
49 {
50  self = [super initWithGObject:(GObject *)gtk_scale_new_with_range(orientation, min, max, step)];
51 
52  if(self)
53  {
54  //Do nothing
55  }
56 
57  return self;
58 }
59 
60 -(GtkScale*)SCALE
61 {
62  return GTK_SCALE([self GOBJECT]);
63 }
64 
65 -(void)addMarkWithValue:(gdouble) value andPosition:(GtkPositionType) position andMarkup:(NSString*) markup
66 {
67  gtk_scale_add_mark(GTK_SCALE([self GOBJECT]), value, position, [markup UTF8String]);
68 }
69 
70 -(void)clearMarks
71 {
72  gtk_scale_clear_marks(GTK_SCALE([self GOBJECT]));
73 }
74 
75 -(gint)getDigits
76 {
77  return gtk_scale_get_digits(GTK_SCALE([self GOBJECT]));
78 }
79 
81 {
82  return (gtk_scale_get_draw_value(GTK_SCALE([self GOBJECT])) ? YES : NO);
83 }
84 
86 {
87  return (gtk_scale_get_has_origin(GTK_SCALE([self GOBJECT])) ? YES : NO);
88 }
89 
90 -(PangoLayout*)getLayout
91 {
92  return gtk_scale_get_layout(GTK_SCALE([self GOBJECT]));
93 }
94 
95 -(void)getLayoutOffsetsWithX:(gint*) x andY:(gint*) y
96 {
97  gtk_scale_get_layout_offsets(GTK_SCALE([self GOBJECT]), x, y);
98 }
99 
100 -(GtkPositionType)getValuePos
101 {
102  return gtk_scale_get_value_pos(GTK_SCALE([self GOBJECT]));
103 }
104 
105 -(void)setDigits:(gint) digits
106 {
107  gtk_scale_set_digits(GTK_SCALE([self GOBJECT]), digits);
108 }
109 
110 -(void)setDrawValue:(BOOL) drawValue
111 {
112  gtk_scale_set_draw_value(GTK_SCALE([self GOBJECT]), (drawValue ? TRUE : FALSE));
113 }
114 
115 -(void)setHasOrigin:(BOOL) hasOrigin
116 {
117  gtk_scale_set_has_origin(GTK_SCALE([self GOBJECT]), (hasOrigin ? TRUE : FALSE));
118 }
119 
120 -(void)setValuePos:(GtkPositionType) pos
121 {
122  gtk_scale_set_value_pos(GTK_SCALE([self GOBJECT]), pos);
123 }
124 
125 
126 @end
GtkPositionType getValuePos()
Definition: CGTKScale.m:100
GObject * GOBJECT()
Definition: CGTKBase.m:82
id initWithGObject:(GObject *obj)
Definition: CGTKBase.m:48
void clearMarks()
Definition: CGTKScale.m:70
gint getDigits()
Definition: CGTKScale.m:75
BOOL getDrawValue()
Definition: CGTKScale.m:80
BOOL getHasOrigin()
Definition: CGTKScale.m:85
PangoLayout * getLayout()
Definition: CGTKScale.m:90
GtkScale * SCALE()
Definition: CGTKScale.m:60