diff options
| author | Pietro Gagliardi <[email protected]> | 2014-08-30 23:02:02 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-08-30 23:02:02 -0400 |
| commit | 77bf566ebbcb62acd4d08d905d9542d6ff9b6b80 (patch) | |
| tree | eeb8e72bc3bf57f5be7f0c0af4319189ac6de838 /redo/group_unix.go | |
| parent | 155899c65ed32245e2ccad4197a10c77017d835b (diff) | |
...in with the new.
Diffstat (limited to 'redo/group_unix.go')
| -rw-r--r-- | redo/group_unix.go | 87 |
1 files changed, 0 insertions, 87 deletions
diff --git a/redo/group_unix.go b/redo/group_unix.go deleted file mode 100644 index ceaa59c..0000000 --- a/redo/group_unix.go +++ /dev/null @@ -1,87 +0,0 @@ -// +build !windows,!darwin - -// 15 august 2014 - -package ui - -import ( - "unsafe" -) - -// #include "gtk_unix.h" -import "C" - -type group struct { - _widget *C.GtkWidget - gcontainer *C.GtkContainer - frame *C.GtkFrame - - *container -} - -func newGroup(text string, control Control) Group { - ctext := togstr(text) - defer freegstr(ctext) - widget := C.gtk_frame_new(ctext) - g := &group{ - _widget: widget, - gcontainer: (*C.GtkContainer)(unsafe.Pointer(widget)), - frame: (*C.GtkFrame)(unsafe.Pointer(widget)), - } - - // with GTK+, groupboxes by default have frames and slightly x-offset regular text - // they should have no frame and fully left-justified, bold text - var yalign C.gfloat - - // preserve default y-alignment - C.gtk_frame_get_label_align(g.frame, nil, &yalign) - C.gtk_frame_set_label_align(g.frame, 0, yalign) - C.gtk_frame_set_shadow_type(g.frame, C.GTK_SHADOW_NONE) - label := (*C.GtkLabel)(unsafe.Pointer(C.gtk_frame_get_label_widget(g.frame))) - // this is the boldness level used by GtkPrintUnixDialog - // (it technically uses "bold" but see pango's pango-enum-types.c for the name conversion; GType is weird) - bold := C.pango_attr_weight_new(C.PANGO_WEIGHT_BOLD) - boldlist := C.pango_attr_list_new() - C.pango_attr_list_insert(boldlist, bold) - C.gtk_label_set_attributes(label, boldlist) - C.pango_attr_list_unref(boldlist) // thanks baedert in irc.gimp.net/#gtk+ - - g.container = newContainer(control) - g.container.setParent(&controlParent{g.gcontainer}) - - return g -} - -func (g *group) Text() string { - return fromgstr(C.gtk_frame_get_label(g.frame)) -} - -func (g *group) SetText(text string) { - ctext := togstr(text) - defer freegstr(ctext) - C.gtk_frame_set_label(g.frame, ctext) -} - -func (g *group) widget() *C.GtkWidget { - return g._widget -} - -func (g *group) setParent(p *controlParent) { - basesetParent(g, p) -} - -func (g *group) allocate(x int, y int, width int, height int, d *sizing) []*allocation { - return baseallocate(g, x, y, width, height, d) -} - -func (g *group) preferredSize(d *sizing) (width, height int) { - return basepreferredSize(g, d) -} - -func (g *group) commitResize(a *allocation, d *sizing) { - basecommitResize(g, a, d) -} - -func (g *group) getAuxResizeInfo(d *sizing) { - basegetAuxResizeInfo(g, d) -} |
