1
/* gtktiemu - a TI89/92/92+ emulator
2
* (c) Copyright 2000-2001, Romain Lievin and Thomas Corvazier
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 2 of the License, or
7
* (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
28
# include "D:\devel\tiemu_project\SDL-1.2.4\include\SDL.h"
31
#include "../gtk/tiemu_cb.h"
32
#include "../gtk/refresh.h"
36
static GtkWidget *window;
39
Display a popup menu: entry point used by ticalc.c (SDL)
41
void hid_popup_menu(SDL_MouseButtonEvent event)
44
gtk_menu_popup(GTK_MENU(display_popup_menu()),
45
NULL, NULL, NULL, NULL,
47
-897199374); // cannot pass time
52
GTK callback: displays a popup menu if the auxiliary
53
window has been enabled (#define EXT_WIN). Used by GTK.
56
button_press_event (GtkWidget *widget,
57
GdkEventButton *event,
62
if(event->button == 3)
65
menu = display_popup_menu();
66
gtk_widget_grab_focus(menu);
68
gtk_menu_popup(GTK_MENU(menu),
69
NULL, NULL, NULL, NULL,
70
event->button, event->time);
77
The GTK auxiliary window: may not be shown but used for
79
A better way should be to use a GtkSDL plugin...
81
int gtk_main_window(void)
87
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
88
gtk_window_set_title (GTK_WINDOW (window), "GtkTiEmu");
89
gtk_widget_set_usize(window, 250, 50);
92
eventbox = gtk_event_box_new ();
93
gtk_container_add (GTK_CONTAINER (window), eventbox);
94
GTK_WIDGET_SET_FLAGS (eventbox, GTK_CAN_FOCUS);
95
GTK_WIDGET_SET_FLAGS (eventbox, GTK_CAN_DEFAULT);
96
gtk_widget_set_events (eventbox, GDK_BUTTON_PRESS_MASK | GDK_KEY_PRESS_MASK);
97
gtk_widget_show (eventbox);
99
label = gtk_label_new ("Click here to display a menu");
100
gtk_container_add (GTK_CONTAINER (eventbox), label);
101
gtk_widget_show (label);
103
gtk_signal_connect (GTK_OBJECT (window), "destroy",
104
GTK_SIGNAL_FUNC (gtk_main_quit),
106
gtk_signal_connect (GTK_OBJECT (eventbox), "button_press_event",
107
GTK_SIGNAL_FUNC (button_press_event),
110
//gtk_widget_grab_focus (eventbox);
111
gtk_widget_grab_default (eventbox);
114
gtk_widget_show_all(window);