/** * Copyright Mikael Högdahl - triyana@users.sourceforge.net * * This source is distributed under the terms of the Q Public License version 1.0, * created by Trolltech (www.trolltech.com). */ #ifndef Fl_Layout_h #define Fl_Layout_h #include /** * A border layout widget or a split widget for two child widgets or * a vertical/horizontal group widget.. */ class Fl_Layout : public Fl_Group { public: enum { NORTH = 0, SOUTH, EAST, WEST, CENTER, }; virtual void add (int position, Fl_Widget* widget); int handle (int event); void off (bool o) {aOff = o;} void resize (int x, int y, int w, int h); protected: enum { BORDER = 1, HORIZONTAL, HORIZONTAL_SPLIT, VERTICAL, VERTICAL_SPLIT }; Fl_Layout (int layout, int x, int y, int w, int h); bool aOff; int aLayout; int aSize; int aDrag; int aSpace[6]; Fl_Widget* aWidget1; Fl_Widget* aWidget2; Fl_Widget* aWidgets[5]; void resizeBorder (int x, int y, int w, int h); void resizeHorizontal (int x, int y, int w, int h); void resizeHorizontalSplit (int x, int y, int w, int h); void resizeVertical (int x, int y, int w, int h); void resizeVerticalSplit (int x, int y, int w, int h); virtual void space (int north, int south, int west, int east) {aSpace[1] = north; aSpace[2] = south; aSpace[3] = west; aSpace[4] = east; aSpace[5] = 0;} }; class Fl_BorderLayout : public Fl_Layout { public: Fl_BorderLayout (int x, int y, int w, int h) : Fl_Layout (Fl_Layout::BORDER, x, y, w, h) {;} void space (int north, int south, int west, int east) {aSpace[1] = north; aSpace[2] = south; aSpace[3] = west; aSpace[4] = east; aSpace[5] = 0;} }; class Fl_HorizontalLayout : public Fl_Layout { public: Fl_HorizontalLayout (int x, int y, int w, int h) : Fl_Layout (Fl_Layout::HORIZONTAL, x, y, w, h) {;} void add (Fl_Widget* w) {Fl_Group::add (w);} void space (int v, int s) {aSpace[0] = v; aSpace[1] = s;} protected: void space (int north, int south, int west, int east) {;} }; class Fl_HorizontalSplitLayout : public Fl_Layout { public: Fl_HorizontalSplitLayout (int x, int y, int w, int h) : Fl_Layout (Fl_Layout::HORIZONTAL_SPLIT, x, y, w, h) {;} void addLeft (Fl_Widget* w) {Fl_Layout::add (WEST, w);} void addRight (Fl_Widget* w) {Fl_Layout::add (EAST, w);} void size (int s) {aSize = s;} void space (int s) {aSpace[0] = s;} protected: void space (int north, int south, int west, int east) {;} void add (Fl_Widget* w) {;} }; class Fl_VerticalLayout : public Fl_Layout { public: Fl_VerticalLayout (int x, int y, int w, int h) : Fl_Layout (Fl_Layout::VERTICAL, x, y, w, h) {;} void add (Fl_Widget* w) {Fl_Group::add (w);} void space (int v, int s) {aSpace[0] = v; aSpace[1] = s;} protected: void space (int north, int south, int west, int east) {;} }; class Fl_VerticalSplitLayout : public Fl_Layout { public: Fl_VerticalSplitLayout (int x, int y, int w, int h) : Fl_Layout (Fl_Layout::VERTICAL_SPLIT, x, y, w, h) {;} void addBottom (Fl_Widget* w) {Fl_Layout::add (SOUTH, w);} void addTop (Fl_Widget* w) {Fl_Layout::add (NORTH, w);} void size (int s) {aSize = s;} void space (int s) {aSpace[0] = s;} protected: void space (int north, int south, int west, int east) {;} void add (Fl_Widget* w) {;} }; #endif