174 | 174 |
func AS_GWIDGET(p unsafe.Pointer) *C.GtkWidget { return C.toGWidget(p) }
|
175 | 175 |
func UI_MANAGER(p *UIManager) *C.GtkUIManager { return C.toGUIManager(p.Object) }
|
176 | 176 |
func FONT_SELECTION(p *FontSelection) *C.GtkFontSelection { return C.toGFontSelection(p.GWidget) }
|
|
177 |
|
|
178 |
func CALENDAR(p *Calendar) *C.GtkCalendar { return C.toGCalendar(p.GWidget) }
|
177 | 179 |
|
178 | 180 |
//static inline GtkFileFilter* toGFileFilter(gpointer p) { return GTK_FILE_FILTER(p); }
|
179 | 181 |
|
|
1147 | 1149 |
//-----------------------------------------------------------------------
|
1148 | 1150 |
// Version Information
|
1149 | 1151 |
//-----------------------------------------------------------------------
|
1150 | |
|
1151 | |
// gtk_major_version
|
1152 | |
// gtk_minor_version
|
1153 | |
// gtk_micro_version
|
1154 | |
// gtk_binary_age
|
1155 | |
// gtk_interface_age
|
1156 | |
// gtk_check_version
|
|
1152 |
func MajorVersion() uint {
|
|
1153 |
return uint(C.gtk_major_version)
|
|
1154 |
}
|
|
1155 |
|
|
1156 |
func MinorVersion() uint {
|
|
1157 |
return uint(C.gtk_minor_version)
|
|
1158 |
}
|
|
1159 |
|
|
1160 |
func MicroVersion() uint {
|
|
1161 |
return uint(C.gtk_micro_version)
|
|
1162 |
}
|
|
1163 |
|
|
1164 |
func BinaryAge() uint {
|
|
1165 |
return uint(C.gtk_binary_age)
|
|
1166 |
}
|
|
1167 |
|
|
1168 |
func InterfaceAge() uint {
|
|
1169 |
return uint(C.gtk_interface_age)
|
|
1170 |
}
|
|
1171 |
|
|
1172 |
func CheckVersion(major uint, minor uint, micro uint) string {
|
|
1173 |
return gostring(C.gtk_check_version(guint(major), guint(minor), guint(micro)))
|
|
1174 |
}
|
1157 | 1175 |
|
1158 | 1176 |
//-----------------------------------------------------------------------
|
1159 | 1177 |
// Testing
|
|
4206 | 4224 |
C.gtk_text_buffer_remove_all_tags(v.GTextBuffer, &start.GTextIter, &end.GTextIter)
|
4207 | 4225 |
}
|
4208 | 4226 |
|
4209 | |
func (v *TextBuffer) CreateTag(tag_name string, props map[string]string) *TextTag {
|
|
4227 |
func (v *TextBuffer) CreateTag(tag_name string, props map[string]interface{}) *TextTag {
|
|
4228 |
toInt := func(val interface{}) int {
|
|
4229 |
switch v := val.(type) {
|
|
4230 |
case uint:
|
|
4231 |
return int(v)
|
|
4232 |
case uintptr:
|
|
4233 |
return int(v)
|
|
4234 |
case uint8:
|
|
4235 |
return int(v)
|
|
4236 |
case uint16:
|
|
4237 |
return int(v)
|
|
4238 |
case uint32:
|
|
4239 |
return int(v)
|
|
4240 |
case uint64:
|
|
4241 |
return int(v)
|
|
4242 |
case int:
|
|
4243 |
return int(v)
|
|
4244 |
case int8:
|
|
4245 |
return int(v)
|
|
4246 |
case int16:
|
|
4247 |
return int(v)
|
|
4248 |
case int32:
|
|
4249 |
return int(v)
|
|
4250 |
case int64:
|
|
4251 |
return int(v)
|
|
4252 |
}
|
|
4253 |
return 0
|
|
4254 |
}
|
|
4255 |
toFloat := func(val interface{}) float64 {
|
|
4256 |
switch v := val.(type) {
|
|
4257 |
case float32:
|
|
4258 |
return float64(v)
|
|
4259 |
case float64:
|
|
4260 |
return float64(v)
|
|
4261 |
}
|
|
4262 |
return 0
|
|
4263 |
}
|
4210 | 4264 |
ptr := C.CString(tag_name)
|
4211 | 4265 |
defer cfree(ptr)
|
4212 | 4266 |
tag := C._gtk_text_buffer_create_tag(v.GTextBuffer, gstring(ptr))
|
4213 | 4267 |
for prop, val := range props {
|
4214 | 4268 |
pprop := C.CString(prop)
|
4215 | |
pval := C.CString(val)
|
4216 | |
C._apply_property(unsafe.Pointer(tag), gstring(pprop), gstring(pval))
|
|
4269 |
switch v := val.(type) {
|
|
4270 |
case bool:
|
|
4271 |
C._apply_property_bool(unsafe.Pointer(tag), gstring(pprop), gbool(v))
|
|
4272 |
case uint, uintptr, uint8, uint16, uint32, uint64, int, int8, int16, int32, int64:
|
|
4273 |
C._apply_property_int(unsafe.Pointer(tag), gstring(pprop), gint(toInt(v)))
|
|
4274 |
case float32, float64:
|
|
4275 |
C._apply_property_float(unsafe.Pointer(tag), gstring(pprop), gdouble(toFloat(v)))
|
|
4276 |
case string:
|
|
4277 |
pval := C.CString(v)
|
|
4278 |
C._apply_property_string(unsafe.Pointer(tag), gstring(pprop), gstring(pval))
|
|
4279 |
cfree(pval)
|
|
4280 |
}
|
4217 | 4281 |
cfree(pprop)
|
4218 | |
cfree(pval)
|
4219 | 4282 |
}
|
4220 | 4283 |
return newTextTag(tag)
|
4221 | 4284 |
}
|
|
9776 | 9839 |
// GtkCalendar
|
9777 | 9840 |
//-----------------------------------------------------------------------
|
9778 | 9841 |
|
9779 | |
// gtk_calendar_new
|
|
9842 |
type Calendar struct {
|
|
9843 |
Container
|
|
9844 |
}
|
|
9845 |
|
|
9846 |
func NewCalendar() *Calendar {
|
|
9847 |
return &Calendar{Container{Widget{C.gtk_calendar_new()}}}
|
|
9848 |
}
|
|
9849 |
|
9780 | 9850 |
// gtk_calendar_select_month
|
9781 | 9851 |
// gtk_calendar_select_day
|
9782 | 9852 |
// gtk_calendar_mark_day
|
|
9784 | 9854 |
// gtk_calendar_clear_marks
|
9785 | 9855 |
// gtk_calendar_get_display_options
|
9786 | 9856 |
// gtk_calendar_set_display_options
|
9787 | |
// gtk_calendar_get_date
|
|
9857 |
|
|
9858 |
func (c *Calendar) GetDate() (year, month, date uint) {
|
|
9859 |
var y, m, d C.guint
|
|
9860 |
C.gtk_calendar_get_date(CALENDAR(c), &y, &m, &d)
|
|
9861 |
return uint(y), uint(m), uint(d)
|
|
9862 |
}
|
|
9863 |
|
9788 | 9864 |
// gtk_calendar_set_detail_func
|
9789 | 9865 |
// gtk_calendar_get_detail_width_chars
|
9790 | 9866 |
// gtk_calendar_set_detail_width_chars
|
|
10205 | 10281 |
|
10206 | 10282 |
// gtk_container_resize_children
|
10207 | 10283 |
// gtk_container_child_type
|
10208 | |
// gtk_container_child_get
|
|
10284 |
|
|
10285 |
// value must be pointer to int or bool
|
|
10286 |
func (v *Container) ChildGet(w IWidget, propName string, value interface{}) {
|
|
10287 |
|
|
10288 |
ptr := C.CString(propName)
|
|
10289 |
defer cfree(ptr)
|
|
10290 |
|
|
10291 |
switch value.(type) {
|
|
10292 |
case *bool:
|
|
10293 |
*(value.(*bool)) = int(C._gtk_container_child_get_bool(CONTAINER(v), ToNative(w), gstring(ptr))) != 0
|
|
10294 |
case *int:
|
|
10295 |
*(value.(*int)) = int(C._gtk_container_child_get_int(CONTAINER(v), ToNative(w), gstring(ptr)))
|
|
10296 |
}
|
|
10297 |
}
|
10209 | 10298 |
|
10210 | 10299 |
func (v *Container) ChildSet(w IWidget, propName string, value interface{}) {
|
10211 | 10300 |
|