aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/e-paned/e-paned.c
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-06-08 01:49:16 +0800
committerChris Lahey <clahey@src.gnome.org>2000-06-08 01:49:16 +0800
commit85ab67368975beefb6beb9604988dd4d35f27ae2 (patch)
tree8ef0409259176a116fc85407d7e30e984d9eff3d /widgets/e-paned/e-paned.c
parente7971bb4f5f1d262a3f3af99f81c221a724131da (diff)
downloadgsoc2013-evolution-85ab67368975beefb6beb9604988dd4d35f27ae2.tar.gz
gsoc2013-evolution-85ab67368975beefb6beb9604988dd4d35f27ae2.tar.zst
gsoc2013-evolution-85ab67368975beefb6beb9604988dd4d35f27ae2.zip
Added a "quantum" argument for making the panes move in jumps.
2000-06-07 Christopher James Lahey <clahey@helixcode.com> * widgets/e-paned/e-hpaned.c, widgets/e-paned/e-paned.c, widgets/e-paned/e-paned.h, widgets/e-paned/e-vpaned.c: Added a "quantum" argument for making the panes move in jumps. svn path=/trunk/; revision=3461
Diffstat (limited to 'widgets/e-paned/e-paned.c')
-rw-r--r--widgets/e-paned/e-paned.c36
1 files changed, 32 insertions, 4 deletions
diff --git a/widgets/e-paned/e-paned.c b/widgets/e-paned/e-paned.c
index 5d09535ad9..ae68e10082 100644
--- a/widgets/e-paned/e-paned.c
+++ b/widgets/e-paned/e-paned.c
@@ -36,7 +36,8 @@
enum {
ARG_0,
- ARG_HANDLE_SIZE
+ ARG_HANDLE_SIZE,
+ ARG_QUANTUM,
};
static void e_paned_class_init (EPanedClass *klass);
@@ -122,6 +123,8 @@ e_paned_class_init (EPanedClass *klass)
gtk_object_add_arg_type("EPaned::handle_size", GTK_TYPE_UINT,
GTK_ARG_READWRITE, ARG_HANDLE_SIZE);
+ gtk_object_add_arg_type("EPaned::quantum", GTK_TYPE_UINT,
+ GTK_ARG_READWRITE, ARG_QUANTUM);
}
static GtkType
@@ -153,6 +156,9 @@ e_paned_init (EPaned *paned)
paned->handle_xpos = -1;
paned->handle_ypos = -1;
+
+ paned->old_child1_size = 0;
+ paned->quantum = 1;
}
static void
@@ -167,6 +173,11 @@ e_paned_set_arg (GtkObject *object,
case ARG_HANDLE_SIZE:
e_paned_set_handle_size (paned, GTK_VALUE_UINT (*arg));
break;
+ case ARG_QUANTUM:
+ paned->quantum = GTK_VALUE_UINT (*arg);
+ if (paned->quantum == 0)
+ paned->quantum = 1;
+ break;
default:
break;
}
@@ -184,6 +195,9 @@ e_paned_get_arg (GtkObject *object,
case ARG_HANDLE_SIZE:
GTK_VALUE_UINT (*arg) = paned->handle_size;
break;
+ case ARG_QUANTUM:
+ GTK_VALUE_UINT (*arg) = paned->quantum;
+ break;
default:
arg->type = GTK_TYPE_INVALID;
break;
@@ -547,9 +561,9 @@ e_paned_set_handle_size (EPaned *paned,
void
e_paned_compute_position(EPaned *paned,
- gint allocation,
- gint child1_req,
- gint child2_req)
+ gint allocation,
+ gint child1_req,
+ gint child2_req)
{
g_return_if_fail (paned != NULL);
g_return_if_fail (E_IS_PANED (paned));
@@ -604,3 +618,17 @@ e_paned_handle_shown(EPaned *paned)
else
return TRUE;
}
+
+gint
+e_paned_quantized_size(EPaned *paned,
+ gint size)
+{
+ gint quantization = size - paned->old_child1_size;
+ if (quantization > 0)
+ quantization += paned->quantum / 2;
+ else
+ quantization -= paned->quantum / 2;
+ quantization /= paned->quantum;
+ quantization *= paned->quantum;
+ return paned->old_child1_size + quantization;
+}