label.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. typedef struct TkLabel TkLabel;
  2. /*
  3. * widgets that use the label code:
  4. * label
  5. * checkbutton
  6. * button
  7. * menubutton
  8. * separator
  9. * cascade
  10. * radiobutton
  11. */
  12. struct TkLabel
  13. {
  14. char* text; /* Label value */
  15. Image* bitmap; /* Bitmap to display */
  16. TkImg* img;
  17. int justify;
  18. int anchor;
  19. // int flags; /* justify/anchor */
  20. int w;
  21. int h;
  22. int textheight;
  23. /* button fields */
  24. char* command; /* Command to execute at invoke */
  25. char* value; /* Variable value in radio button */
  26. char* offvalue; /* Off value for check button */
  27. char* variable; /* Variable name in radio button */
  28. int ul;
  29. int check; /* check/radiobutton/choicebutton state */
  30. int indicator; /* -indicatoron setting */
  31. char* menu;
  32. char** values;
  33. int nvalues;
  34. /* current value of choicebutton is represented by check */
  35. };
  36. /* Layout constants */
  37. enum {
  38. Textpadx = 3,
  39. Textpady = 0,
  40. Bitpadx = 0, /* Bitmap padding in labels */
  41. Bitpady = 0,
  42. CheckButton = 10,
  43. CheckButtonBW = 1,
  44. ButtonBorder = 4,
  45. CheckSpace = CheckButton + 2*CheckButtonBW + 2*ButtonBorder,
  46. };
  47. extern TkOption tkbutopts[];
  48. extern TkOption tkradopts[];
  49. extern TkOption tkcbopts[];
  50. /* label.c */
  51. extern void tksizelabel(Tk*);
  52. extern char* tkdrawlabel(Tk*, Point);
  53. extern void tkfreelabel(Tk*);
  54. extern void tklabelgetimgs(Tk*, Image**, Image**);
  55. extern char* tksetvar(TkTop*, char*, char*);
  56. /* buton.c */
  57. extern Tk* tkmkbutton(TkTop*, int);
  58. extern void tksizebutton(Tk*);
  59. extern char* tkdrawbutton(Tk*, Point);
  60. extern char* tkbuttoninvoke(Tk*, char*, char**);
  61. extern char* tkradioinvoke(Tk*, char*, char**);
  62. extern void tkfreebutton(Tk*);
  63. /* support for menus */
  64. extern int tklabelmargin(Tk*);
  65. extern int tkbuttonmargin(Tk*);