122 |
char *tooltip) { |
char *tooltip) { |
123 |
GtkWidget *button = gtk_button_new(); |
GtkWidget *button = gtk_button_new(); |
124 |
gtk_button_set_image(GTK_BUTTON(button), |
gtk_button_set_image(GTK_BUTTON(button), |
125 |
gtk_image_new_from_stock(icon, GTK_ICON_SIZE_MENU)); |
gtk_image_new_from_stock(icon, GTK_ICON_SIZE_BUTTON)); |
126 |
g_signal_connect(button, "clicked", cb, data); |
g_signal_connect(button, "clicked", cb, data); |
127 |
#ifndef USE_MAEMO |
#ifndef USE_MAEMO |
128 |
gtk_widget_set_tooltip_text(button, tooltip); |
gtk_widget_set_tooltip_text(button, tooltip); |
199 |
GdkEventButton *event, popup_context_t *context) { |
GdkEventButton *event, popup_context_t *context) { |
200 |
gboolean in = pointer_in_window(widget, event->x_root, event->y_root); |
gboolean in = pointer_in_window(widget, event->x_root, event->y_root); |
201 |
|
|
202 |
printf("overlay button press(in = %d)\n", in); |
printf("overlay button press (in = %d)\n", in); |
203 |
return !in; |
return !in; |
204 |
} |
} |
205 |
|
|
208 |
GdkEventButton *event, popup_context_t *context) { |
GdkEventButton *event, popup_context_t *context) { |
209 |
gboolean in = pointer_in_window(widget, event->x_root, event->y_root); |
gboolean in = pointer_in_window(widget, event->x_root, event->y_root); |
210 |
|
|
211 |
printf("overlay button release(in = %d)\n", in); |
printf("overlay button release (in = %d)\n", in); |
212 |
|
|
213 |
if(!in) { |
if(!in) { |
214 |
printf("destroying popup\n"); |
printf("destroying popup\n"); |
250 |
gtk_widget_realize(pcontext.window); |
gtk_widget_realize(pcontext.window); |
251 |
gtk_window_set_default_size(GTK_WINDOW(pcontext.window), |
gtk_window_set_default_size(GTK_WINDOW(pcontext.window), |
252 |
POPUP_WIDTH, POPUP_HEIGHT); |
POPUP_WIDTH, POPUP_HEIGHT); |
253 |
gtk_window_resize(GTK_WINDOW(pcontext.window), |
gtk_window_resize(GTK_WINDOW(pcontext.window), POPUP_WIDTH, POPUP_HEIGHT); |
|
POPUP_WIDTH, POPUP_HEIGHT); |
|
254 |
// gtk_window_set_resizable(GTK_WINDOW(pcontext.window), FALSE); |
// gtk_window_set_resizable(GTK_WINDOW(pcontext.window), FALSE); |
255 |
gtk_window_set_transient_for(GTK_WINDOW(pcontext.window), |
gtk_window_set_transient_for(GTK_WINDOW(pcontext.window), |
256 |
GTK_WINDOW(mcontext->appdata->window)); |
GTK_WINDOW(mcontext->appdata->window)); |
277 |
gtk_grab_add(pcontext.window); |
gtk_grab_add(pcontext.window); |
278 |
|
|
279 |
/* check whether cache is in upper or lower half of window */ |
/* check whether cache is in upper or lower half of window */ |
280 |
gint x, y; |
gint x, y, sx, sy; |
281 |
osm_gps_map_geographic_to_screen(OSM_GPS_MAP(mcontext->widget), |
osm_gps_map_geographic_to_screen(OSM_GPS_MAP(mcontext->widget), |
282 |
cache->pos.lat, cache->pos.lon, |
cache->pos.lat, cache->pos.lon, |
283 |
&x, &y); |
&sx, &sy); |
284 |
|
|
285 |
printf("screen pos %d/%d\n", x, y); |
printf("screen pos %d/%d\n", sx, sy); |
286 |
|
|
287 |
gdk_window_get_origin(mcontext->widget->window, &x, &y); |
gdk_window_get_origin(mcontext->widget->window, &x, &y); |
288 |
printf("window = %d/%d %d/%d\n", x, y, |
printf("window = %d/%d +%d+%d %d*%d\n", x, y, |
289 |
mcontext->widget->allocation.x, |
mcontext->widget->allocation.x, |
290 |
mcontext->widget->allocation.y); |
mcontext->widget->allocation.y, |
291 |
|
mcontext->widget->allocation.width, |
292 |
// gtk_window_move(GTK_WINDOW(pcontext.window), |
mcontext->widget->allocation.height |
293 |
// x + button->allocation.x, |
); |
294 |
// y + button->allocation.y - HEIGHT); |
|
295 |
|
gint ax = 0, ay = 0; |
296 |
|
if(sx > mcontext->widget->allocation.width/2) |
297 |
|
ax = POPUP_WIDTH; |
298 |
|
|
299 |
|
if(sy > mcontext->widget->allocation.height/2) |
300 |
|
ay = POPUP_HEIGHT; |
301 |
|
|
302 |
gtk_window_move(GTK_WINDOW(pcontext.window), |
gtk_window_move(GTK_WINDOW(pcontext.window), |
303 |
100, |
x + mcontext->widget->allocation.x + sx - ax, |
304 |
100); |
y + mcontext->widget->allocation.y + sy - ay); |
305 |
|
|
306 |
/* a frame with a vscale inside */ |
/* a frame with a vscale inside */ |
307 |
GtkWidget *frame = gtk_frame_new(NULL); |
GtkWidget *frame = gtk_frame_new(NULL); |
493 |
NULL); |
NULL); |
494 |
|
|
495 |
#ifndef USE_MAEMO |
#ifndef USE_MAEMO |
496 |
gtk_window_set_default_size(GTK_WINDOW(dialog), 400, 350); |
gtk_window_set_default_size(GTK_WINDOW(dialog), 640, 480); |
497 |
#else |
#else |
498 |
gtk_window_set_default_size(GTK_WINDOW(dialog), 800, 480); |
gtk_window_set_default_size(GTK_WINDOW(dialog), 800, 480); |
499 |
#endif |
#endif |