fxbitmaps.pp 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. Unit fxbitmaps;
  2. {$mode objfpc}
  3. Interface
  4. uses glib,gdk,gtk;
  5. Const
  6. DeleteXpmHeight=16;
  7. DeleteXpmColors=2;
  8. DeleteXpmArraySize=DeleteXpmHeight+DeleteXpmColors+1;
  9. DeleteXpm : Array[1..DeleteXpmArraySize] of Pchar = (
  10. '16 16 2 1', { 16x16 bitmap using 2 colors, 1 char per color}
  11. '. c #000000', { First color: Black }
  12. '# c None', { Second color : Transparent}
  13. '################', { The bitmap }
  14. '################',
  15. '##...#########.#',
  16. '##....######..##',
  17. '###....####..###',
  18. '#####...##..####',
  19. '######.....#####',
  20. '#######...######',
  21. '######.....#####',
  22. '#####...##..####',
  23. '####...####..###',
  24. '###...######.###',
  25. '##....#######.##',
  26. '##...###########',
  27. '###.##########.#',
  28. '################'
  29. );
  30. PropertiesXpmHeight = 16;
  31. PropertiesXpmColors = 4;
  32. PropertiesXpmArraySize = PropertiesXpmHeight+PropertiesXpmColors+1;
  33. PropertiesXpm : Array [1..PropertiesXpmArraySize] of PChar = (
  34. '16 16 4 1', { 16x16 bitmap using 2 colors, 1 char per color}
  35. '. c #000000', { First color : Black }
  36. '# c #000080', { Second color : Light Blue }
  37. 'a c None', { Third color : Transparent }
  38. 'b c #f8fcf8', { Last color : greyish }
  39. 'aaaaaaaaaaaaaaaa',
  40. 'aaaaaaa......a##',
  41. 'aaaaaa.aaaaaa.##',
  42. 'aaaaa.a.aaaaaa##',
  43. '.....a.a.aaaaa##',
  44. '.bb.a.a.a.aaa.##',
  45. '.b.a.b.a.a...a##',
  46. '.b..bbb.a.b.aaaa',
  47. '.bbbbbbb.bb.aaaa',
  48. '.bbbbbbbbbb.aaaa',
  49. '.b..b.....b.aaaa',
  50. '.bbbbbbbbbb.aaaa',
  51. '.b..b.....b.aaaa',
  52. '.bbbbbbbbbb.aaaa',
  53. '............aaaa',
  54. 'aaaaaaaaaaaaaaaa'
  55. );
  56. function CreateWidgetFromXPM (Window : PGtkWidget; Data : PPChar) : PgtkWidget;
  57. Implementation
  58. function CreateWidgetFromXPM (Window : PGtkWidget; Data : PPChar) : PGtkWidget;
  59. Var
  60. mask : PGdkBitmap;
  61. pixmap : PGdkPixMap;
  62. begin
  63. pixmap:=gdk_pixmap_create_from_xpm_d(window^.window,@mask,nil,ppgchar(Data));
  64. Result:=gtk_pixmap_new(Pixmap,Mask);
  65. gtk_widget_show(Result);
  66. end;
  67. end.