OK, handle box is good to go except for having the parent resize when it is dragged out, and also allowing user to drag it back into the original parent

This commit is contained in:
Elliot Lee 1997-12-19 21:06:39 +00:00
parent 01eda653ee
commit 24b21a5d84
3 changed files with 27 additions and 15 deletions

View File

@ -1763,6 +1763,8 @@ gdk_event_translate (GdkEvent *event,
event->button.time = xevent->xbutton.time;
event->button.x = xevent->xbutton.x;
event->button.y = xevent->xbutton.y;
event->button.x_root = (gfloat)xevent->xbutton.x_root;
event->button.y_root = (gfloat)xevent->xbutton.y_root;
event->button.pressure = 0.5;
event->button.xtilt = 0;
event->button.ytilt = 0;
@ -1864,8 +1866,8 @@ gdk_event_translate (GdkEvent *event,
event->button.time = xevent->xbutton.time;
event->button.x = xevent->xbutton.x;
event->button.y = xevent->xbutton.y;
event->button.x_root = xevent->xbutton.x_root;
event->button.y_root = xevent->xbutton.y_root;
event->button.x_root = (gfloat)xevent->xbutton.x_root;
event->button.y_root = (gfloat)xevent->xbutton.y_root;
event->button.pressure = 0.5;
event->button.xtilt = 0;
event->button.ytilt = 0;
@ -1936,8 +1938,8 @@ gdk_event_translate (GdkEvent *event,
event->motion.time = xevent->xmotion.time;
event->motion.x = xevent->xmotion.x;
event->motion.y = xevent->xmotion.y;
event->motion.x_root = xevent->xmotion.x_root;
event->motion.y_root = xevent->xmotion.y_root;
event->motion.x_root = (gfloat)xevent->xmotion.x_root;
event->motion.y_root = (gfloat)xevent->xmotion.y_root;
event->motion.pressure = 0.5;
event->motion.xtilt = 0;
event->motion.ytilt = 0;

View File

@ -1763,6 +1763,8 @@ gdk_event_translate (GdkEvent *event,
event->button.time = xevent->xbutton.time;
event->button.x = xevent->xbutton.x;
event->button.y = xevent->xbutton.y;
event->button.x_root = (gfloat)xevent->xbutton.x_root;
event->button.y_root = (gfloat)xevent->xbutton.y_root;
event->button.pressure = 0.5;
event->button.xtilt = 0;
event->button.ytilt = 0;
@ -1864,8 +1866,8 @@ gdk_event_translate (GdkEvent *event,
event->button.time = xevent->xbutton.time;
event->button.x = xevent->xbutton.x;
event->button.y = xevent->xbutton.y;
event->button.x_root = xevent->xbutton.x_root;
event->button.y_root = xevent->xbutton.y_root;
event->button.x_root = (gfloat)xevent->xbutton.x_root;
event->button.y_root = (gfloat)xevent->xbutton.y_root;
event->button.pressure = 0.5;
event->button.xtilt = 0;
event->button.ytilt = 0;
@ -1936,8 +1938,8 @@ gdk_event_translate (GdkEvent *event,
event->motion.time = xevent->xmotion.time;
event->motion.x = xevent->xmotion.x;
event->motion.y = xevent->xmotion.y;
event->motion.x_root = xevent->xmotion.x_root;
event->motion.y_root = xevent->xmotion.y_root;
event->motion.x_root = (gfloat)xevent->xmotion.x_root;
event->motion.y_root = (gfloat)xevent->xmotion.y_root;
event->motion.pressure = 0.5;
event->motion.xtilt = 0;
event->motion.ytilt = 0;

View File

@ -142,8 +142,8 @@ gtk_handle_box_size_request (GtkWidget *widget,
bin = GTK_BIN (widget);
requisition->width = DRAG_HANDLE_SIZE;
requisition->height = DRAG_HANDLE_SIZE;
requisition->width = DRAG_HANDLE_SIZE + GTK_CONTAINER(widget)->border_width * 2;
requisition->height = DRAG_HANDLE_SIZE + GTK_CONTAINER(widget)->border_width * 2;
if (bin->child && GTK_WIDGET_VISIBLE (bin->child))
{
@ -171,14 +171,14 @@ gtk_handle_box_size_allocate (GtkWidget *widget,
child_allocation.x = 0;
child_allocation.y = 0;
child_allocation.width = allocation->width - DRAG_HANDLE_SIZE;
child_allocation.height = allocation->height;
child_allocation.width = allocation->width - DRAG_HANDLE_SIZE - GTK_CONTAINER(widget)->border_width * 2;
child_allocation.height = allocation->height - GTK_CONTAINER(widget)->border_width * 2;
if (GTK_WIDGET_REALIZED (widget))
{
gdk_window_move_resize (widget->window,
allocation->x + DRAG_HANDLE_SIZE,
allocation->y,
allocation->x + DRAG_HANDLE_SIZE + GTK_CONTAINER(widget)->border_width,
allocation->y + GTK_CONTAINER(widget)->border_width,
child_allocation.width,
child_allocation.height);
}
@ -197,18 +197,26 @@ static void gtk_handle_box_paint(GtkWidget *widget,
g_print("painting %dx%d+%d+%d\n",
area->x, area->y, area->width, area->height);
startx = 1; endx = DRAG_HANDLE_SIZE;
if(area->x > startx)
startx = area->x;
if((area->x + area->width) < endx)
endx = area->x + area->width;
line_y2 = area->y + area->height;
for(x = startx; x < DRAG_HANDLE_SIZE; x += 3)
gtk_draw_vline(widget->style, widget->window,
GTK_WIDGET_STATE(widget),
area->y, line_y2,
x);
gtk_draw_shadow(widget->style,
widget->window,
GTK_WIDGET_STATE(widget),
GTK_SHADOW_OUT,
0, 0,
widget->allocation.width - 1,
widget->allocation.height);
}
static void