Posted to tcl by egavilan at Tue Feb 03 01:58:28 GMT 2026view raw

  1. Index: generic/tkButton.c
  2. ==================================================================
  3. --- generic/tkButton.c
  4. +++ generic/tkButton.c
  5. @@ -58,10 +58,13 @@
  6. * Information used for parsing configuration options. There is a
  7. * separate table for each of the four widget classes.
  8. */
  9.  
  10. static const Tk_OptionSpec labelOptionSpecs[] = {
  11. + {TK_OPTION_DOUBLE, "-angle", "angle", "Angle",
  12. + "0.0", TCL_INDEX_NONE, offsetof(TkButton, angle),
  13. + 0, 0, 0},
  14. {TK_OPTION_BORDER, "-activebackground", "activeBackground", "Foreground",
  15. DEF_BUTTON_ACTIVE_BG_COLOR, TCL_INDEX_NONE, offsetof(TkButton, activeBorder),
  16. 0, DEF_BUTTON_ACTIVE_BG_MONO, 0},
  17. {TK_OPTION_COLOR, "-activeforeground", "activeForeground", "Background",
  18. DEF_BUTTON_ACTIVE_FG_COLOR, TCL_INDEX_NONE, offsetof(TkButton, activeFg),
  19.  
  20. Index: generic/tkButton.h
  21. ==================================================================
  22. --- generic/tkButton.h
  23. +++ generic/tkButton.h
  24. @@ -62,10 +62,11 @@
  25.  
  26. /*
  27. * Information about what's in the button.
  28. */
  29.  
  30. + double angle; /* Value of -angle option. */
  31. Tcl_Obj *textPtr; /* Value of -text option: specifies text to
  32. * display in button. */
  33. int underline; /* Value of -underline option: specifies index
  34. * of character to underline. INT_MIN means don't
  35. * underline anything. */
  36.  
  37. Index: unix/tkUnixButton.c
  38. ==================================================================
  39. --- unix/tkUnixButton.c
  40. +++ unix/tkUnixButton.c
  41. @@ -649,16 +649,27 @@
  42. 0, 0, (unsigned int) width, (unsigned int) height,
  43. imageXOffset, imageYOffset, 1);
  44. XSetClipOrigin(butPtr->display, gc, 0, 0);
  45. }
  46.  
  47. +if (butPtr->angle == 0.0) {
  48. Tk_DrawTextLayout(butPtr->display, pixmap, gc,
  49. butPtr->textLayout, x + textXOffset, y + textYOffset, 0, -1);
  50. Tk_UnderlineTextLayout(butPtr->display, pixmap, gc,
  51. butPtr->textLayout, x + textXOffset, y + textYOffset,
  52. butPtr->underline);
  53. y += fullHeight/2;
  54. +} else {
  55. +/* angle != 0*/
  56. + TkDrawAngledTextLayout(butPtr->display, pixmap, gc,
  57. + butPtr->textLayout, x + textXOffset, y + textYOffset,
  58. + butPtr->angle, 0, -1);
  59. + TkUnderlineAngledTextLayout(butPtr->display, pixmap, gc,
  60. + butPtr->textLayout, x + textXOffset, y + textYOffset,
  61. + butPtr->angle, butPtr->underline);
  62. + y += fullHeight/2;
  63. +}
  64. } else {
  65. if (haveImage) {
  66. TkComputeAnchor(butPtr->anchor, tkwin, 0, 0,
  67. butPtr->indicatorSpace + width, height, &x, &y);
  68. x += butPtr->indicatorSpace;
  69. @@ -714,15 +725,25 @@
  70. butPtr->indicatorSpace + butPtr->textWidth,
  71. butPtr->textHeight, &x, &y);
  72.  
  73. x += butPtr->indicatorSpace;
  74. ShiftByOffset(butPtr, relief, &x, &y, width, height);
  75. +if (butPtr->angle == 0.0) {
  76. Tk_DrawTextLayout(butPtr->display, pixmap, gc, butPtr->textLayout,
  77. x, y, 0, -1);
  78. Tk_UnderlineTextLayout(butPtr->display, pixmap, gc,
  79. butPtr->textLayout, x, y, butPtr->underline);
  80. y += butPtr->textHeight/2;
  81. +} else {
  82. +/* angle != 0*/
  83. + TkDrawAngledTextLayout(butPtr->display, pixmap, gc, butPtr->textLayout,
  84. + x, y, butPtr->angle, 0, -1);
  85. + TkUnderlineAngledTextLayout(butPtr->display, pixmap, gc,
  86. + butPtr->textLayout, x, y,
  87. + butPtr->angle, butPtr->underline);
  88. + y += butPtr->textHeight/2;
  89. +}
  90. }
  91. }
  92.  
  93. /*
  94. * Draw the indicator for check buttons and radio buttons. At this point,

Add a comment

Please note that this site uses the meta tags nofollow,noindex for all pages that contain comments.
Items are closed for new comments after 1 week