Skip to content

Commit

Permalink
added SetActiveID and GetModel for GtkComboBox
Browse files Browse the repository at this point in the history
  • Loading branch information
equinox0815 committed Feb 4, 2016
1 parent 66e684c commit 26a5eaf
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions gtk/combo_box.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,24 @@ func (v *ComboBox) GetActiveID() string {
return C.GoString((*C.char)(c))
}

// SetActiveID is a wrapper around gtk_combo_box_set_active_id().
func (v *ComboBox) SetActiveID(id string) bool {
cid := C.CString(id)
defer C.free(unsafe.Pointer(cid))
c := C.gtk_combo_box_set_active_id(v.native(), (*C.gchar)(cid))
return gobool(c)
}

// GetModel is a wrapper around gtk_combo_box_get_model().
func (v *ComboBox) GetModel() (*TreeModel, error) {
c := C.gtk_combo_box_get_model(v.native())
if c == nil {
return nil, nilPtrErr
}
obj := wrapObject(unsafe.Pointer(c))
return wrapTreeModel(obj), nil
}

// SetModel is a wrapper around gtk_combo_box_set_model().
func (v *ComboBox) SetModel(model ITreeModel) {
C.gtk_combo_box_set_model(v.native(), model.toTreeModel())
Expand Down

0 comments on commit 26a5eaf

Please sign in to comment.