|
Main Page
Class Hierarchy
Alphabetical List
Compound List
File List
Compound Members
|
00001 /********************************************************************************
00002 * *
00003 * Vertical text scrolling widget *
00004 * *
00005 *********************************************************************************
00006 * Copyright (C) 2003 by Mathew Robertson. All Rights Reserved. *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or *
00009 * modify it under the terms of the GNU Lesser General Public *
00010 * License as published by the Free Software Foundation; either *
00011 * version 2.1 of the License, or (at your option) any later version. *
00012 * *
00013 * This library is distributed in the hope that it will be useful, *
00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
00016 * Lesser General Public License for more details. *
00017 * *
00018 * You should have received a copy of the GNU Lesser General Public *
00019 * License along with this library; if not, write to the Free Software *
00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
00021 ********************************************************************************/
00022 #ifndef FXTEXTVSCROLLER_H
00023 #define FXTEXTVSCROLLER_H
00024
00025 #ifndef FXPACKER_H
00026 #include <fox/FXPacker.h>
00027 using namespace FX;
00028 #endif
00029 namespace FXEX {
00030
00031 /// Vertical text scroller options
00032 enum {
00033 TEXTVSCROLLER_SCROLLBACK = 0x00100000, /// when scrolling hits the bottom, scroll back up
00034 TEXTVSCROLLER_RESET = 0x00200000, /// when scrolling hits the bottom, reset from top
00035 TEXTVSCROLLER_BYLINE = 0x00400000 /// scoll the text line-by-line, rather than by pixel
00036 };
00037
00038 /**
00039 * Vertical text scroller - like you would use for a 'credits' widget
00040 * TODO - need a reset() method to take the scoll back to the top
00041 * - also need to scroll in reverse
00042 */
00043 class FXAPI FXTextVScroller : public FXPacker {
00044 FXDECLARE(FXTextVScroller)
00045
00046 private:
00047 FXint speed;
00048 FXint delay;
00049 FXuint increment;
00050 FXText *text;
00051 FXbool owned;
00052
00053 private:
00054 FXTextVScroller(const FXTextVScroller&);
00055 FXTextVScroller& operator=(const FXTextVScroller&);
00056
00057 public:
00058 long onAutoScroll(FXObject*,FXSelector,void*);
00059
00060 public:
00061 enum {
00062 ID_AUTOSCROLL=FXScrollArea::ID_LAST,
00063 ID_LAST
00064 };
00065
00066 protected:
00067
00068 /// serialisation
00069 FXTextVScroller();
00070
00071 /// scroll the contents by the next increment
00072 void scrollContents();
00073
00074 public:
00075
00076 /// Construct a text scroller, using an existing text widget
00077 FXTextVScroller(FXComposite *p,FXText *t,FXObject* tgt=NULL,FXSelector sel=0,FXuint opts=0,FXbool own=FALSE,FXint x=0,FXint y=0,FXint w=0,FXint h=0,FXint pl=DEFAULT_SPACING,FXint pr=DEFAULT_SPACING,FXint pt=DEFAULT_SPACING,FXint pb=DEFAULT_SPACING);
00078
00079 /// Construct text-scroller widget
00080 FXTextVScroller(FXComposite *p,FXObject* tgt=NULL,FXSelector sel=0,FXuint opts=0,FXint x=0,FXint y=0,FXint w=0,FXint h=0,FXint pl=DEFAULT_SPACING,FXint pr=DEFAULT_SPACING,FXint pt=DEFAULT_SPACING,FXint pb=DEFAULT_SPACING);
00081
00082 /// Create server-side resources
00083 virtual void create();
00084
00085 /// Detach server-side resources
00086 virtual void detach();
00087
00088 /// Destroy server-side resources
00089 virtual void destroy();
00090
00091 /// Return text in the widget
00092 FXText* getText() { return text; }
00093
00094 /// set the scrolling speed
00095 void setSpeed(FXint ms);
00096
00097 /// get the scrolling speed
00098 FXint getSpeed() const { return speed; }
00099
00100 /// set the delay value before scrolling begins / after scrolling ends
00101 void setDelay(FXint ms);
00102
00103 /// get the delay
00104 FXint getDelay() const { return delay; }
00105
00106 /// Save to a stream
00107 virtual void save(FXStream& store) const;
00108
00109 /// Load from a stream
00110 virtual void load(FXStream& store);
00111
00112 /// Destructor
00113 virtual ~FXTextVScroller();
00114 };
00115
00116 } // namespace FXEX
00117 #endif // FXTEXTVSCROLLER