home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / C / OTL-MC7.DMS / in.adf / classes.lha / Classes / Layouter / Windows.h < prev   
Encoding:
C/C++ Source or Header  |  1995-01-31  |  4.6 KB  |  152 lines

  1. #ifndef CPP_LAYOUTER_WINDOWS_H
  2. #define CPP_LAYOUTER_WINDOWS_H
  3.  
  4. // Ein GadTools Fenster, das den Layouter unterstützt.
  5. //
  6. // Autor: Jochen Becher
  7. //
  8. // Historie:
  9. // Version 1.0 am 14. März 94
  10.  
  11. #ifndef CPP_LAYOUTER_LAYOUTER_H
  12. #include <classes/layouter/layouter.h>
  13. #endif
  14.  
  15. #ifndef CPP_LIBRARIES_GADTOOLS_H
  16. #include <classes/libraries/gadtools.h>
  17. #endif
  18.  
  19. class LayouterWindowC;
  20.  
  21. class LayouterSizeHandlerC : public WindowNewsizeHandlerC {
  22. public:
  23.     LayouterSizeHandlerC(LayouterWindowC &w);
  24.     VOID newsize();
  25. private:
  26.     LayouterWindowC &window;
  27. };
  28.  
  29. class LayouterVerifyHandlerC : public WindowSizeverifyHandlerC {
  30. public:
  31.     LayouterVerifyHandlerC(LayouterWindowC &w);
  32.     VOID verify();
  33. private:
  34.     LayouterWindowC &window;
  35. };
  36.  
  37. class LayouterMinsizeHandlerC : public WindowChangeHandlerC {
  38. public:
  39.     LayouterMinsizeHandlerC(LayouterWindowC &);
  40.     VOID activate(BOOL v) { active = v; };
  41.     VOID change();
  42. private:
  43.     LayouterWindowC &window;
  44.     BOOL active;
  45. };
  46.  
  47. class BorderTransparentGroupC : public TransparentGroupLayoutC {
  48. public:
  49.     BorderTransparentGroupC();
  50.     WORD innerTopBorder() const { return innerTop; };
  51.     WORD innerBottomBorder() const { return innerBottom; };
  52.     WORD innerLeftBorder() const { return innerLeft; };
  53.     WORD innerRightBorder() const { return innerRight; };
  54.     VOID setInnerTopBorder(WORD v) { innerTop = v; };
  55.     VOID setInnerBottomBorder(WORD v) { innerBottom = v; };
  56.     VOID setInnerLeftBorder(WORD v) { innerLeft = v; };
  57.     VOID setInnerRightBorder(WORD v) { innerRight = v; };
  58. private:
  59.     WORD innerTop;
  60.     WORD innerBottom;
  61.     WORD innerLeft;
  62.     WORD innerRight;
  63. };
  64.  
  65. class LayouterWindowC : public GTWindowC {
  66. friend class LayouterSizeHandlerC;
  67. friend class LayouterVerifyHandlerC;
  68. friend class LayouterMinsizeHandlerC;
  69. public:
  70.     LayouterWindowC(GTIDCMPortC &, ScreenC &, TextAttrC &font,
  71.         Tag tag1type, ...);
  72.     LayouterWindowC(GTIDCMPortC &, ScreenC &, TextAttrC &font,
  73.         struct TagItem *tags = NULL);
  74.     BOOL isValid();
  75.     TextAttrC *font() const { return (TextAttrC *) guiFont; };
  76.     TextAttrC *titlefont() const { return (TextAttrC *) titleFont; };
  77.     VisualInfoC *visualInfo() const { return (VisualInfoC *) &vinfo; };
  78.     ScreenC *screen() const { return (ScreenC *) wScreen; };
  79.     virtual VOID setFallbackFonts(TextAttrC *font, TextAttrC *titlefont = NULL);
  80.     VOID open(Tag tag1type, ...) throw (WindowX, MemoryX)
  81.         { LayouterWindowC::open((struct TagItem *) &tag1type); };
  82.     VOID open(struct TagItem *tags = NULL) throw (WindowX, MemoryX);
  83.     virtual BOOL changeFont(TextAttrC *font, TextAttrC *titlefont = NULL,
  84.         BOOL avoidResize = TRUE);
  85.     virtual BOOL reLayout(BOOL avoidResize = TRUE);
  86. protected:
  87.     virtual VOID setTextAttrs(TextAttrC *gui, TextAttrC *title);
  88. private:
  89.     RootGeometryC root;
  90.     TransparentGroupLayoutC innerL;
  91.     BorderTransparentGroupC leftL, rightL, topL, bottomL;
  92.     TransparentLayoutC sizeTop, sizeBottom, sizeLeft, sizeRight;
  93.     GeometryC sizeTopGeo, sizeBottomGeo, sizeLeftGeo, sizeRightGeo;
  94. protected:
  95.     GeometryGroupC innerGeo;
  96.     GeometryGroupC leftGeo,rightGeo,topGeo,bottomGeo;
  97. private:
  98.     VisualInfoC vinfo;
  99.     ScreenC *wScreen;
  100. protected:
  101.     RootGadgetListC gadgets;
  102.     AnchorGadgetListC titlegadgets;
  103.     GTGadgetListC gtgadgets;
  104. private:
  105.     BOOL setFonts(TextAttrC *font, TextAttrC *titlefont, BOOL avoidResize);
  106.     TextAttrC *guiFont;
  107.     TextAttrC *guiFallback;
  108.     TextAttrC *titleFont;
  109.     TextAttrC *titleFallback;
  110.     GTWindowRefreshHandlerChainC refreshhandler;
  111.     LayouterSizeHandlerC sizehandler;
  112.     LayouterVerifyHandlerC verifyhandler;
  113.     LayouterMinsizeHandlerC minsizehandler;
  114.     BOOL maxWSet, maxHSet;
  115. };
  116.  
  117. class LayouterWindowListC : public WindowListC {
  118. public:
  119.     LayouterWindowListC();
  120.     VOID add(LayouterWindowC &);
  121.     VOID setFallbackFonts(TextAttrC *font, TextAttrC *titlefont = NULL);
  122.     BOOL changeFont(TextAttrC *font, TextAttrC *titlefont = NULL,
  123.         BOOL avoidResize = TRUE);
  124. };
  125.  
  126. class StandardWindowC : public LayouterWindowC {
  127. public:
  128.     StandardWindowC(GTIDCMPortC &, ScreenC &, GadgetC *defaultGadget,
  129.         Tag tag1type, ...);
  130.     StandardWindowC(GTIDCMPortC &, ScreenC &, GadgetC *defaultGadget = NULL,
  131.         struct TagItem *tags = NULL);
  132.     VOID open(Tag tag1type, ...) throw (WindowX, MemoryX)
  133.         { StandardWindowC::open((struct TagItem *) &tag1type); };
  134.     VOID open(struct TagItem *tags = NULL) throw (WindowX, MemoryX);
  135.     VOID setFallbackFonts(TextAttrC *font, TextAttrC *titlefont = NULL);
  136.     VOID setTextAttrs(TextAttrC *font, TextAttrC *titlefont);
  137.     BOOL changeFont(TextAttrC *font, TextAttrC *titlefont = NULL,
  138.         BOOL avoidResize = TRUE);
  139.     TextAttrC *boldFont() const { return (TextAttrC *) &bold; };
  140. private:
  141.     LTextAttrC defaultF;
  142.     LTextAttrC *textF;
  143.     LTextAttrC *titleF;
  144.     LTextAttrC *textFB;
  145.     LTextAttrC *titleFB;
  146.     FLTextAttrC bold;
  147.     GadgetC *defgadget;
  148.     BOOL firstOpened;
  149. };
  150.  
  151. #endif
  152.