flayer.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * This file is part of the UCB release of Plan 9. It is subject to the license
  3. * terms in the LICENSE file found in the top-level directory of this
  4. * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
  5. * part of the UCB release of Plan 9, including this file, may be copied,
  6. * modified, propagated, or distributed except according to the terms contained
  7. * in the LICENSE file.
  8. */
  9. // Plan9 types
  10. typedef unsigned char uchar;
  11. typedef unsigned short ushort;
  12. typedef uint64_t uvlong;
  13. typedef uint32_t ulong;
  14. typedef int64_t vlong;
  15. typedef enum Vis{
  16. None=0,
  17. Some,
  18. All,
  19. }Vis;
  20. enum{
  21. Clicktime=1000, /* one second */
  22. };
  23. typedef struct Flayer Flayer;
  24. struct Flayer
  25. {
  26. Frame f;
  27. long origin; /* offset of first char in flayer */
  28. long p0, p1;
  29. long click; /* time at which selection click occurred, in HZ */
  30. Rune *(*textfn)(Flayer*, long, ulong*);
  31. int user0;
  32. void *user1;
  33. Rectangle entire;
  34. Rectangle scroll;
  35. Rectangle lastsr; /* geometry of scrollbar when last drawn */
  36. Vis visible;
  37. };
  38. void flborder(Flayer*, int);
  39. void flclose(Flayer*);
  40. void fldelete(Flayer*, long, long);
  41. void flfp0p1(Flayer*, ulong*, ulong*);
  42. void flinit(Flayer*, Rectangle, Font*, Image**);
  43. void flinsert(Flayer*, Rune*, Rune*, long);
  44. void flnew(Flayer*, Rune *(*fn)(Flayer*, long, ulong*), int, void*);
  45. int flprepare(Flayer*);
  46. Rectangle flrect(Flayer*, Rectangle);
  47. void flrefresh(Flayer*, Rectangle, int);
  48. void flresize(Rectangle);
  49. int flselect(Flayer*);
  50. void flsetselect(Flayer*, long, long);
  51. void flstart(Rectangle);
  52. void flupfront(Flayer*);
  53. Flayer *flwhich(Point);
  54. #define FLMARGIN 4
  55. #define FLSCROLLWID 12
  56. #define FLGAP 4
  57. extern Image *maincols[NCOL];
  58. extern Image *cmdcols[NCOL];