upload tizen2.0 source
[framework/uifw/xorg/lib/libxaw.git] / src / List.c
old mode 100755 (executable)
new mode 100644 (file)
index 287151d..ce0ab5f
@@ -28,7 +28,7 @@ in this Software without prior written authorization from The Open Group.
  * This is a List widget.  It allows the user to select an item in a list and
  * notifies the application through a callback function.
  *
- *     Created:        8/13/88
+ *     Created:        8/13/88
  *     By:             Chris D. Peterson
  *                      MIT X Consortium
  */
@@ -81,7 +81,7 @@ static Bool Layout(Widget, Bool, Bool, Dimension*, Dimension*);
 static void PaintItemName(Widget, int);
 static void ResetList(Widget, Bool, Bool);
 
-/* 
+/*
  * Actions
  */
 static void Notify(Widget, XEvent*, String*, Cardinal*);
@@ -91,7 +91,7 @@ static void Unset(Widget, XEvent*, String*, Cardinal*);
 /*
  * Initialization
  */
-static char defaultTranslations[] =  
+static char defaultTranslations[] =
 "<Btn1Down>:"  "Set()\n"
 "<Btn1Up>:"    "Notify()\n"
 ;
@@ -337,7 +337,7 @@ GetGCs(Widget w)
     else
        lw->list.revgc = XtGetGC(w, GCForeground | GCFont, &values);
 
-    values.tile       = XmuCreateStippledPixmap(XtScreen(w), 
+    values.tile       = XmuCreateStippledPixmap(XtScreen(w),
                                                lw->list.foreground,
                                                lw->core.background_pixel,
                                                lw->core.depth);
@@ -374,10 +374,10 @@ CalculatedValues(Widget w)
        for (i = 0 ; i < lw->list.nitems; i++) {
            if (lw->simple.international == True)
                len = XmbTextEscapement(lw->list.fontset, lw->list.list[i],
-                                       strlen(lw->list.list[i]));
+                                       strlen(lw->list.list[i]));
            else
                len = XTextWidth(lw->list.font, lw->list.list[i],
-                                strlen(lw->list.list[i]));
+                                strlen(lw->list.list[i]));
            if (len > lw->list.longest)
                lw->list.longest = len;
        }
@@ -466,15 +466,15 @@ ChangeSize(Widget w, unsigned int width, unsigned int height)
 }
 
 /*ARGSUSED*/
-static void 
+static void
 XawListInitialize(Widget temp1, Widget cnew, ArgList args, Cardinal *num_args)
 {
     ListWidget lw = (ListWidget)cnew;
 
     if (!lw->list.font) XtError("Aborting: no font found\n");
-    if (lw->simple.international && !lw->list.fontset) 
+    if (lw->simple.international && !lw->list.fontset)
        XtError("Aborting: no fontset found\n");
-    
+
     /*
      * Initialize all private resources
      */
@@ -538,10 +538,10 @@ CvtToItem(Widget w, int xloc, int yloc, int *item)
        /* If in right margin handle things right */
        another = (xloc - (int)lw->list.internal_width) / lw->list.col_width;
        if (another >= lw->list.ncols) {
-           another = lw->list.ncols - 1; 
+           another = lw->list.ncols - 1;
            ret_val = OUT_OF_RANGE;
        }
-    }  
+    }
     if (xloc < 0 || yloc < 0)
        ret_val = OUT_OF_RANGE;
     if (one < 0)
@@ -600,8 +600,8 @@ ItemInRectangle(Widget w, int ul, int lr, int item)
     ListWidget lw = (ListWidget)w;
     int mod_item;
     int things;
-    
-    if (item < ul || item > lr) 
+
+    if (item < ul || item > lr)
       return (False);
     if (lw->list.vertical_cols)
        things = lw->list.nrows;
@@ -716,7 +716,7 @@ PaintItemName(Widget w, int item)
            HighlightBackground(w, x, y, lw->list.normgc);
        }
        else {
-           if (XtIsSensitive(w)) 
+           if (XtIsSensitive(w))
                gc = lw->list.normgc;
            else
                gc = lw->list.graygc;
@@ -731,7 +731,7 @@ PaintItemName(Widget w, int item)
            lw->list.is_highlighted = item;
        }
        else {
-           if (XtIsSensitive(w)) 
+           if (XtIsSensitive(w))
                gc = lw->list.normgc;
            else
                gc = lw->list.graygc;
@@ -759,7 +759,7 @@ PaintItemName(Widget w, int item)
     XSetClipMask(XtDisplay(w), gc, None);
 }
 
