diff src/glyphs-msw.c @ 422:95016f13131a r21-2-19

Import from CVS: tag r21-2-19
author cvs
date Mon, 13 Aug 2007 11:25:01 +0200
parents 41dbb7a9d5f2
children 11054d720c21
line wrap: on
line diff
--- a/src/glyphs-msw.c	Mon Aug 13 11:24:10 2007 +0200
+++ b/src/glyphs-msw.c	Mon Aug 13 11:25:01 2007 +0200
@@ -107,6 +107,7 @@
 					  struct frame* f);
 
 COLORREF mswindows_string_to_color (CONST char *name);
+void check_valid_item_list_1 (Lisp_Object items);
 
 #define BPLINE(width) ((int)(~3UL & (unsigned long)((width) +3)))
 
@@ -2049,6 +2050,17 @@
 		| SWP_NOCOPYBITS | SWP_NOSENDCHANGING);
 }
 
+/* resize the subwindow instance */
+static void 
+mswindows_resize_subwindow (struct Lisp_Image_Instance* ii, int w, int h)
+{
+  SetWindowPos (WIDGET_INSTANCE_MSWINDOWS_HANDLE (ii), 
+		NULL, 
+		0, 0, w, h,
+		SWP_NOZORDER | SWP_NOMOVE
+		| SWP_NOCOPYBITS | SWP_NOSENDCHANGING);
+}
+
 /* when you click on a widget you may activate another widget this
    needs to be checked and all appropriate widgets updated */
 static void
@@ -2540,7 +2552,6 @@
 				WS_EX_CONTROLPARENT);
 
   wnd = WIDGET_INSTANCE_MSWINDOWS_HANDLE (ii);
- 
   /* add items to the tab */
   LIST_LOOP (rest, Fplist_get (IMAGE_INSTANCE_WIDGET_PROPS (ii), Q_items, Qnil))
     {
@@ -2549,6 +2560,36 @@
     }
 }
 
+/* set the properties of a tab control */
+static Lisp_Object
+mswindows_tab_control_set_property (Lisp_Object image_instance, Lisp_Object prop,
+				    Lisp_Object val)
+{
+  struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
+
+  if (EQ (prop, Q_items))
+    {
+      HWND wnd = WIDGET_INSTANCE_MSWINDOWS_HANDLE (ii);
+      int index = 0;
+      Lisp_Object rest;
+      check_valid_item_list_1 (val);
+
+      /* delete the pre-existing items */
+      SendMessage (wnd, TCM_DELETEALLITEMS, 0, 0);
+  
+      /* add items to the tab */
+      LIST_LOOP (rest, val)
+	{
+	  add_tab_item (image_instance, wnd, XCAR (rest), 
+			IMAGE_INSTANCE_SUBWINDOW_FRAME (ii), index);
+	  index++;
+	}
+
+      return Qt;
+    }
+  return Qunbound;
+}
+
 /* instantiate a static control possible for putting other things in */
 static void
 mswindows_label_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
@@ -2739,6 +2780,7 @@
   CONSOLE_HAS_METHOD (mswindows, image_instance_hash);
   CONSOLE_HAS_METHOD (mswindows, init_image_instance_from_eimage);
   CONSOLE_HAS_METHOD (mswindows, locate_pixmap_file);
+  CONSOLE_HAS_METHOD (mswindows, resize_subwindow);
 }
 
 void
@@ -2815,6 +2857,7 @@
   /* tab control widget */
   INITIALIZE_DEVICE_IIFORMAT (mswindows, tab_control);
   IIFORMAT_HAS_DEVMETHOD (mswindows, tab_control, instantiate);
+  IIFORMAT_HAS_DEVMETHOD (mswindows, tab_control, set_property);
 
   /* windows bitmap format */
   INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (bmp, "bmp");