Author: matt Date: 2010-04-01 08:15:03 -0700 (Thu, 01 Apr 2010) New Revision: 7391 Log: Emulating FLTK2 alignment flags by calling FLTK3 align().
Modified: branches/branch-3.0/fltk/Flags.h branches/branch-3.0/fltk/Widget.h branches/branch-3.0/ide/Xcode3/FLTK.xcodeproj/project.pbxproj branches/branch-3.0/test/boxtype2.cxx Modified: branches/branch-3.0/fltk/Flags.h =================================================================== --- branches/branch-3.0/fltk/Flags.h 2010-04-01 14:58:37 UTC (rev 7390) +++ branches/branch-3.0/fltk/Flags.h 2010-04-01 15:15:03 UTC (rev 7391) @@ -1,67 +1,28 @@ // // "$Id: Flags.h 6233 2008-09-14 07:54:06Z spitzak $" // -// Unified flags set for fltk. These flags control the appearance of -// boxes and widgets. This same value is used to: -// -// 1. store state and other information in a widget or menu item -// 2. provide hints to boxes, labeltypes, and images for how to draw -// 3. provide structural information to an array of menu items -// -// These are shared because various parts of the code, especially -// drawing, want all of this information at once, and providing it -// as a single word is the easiest way. -// -// Copyright 2002 by Bill Spitzak and others. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Library General Public -// License as published by the Free Software Foundation; either -// version 2 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Library General Public License for more details. -// -// You should have received a copy of the GNU Library General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -// USA. -// -// Please report all bugs and problems to "[email protected]". +#ifndef fltk2_Flags_h +#define fltk2_Flags_h -#ifndef fltk_Flags_h -#define fltk_Flags_h - namespace fltk { -/// \name fltk/Flags.h -//@{ - -/*! Type returned by fltk::Widget::flags() and passed to fltk::Box - and many other drawing functions. */ typedef int Flags; - -/*! For back compatability with fltk1.1 */ typedef Flags Align; // for back compatability + enum { NO_FLAGS = 0x00000000, - // from Align, values are comptable with fltk 1.0: - // These control the location and appearance of labels: - // Warning: unused numbers may change behavior! - ALIGN_TOP = 0x00000001, //!< Label is centered above widget - ALIGN_BOTTOM = 0x00000002, //!< Label is centered below widget - ALIGN_LEFT = 0x00000004, //!< Label is to left of widget - ALIGN_RIGHT = 0x00000008, //!< Label is to right of widget - ALIGN_CENTER = 0x00000010, //!< (0) The label is centered inside widget - ALIGN_INSIDE = 0x00000020, //!< Label is inside widget, image centered - ALIGN_CLIP = 0x00000040, //!< The label is clipped to the widget - ALIGN_WRAP = 0x00000080, //!< The label is word-wrapped - ALIGN_MASK = 0x000000FF, //!< Used to split align() from flags() - ALIGN_POSITIONMASK = 0x0000000F, //!< Used to split align() from flags() + ALIGN_TOP = fltk3::ALIGN_TOP, + ALIGN_BOTTOM = fltk3::ALIGN_BOTTOM, + ALIGN_LEFT = fltk3::ALIGN_LEFT, + ALIGN_RIGHT = fltk3::ALIGN_RIGHT, + ALIGN_CENTER = fltk3::ALIGN_CENTER, + ALIGN_INSIDE = fltk3::ALIGN_INSIDE, + ALIGN_CLIP = fltk3::ALIGN_CLIP, + ALIGN_WRAP = fltk3::ALIGN_WRAP, + ALIGN_MASK = 0x000000FF, + ALIGN_POSITIONMASK = 0x0000000F, ALIGN_TOPLEFT = (ALIGN_TOP|ALIGN_LEFT), //!< Label is left-justified above widget ALIGN_BOTTOMLEFT = (ALIGN_BOTTOM|ALIGN_LEFT), //!< Label is left-justified below widget @@ -80,6 +41,7 @@ ALIGN_MENU = (ALIGN_INSIDE_LEFT|ALIGN_CLIP), //!< Label is inside widget bottom right ALIGN_BROWSER = ALIGN_MENU, //!< Label is inside widget bottom right + /* INACTIVE = 0x00000100, //!< !active() OUTPUT = 0x00000200, //!< does not get events, draw text colors STATE = 0x00000400, //!< state(), value() for buttons @@ -99,6 +61,7 @@ RESIZE_FIT = 0x01000000, //!< proportionnaly resize img in widget RESIZE_FILL = 0x00800000, //!< resize img to fill the widget OPENED = STATE //!< opened browser hierarchy parent + */ }; //@} Modified: branches/branch-3.0/fltk/Widget.h =================================================================== --- branches/branch-3.0/fltk/Widget.h 2010-04-01 14:58:37 UTC (rev 7390) +++ branches/branch-3.0/fltk/Widget.h 2010-04-01 15:15:03 UTC (rev 7391) @@ -128,8 +128,23 @@ Flags flags() const { return flags_; } void flags(Flags f) { flags_ = f; } - void set_flag(unsigned f) { flags_ |= f; } - void clear_flag(unsigned f) { flags_ &= ~f; } +#endif + + void set_flag(unsigned f) { + if (f&ALIGN_MASK) { + _p->align( _p->align() | (f&ALIGN_MASK)); + } + // fltk3: handle all the other flags... + } + + void clear_flag(unsigned f) { + if (f&ALIGN_MASK) { + _p->align( _p->align() &~ (f&ALIGN_MASK)); + } + // fltk3: handle all the other flags... + } + +#if 0 void invert_flag(unsigned f) { flags_ ^= f; } void set_flag(unsigned f,bool b) { flags_ = (flags_&~f)|(b?f:0); } bool flag(unsigned f) const { return (flags_ & f) != 0; } Modified: branches/branch-3.0/ide/Xcode3/FLTK.xcodeproj/project.pbxproj =================================================================== --- branches/branch-3.0/ide/Xcode3/FLTK.xcodeproj/project.pbxproj 2010-04-01 14:58:37 UTC (rev 7390) +++ branches/branch-3.0/ide/Xcode3/FLTK.xcodeproj/project.pbxproj 2010-04-01 15:15:03 UTC (rev 7391) @@ -5058,12 +5058,7 @@ C197AD2AAA7FA44783DD8E27 /* Frameworks */, 7806C7AA99FE626675560AF1 /* Tests */, 7DC38200FBE41638B7195263 /* Products */, - C9C907A011626698006C5014 /* hello-Info copy.plist */, - C9C907BA116266AB006C5014 /* hello-Info copy 2.plist */, - C9782F731163CD2F00491051 /* button-Info copy.plist */, - C9782F8C1163CD3900491051 /* button-Info copy 2.plist */, - C97831541164914B00491051 /* boxtype-Info copy.plist */, - C978316E1164915700491051 /* boxtype-Info copy 2.plist */, + C97832A21164EC3A00491051 /* plists */, ); sourceTree = "<group>"; }; @@ -5343,9 +5338,9 @@ 91FDF99B89F9FF9129E85003 /* ask */, 86CA4FED4095C8CF53154A82 /* bitmap */, 06DFADCF98F35FEDD23C6865 /* blocks */, - A18D3FFC7BD51E0063CDE1DB /* boxtype */, + A18D3FFC7BD51E0063CDE1DB /* 123 boxtype */, 1F2A334C7597E64951FE171D /* browser */, - DFDAA821C09CB20A1CBF591E /* button */, + DFDAA821C09CB20A1CBF591E /* 123 button */, 8C92CD0AE2ABEDD4BEEDF0E6 /* buttons */, AD3CD53EA76D9E31AFF4ED71 /* checkers */, C5BAF456219335209EA4AA9B /* clock */, @@ -5365,7 +5360,7 @@ AA8B93FA3AD672ED9C940A12 /* fullscreen */, 4872A6B5810CB954EE0FCB61 /* gl_overlay */, 5FC9447FDC36128608A852BA /* glpuzzle */, - 783A046650036FEF936250B4 /* hello */, + 783A046650036FEF936250B4 /* 123 hello */, 05063DB8DFD3CFA480E4E862 /* help */, 869E2D8F426D6813AA015BD7 /* iconize */, CEC93D332BAE3CD33732B7E3 /* image */, @@ -5409,14 +5404,14 @@ name = Tests; sourceTree = "<group>"; }; - 783A046650036FEF936250B4 /* hello */ = { + 783A046650036FEF936250B4 /* 123 hello */ = { isa = PBXGroup; children = ( 388A5267639C2CEEDD762C41 /* hello.cxx */, C9C9081D116270B8006C5014 /* hello1.cxx */, C9C9081E116270B8006C5014 /* hello2.cxx */, ); - name = hello; + name = "123 hello"; sourceTree = "<group>"; }; 7D7A86993530D6A56D5A7497 /* fltk */ = { @@ -5862,14 +5857,14 @@ name = CubeView; sourceTree = "<group>"; }; - A18D3FFC7BD51E0063CDE1DB /* boxtype */ = { + A18D3FFC7BD51E0063CDE1DB /* 123 boxtype */ = { isa = PBXGroup; children = ( 8513C25CD986E6EB06BECA58 /* boxtype.cxx */, C97831311164913700491051 /* boxtype1.cxx */, C97831321164913700491051 /* boxtype2.cxx */, ); - name = boxtype; + name = "123 boxtype"; sourceTree = "<group>"; }; A28D8313F0525624F48091A7 /* tabs */ = { @@ -6001,6 +5996,19 @@ name = valuators; sourceTree = "<group>"; }; + C97832A21164EC3A00491051 /* plists */ = { + isa = PBXGroup; + children = ( + C9C907A011626698006C5014 /* hello-Info copy.plist */, + C9C907BA116266AB006C5014 /* hello-Info copy 2.plist */, + C9782F731163CD2F00491051 /* button-Info copy.plist */, + C9782F8C1163CD3900491051 /* button-Info copy 2.plist */, + C97831541164914B00491051 /* boxtype-Info copy.plist */, + C978316E1164915700491051 /* boxtype-Info copy 2.plist */, + ); + name = plists; + sourceTree = "<group>"; + }; CEC93D332BAE3CD33732B7E3 /* image */ = { isa = PBXGroup; children = ( @@ -6045,14 +6053,14 @@ name = sudoku; sourceTree = "<group>"; }; - DFDAA821C09CB20A1CBF591E /* button */ = { + DFDAA821C09CB20A1CBF591E /* 123 button */ = { isa = PBXGroup; children = ( 047BB6E173EA9EDCD543E517 /* button.cxx */, C9782F991163CD9800491051 /* button1.cxx */, C9782F9A1163CD9800491051 /* button2.cxx */, ); - name = button; + name = "123 button"; sourceTree = "<group>"; }; E2D3B0AFBE3D6983D98316B0 /* fast_slow */ = { Modified: branches/branch-3.0/test/boxtype2.cxx =================================================================== --- branches/branch-3.0/test/boxtype2.cxx 2010-04-01 14:58:37 UTC (rev 7390) +++ branches/branch-3.0/test/boxtype2.cxx 2010-04-01 15:15:03 UTC (rev 7391) @@ -43,8 +43,8 @@ fltk::Widget *b = new fltk::InvisibleBox(type,x,y,square ? H-20 : W-20,H-20,name); b->labelsize(11); if (square) { - // FLTK123: b->clear_flag(fltk::ALIGN_MASK); - // FLTK123: b->set_flag(fltk::ALIGN_RIGHT); + b->clear_flag(fltk::ALIGN_MASK); + b->set_flag(fltk::ALIGN_RIGHT); } return b; } _______________________________________________ fltk-commit mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk-commit
