2 terminatorX - realtime audio scratching software
3 Copyright (C) 1999-2004 Alexander König
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #include "tX_pbutton.h"
26 #define WID_DYN TRUE, TRUE, 0
27 #define WID_FIX FALSE, FALSE, 0
29 void tX_panel :: minimize(GtkWidget *w, tX_panel *p)
31 p->client_hidden=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(p->minbutton));
34 gtk_widget_hide(p->clientframe);
36 gtk_widget_show(p->clientframe);
41 GtkPackType pack_type;
44 gtk_box_query_child_packing(GTK_BOX(p->container), p->mainbox,
45 &expand, &fill, &padding, &pack_type);
46 gtk_box_set_child_packing(GTK_BOX(p->container), p->mainbox,
47 expand, fill, padding, pack_type);
48 gtk_container_check_resize(GTK_CONTAINER(p->container));
52 void tX_panel_make_label_bold(GtkWidget *widget) {
54 sprintf(label, "<b>%s</b>", gtk_label_get_text(GTK_LABEL(widget)));
55 gtk_label_set_markup(GTK_LABEL (widget), label);
58 tX_panel :: tX_panel (const char *name, GtkWidget *par)
64 minbutton=gtk_toggle_button_new();
65 pixmap=tx_pixmap_widget(TX_ICON_MINIMIZE);
66 gtk_container_add (GTK_CONTAINER (minbutton), pixmap);
67 labelbutton=gtk_button_new_with_label(name);
68 gtk_container_foreach(GTK_CONTAINER(labelbutton), (GtkCallback) tX_panel_make_label_bold, NULL);
69 mainbox=gtk_vbox_new(FALSE, 0);
71 topbox=gtk_hbox_new(FALSE, 0);
72 clientbox=gtk_vbox_new(FALSE, 0);
73 clientframe=gtk_frame_new((char *) NULL);
74 gtk_container_set_border_width( GTK_CONTAINER(clientframe), 0);
75 gtk_container_add(GTK_CONTAINER(clientframe), clientbox);
77 gtk_box_pack_start(GTK_BOX(mainbox), topbox, WID_FIX);
78 gtk_box_pack_start(GTK_BOX(mainbox), clientframe, WID_FIX);
80 gtk_box_pack_start(GTK_BOX(topbox), labelbutton, WID_DYN);
81 gtk_box_pack_start(GTK_BOX(topbox), minbutton, WID_FIX);
83 gtk_widget_show(pixmap);
84 gtk_widget_show(labelbutton);
85 gtk_widget_show(minbutton);
86 gtk_widget_show(topbox);
87 gtk_widget_show(clientbox);
88 gtk_widget_show(clientframe);
89 gtk_widget_show(mainbox);
91 g_signal_connect(G_OBJECT(minbutton), "clicked", (GtkSignalFunc) tX_panel::minimize, (void *) this);
94 void tX_panel :: add_client_widget(GtkWidget *w)
96 gtk_box_pack_start(GTK_BOX(clientbox), w, WID_FIX);
101 tX_panel :: ~tX_panel()
103 gtk_widget_destroy(minbutton);
104 gtk_widget_destroy(labelbutton);
105 gtk_widget_destroy(clientbox);
106 gtk_widget_destroy(clientframe);
107 gtk_widget_destroy(topbox);
108 gtk_widget_destroy(mainbox);