summaryrefslogtreecommitdiff
path: root/textscreen/examples
diff options
context:
space:
mode:
Diffstat (limited to 'textscreen/examples')
-rw-r--r--textscreen/examples/calculator.c16
-rw-r--r--textscreen/examples/guitest.c6
2 files changed, 5 insertions, 17 deletions
diff --git a/textscreen/examples/calculator.c b/textscreen/examples/calculator.c
index e9ed1bf7..968d3ef4 100644
--- a/textscreen/examples/calculator.c
+++ b/textscreen/examples/calculator.c
@@ -44,7 +44,6 @@ void InsertNumber(TXT_UNCAST_ARG(button), TXT_UNCAST_ARG(value))
void AddNumberButton(txt_table_t *table, int value)
{
- txt_button_t *button;
char buf[10];
int *val_copy;
@@ -53,9 +52,7 @@ void AddNumberButton(txt_table_t *table, int value)
sprintf(buf, " %i ", value);
- button = TXT_NewButton(buf);
- TXT_AddWidget(table, button);
- TXT_SignalConnect(button, "pressed", InsertNumber, val_copy);
+ TXT_AddWidget(table, TXT_NewButton2(buf, InsertNumber, val_copy));
}
void Operator(TXT_UNCAST_ARG(button), TXT_UNCAST_ARG(op))
@@ -69,7 +66,6 @@ void Operator(TXT_UNCAST_ARG(button), TXT_UNCAST_ARG(op))
void AddOperatorButton(txt_table_t *table, char *label, operator_t op)
{
- txt_button_t *button;
char buf[10];
operator_t *op_copy;
@@ -77,10 +73,8 @@ void AddOperatorButton(txt_table_t *table, char *label, operator_t op)
*op_copy = op;
sprintf(buf, " %s ", label);
- button = TXT_NewButton(buf);
- TXT_AddWidget(table, button);
- TXT_SignalConnect(button, "pressed", Operator, op_copy);
+ TXT_AddWidget(table, TXT_NewButton2(buf, Operator, op_copy));
}
void Calculate(TXT_UNCAST_ARG(button), void *unused)
@@ -113,7 +107,6 @@ void BuildGUI()
{
txt_window_t *window;
txt_table_t *table;
- txt_button_t *equals_button;
window = TXT_NewWindow("Calculator");
@@ -141,9 +134,8 @@ void BuildGUI()
AddOperatorButton(table, "+", OP_PLUS);
AddNumberButton(table, 0);
TXT_AddWidget(table, NULL);
- equals_button = TXT_NewButton(" = ");
- TXT_SignalConnect(equals_button, "pressed", Calculate, NULL);
- TXT_AddWidget(table, equals_button);
+
+ TXT_AddWidget(table, TXT_NewButton2(" = ", Calculate, NULL));
AddOperatorButton(table, "/", OP_DIV);
TXT_AddWidget(window, TXT_NewStrut(0, 1));
diff --git a/textscreen/examples/guitest.c b/textscreen/examples/guitest.c
index d3cce119..e385ca84 100644
--- a/textscreen/examples/guitest.c
+++ b/textscreen/examples/guitest.c
@@ -65,7 +65,6 @@ void SetupWindow(void)
txt_window_t *window;
txt_table_t *table;
txt_table_t *rightpane;
- txt_button_t *button;
txt_checkbox_t *cheesy_checkbox;
txt_window_action_t *pwn;
txt_label_t *toplabel;
@@ -121,10 +120,7 @@ void SetupWindow(void)
UpdateLabel(NULL, NULL);
- button = TXT_NewButton("Close Window");
- TXT_AddWidget(window, button);
-
- TXT_SignalConnect(button, "pressed", CloseWindow, NULL);
+ TXT_AddWidget(window, TXT_NewButton2("Close Window", CloseWindow, NULL));
pwn = TXT_NewWindowAction(KEY_F1, "PWN!");
TXT_SetWindowAction(window, TXT_HORIZ_CENTER, pwn);