-static void 
+static void
 XawListRedisplay(Widget w, XEvent *event, Region region)
 {
     int item;                  /* an item to work with */
@@ -776,7 +776,7 @@ XawListRedisplay(Widget w, XEvent *event, Region region)
 
     if (Superclass->core_class.expose)
     (Superclass->core_class.expose)(w, event, region);
-    
+
     for (item = ul_item; item <= lr_item && item < lw->list.nitems; item++)
        if (ItemInRectangle(w, ul_item, lr_item, item))
            PaintItemName(w, item);
@@ -789,13 +789,13 @@ XawListRedisplay(Widget w, XEvent *event, Region region)
  * w - the widget.
  * intended - what the parent intends to do with us.
  * requested - what we want to happen */
-static XtGeometryResult 
+static XtGeometryResult
 XawListQueryGeometry(Widget w, XtWidgetGeometry *intended,
                     XtWidgetGeometry *requested)
 {
     Dimension new_width, new_height;
     Bool change, width_req, height_req;
-    
+
     width_req = intended->request_mode & CWWidth;
     height_req = intended->request_mode & CWHeight;
 
@@ -810,13 +810,13 @@ XawListQueryGeometry(Widget w, XtWidgetGeometry *intended,
        new_height = XtHeight(w);
 
     requested->request_mode = 0;
-    
+
    /*
     * We only care about our height and width
     */
     if (!width_req && !height_req)
        return (XtGeometryYes);
-    
+
     change = Layout(w, !width_req, !height_req, &new_width, &new_height);
 
     requested->request_mode |= CWWidth;
@@ -853,7 +853,7 @@ XawListResize(Widget w)
  * width, height- the is the current width and height that we are going
  *             we are going to layout the list widget to,
  *             depending on xfree and yfree of course.
- *                            
+ *
  * Return:
  *     True if width or height have been changed */
 static Bool
@@ -877,7 +877,7 @@ Layout(Widget w, Bool xfree, Bool yfree, Dimension *width, Dimension *height)
               of inter-column column_space 's as columns.  There should thus
               be a half column_space margin on each side of each column...*/
            width2 = lw->list.ncols * lw->list.col_width +
-                    (lw->list.internal_width << 1);
+                    (lw->list.internal_width << 1);
            change = True;
        }
        if (yfree) {
@@ -948,7 +948,7 @@ Layout(Widget w, Bool xfree, Bool yfree, Dimension *width, Dimension *height)
        while (1) {
            lw->list.nrows = ((lw->list.nitems - 1) / lw->list.ncols) + 1;
            width2 = lw->list.ncols * lw->list.col_width +
-                    (lw->list.internal_width << 1);
+                    (lw->list.internal_width << 1);
            height2 = lw->list.nrows * lw->list.row_height +
                      (lw->list.internal_height << 1);
            if (width2 >= MaxSize && height2 >= MaxSize)
@@ -984,7 +984,7 @@ Notify(Widget w, XEvent *event, String *params, Cardinal *num_params)
 
     /*
      * Find item and if out of range then unhighlight and return
-     * 
+     *
      * If the current item is unhighlighted then the user has aborted the
      * notify, so unhighlight and return
      */
@@ -1014,7 +1014,7 @@ Notify(Widget w, XEvent *event, String *params, Cardinal *num_params)
      */
     ret_value.string = lw->list.list[item];
     ret_value.list_index = item;
-    
+
     XtCallCallbacks(w, XtNcallback, (XtPointer)&ret_value);
 }
 
@@ -1051,7 +1051,7 @@ Set(Widget w, XEvent *event, String *params, Cardinal *num_params)
  * Set specified arguments into widget
  */
 /*ARGSUSED*/
-static Boolean 
+static Boolean
 XawListSetValues(Widget current, Widget request, Widget cnew,
                 ArgList args, Cardinal *num_args)
 {
@@ -1142,7 +1142,7 @@ XawListSetValues(Widget current, Widget request, Widget cnew,
        nl->list.highlight = NO_HIGHLIGHT;
        redraw = True;
     }
-    
+
     return (redraw);
 }
 
@@ -1151,7 +1151,7 @@ XawListDestroy(Widget w)
 {
     ListWidget lw = (ListWidget)w;
     XGCValues values;
-    
+
     XGetGCValues(XtDisplay(w), lw->list.graygc, GCTile, &values);
     XmuReleaseStippledPixmap(XtScreen(w), values.tile);
     XtReleaseGC(w, lw->list.graygc);
@@ -1233,7 +1233,7 @@ void
 XawListHighlight(Widget w, int item)
 {
     ListWidget lw = (ListWidget)w;
-    
+
     if (XtIsSensitive(w)) {
        lw->list.highlight = item;
        if (lw->list.is_highlighted != NO_HIGHLIGHT)
@@ -1259,7 +1259,7 @@ XawListShowCurrent(Widget w)
     XawListReturnStruct *ret_val;
 
     ret_val = (XawListReturnStruct *)XtMalloc(sizeof(XawListReturnStruct));
-    
+
     ret_val->list_index = lw->list.highlight;
     if (ret_val->list_index == XAW_LIST_NONE)
        ret_val->string = "";