~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Tina4/src/Xm/tw_label.c

Version: ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /**@(#)
  2 **/
  3 #include <tina/sys.h>
  4 #include <tina/math.h>
  5 #include <tina/tv.h>
  6 #include  <tina/mtw.h>
  7 #include  <tina/tv_screen.h>
  8 #include <tina/Xmfuncs.h>
  9 
 10 int     tw_label(char *name)
 11 {
 12     Widget  panel, tw_get_panel(void);
 13     Widget  label;
 14     XmString xmstring;
 15     int     nargs;
 16     Arg     wargs[1];
 17     int     w, h;
 18 
 19     panel = tw_get_panel();
 20 
 21     xmstring = XmStringCreate(name, XmSTRING_DEFAULT_CHARSET);
 22     nargs = 0;
 23     XtSetArg(wargs[nargs], XmNlabelString, xmstring);
 24     nargs++;
 25     label = XtCreateManagedWidget("twlabel", xmLabelWidgetClass,
 26                                   panel, wargs, nargs);
 27     XmStringFree(xmstring);
 28 
 29     tw_space(0.0, 2.0);
 30     w = tw_charwidth(2.0 + strlen(name));
 31     h = tw_charheight(1.5);
 32     tw_set_entry(label, w, h);
 33 
 34     return ((int) label);
 35 }
 36 
 37 void    tw_label_reset(Widget label, char *name)
 38 {
 39     XmString xmstring;
 40     int     nargs;
 41     Arg     wargs[1];
 42 
 43     xmstring = XmStringCreate(name, XmSTRING_DEFAULT_CHARSET);
 44     nargs = 0;
 45     XtSetArg(wargs[nargs], XmNlabelString, xmstring);
 46     nargs++;
 47     XtSetValues(label, wargs, nargs);
 48 }
 49 Widget tw_icon_label(char *name, int w, int h,char *image_bits)
 50 
 51 {
 52     int     row;
 53     Pixel foreground,background;
 54     Arg     wargs[4];
 55     Tw_callback *twc;
 56     Widget  panel = tw_get_panel(), label;
 57     Pixmap pix;
 58     char   *fullname = tw_extend_fullname(tw_get_toolname(), name);
 59     Display *display=tw_get_display();
 60     int screen=DefaultScreen(display);
 61     int depth=DefaultDepth(display,screen);
 62     Drawable window=DefaultRootWindow(display);
 63 
 64     label=XtCreateManagedWidget("twiconlabel", xmLabelWidgetClass,
 65                                  panel, wargs, 0);
 66     XtSetArg(wargs[0],XmNforeground,&foreground);
 67     XtSetArg(wargs[1],XmNbackground,&background);
 68     XtGetValues(label,wargs,2);
 69 
 70     pix=XCreatePixmapFromBitmapData(display,window,image_bits,w,h,
 71                                     foreground,background,depth);
 72     XtSetArg(wargs[0], XmNlabelPixmap, pix);
 73     XtSetArg(wargs[1],XmNlabelType,XmPIXMAP);
 74     XtSetValues(label,wargs,2);
 75 
 76     tw_set_entry(label, w+10, h+10);
 77     return label;
 78 }
 79 
 80 void tw_label_reset_image(Widget label,int w, int h,
 81                            char *image_bits)
 82 {
 83   Pixel foreground,background;
 84   Pixmap pix;
 85   Arg wargs[4];
 86   Display *display=tw_get_display();
 87   int screen=DefaultScreen(display);
 88   int depth=DefaultDepth(display,screen);
 89   Drawable window=DefaultRootWindow(display);
 90   
 91   XtSetArg(wargs[0],XmNforeground,&foreground);
 92   XtSetArg(wargs[1],XmNbackground,&background);
 93   XtGetValues(label,wargs,2);
 94   pix=XCreatePixmapFromBitmapData(display,window,image_bits,w,h,
 95                                   foreground,background,depth);
 96   XtSetArg(wargs[0], XmNlabelPixmap, pix);
 97   XtSetArg(wargs[1],XmNlabelType,XmPIXMAP);
 98   XtSetValues(label,wargs,2);
 99 
100 }
101 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.