Laxkit  0.0.7.1
Public Member Functions | Public Attributes | Protected Member Functions
Laxkit::ScrolledWindow Class Reference

Class to have a window associated with a vertical and horizontal scroller. More...

Inheritance diagram for Laxkit::ScrolledWindow:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 ScrolledWindow (anXWindow *parnt, const char *nname, const char *ntitle, unsigned long nstyle, int xx, int yy, int ww, int hh, int brder, anXWindow *prev, unsigned long nowner=0, const char *nsend=NULL, PanController *pan=NULL)
virtual int init ()
 Create the scrollers and panpopup. Add them to panner tell stack.
virtual int send ()
 Send what? huh?***.
virtual void syncWindows (int useinrect=0)
 MoveResize the scrollers, panwindow, and thewindow.
virtual int UseThisWindow (anXWindow *nwindow)
 Use nwindow as the nested window.
virtual int MoveResize (int nx, int ny, int nw, int nh)
 Just calls anXWindow::MoveResize, then syncWindows().
virtual int Resize (int nw, int nh)
 Just calls anXWindow::Resize, then syncWindows().
virtual int Event (const EventData *e, const char *mes)
- Public Member Functions inherited from Laxkit::PanUser
 PanUser (PanController *npan=NULL)
 Create with a new panner.
virtual ~PanUser ()
 Removes this from panner tellstack. Delete panner if necessary.
virtual PanControllercreateNewPanner (PanController *pan=NULL)
 Create a new panner that is a copy of pan if given.
virtual void UseThisPanner (PanController *npanner)
 Replace the current panner with npanner, which can be NULL to mean make a new one.
- Public Member Functions inherited from Laxkit::anXWindow
 anXWindow (anXWindow *parnt, const char *nname, const char *ntitle, unsigned long nstyle, int xx, int yy, int ww, int hh, int brder, anXWindow *prev, unsigned long nowner, const char *nsend)
 Constructor.
virtual ~anXWindow ()
 anXWindow destructor. Its X window should have been XDestroy'd before here.
virtual const charwhattype ()
virtual const charWindowTitle (int which=0)
 Return basically the name of the window.
virtual void WindowTitle (const char *newtitle)
 Change the title of the window. This text would usually be displayed in the bar provided by a window manager.
virtual const chartooltip (int mouseid=0)
 By default, return win_tooltip.
virtual const chartooltip (const char *newtooltip)
 Replace the current tooltip, return the current tooltip (after replacing).
virtual anXWindowfindChildWindowByTitle (const char *title)
 Find the first immediate child window that has win_title==title.
virtual anXWindowfindChildWindowByName (const char *name)
 Find the first immediate child window that has win_name==name.
virtual int Grayed ()
 Return whether this window is grayed.
virtual int Grayed (int g)
 Set the gray state of this window. Returns Grayed(void).
virtual int preinit ()
virtual int close ()
 Called by anXApp from anXApp::destroywindow() when a window is to be destroyed.
virtual int Idle (int tid=0)
 anXWindow::Idle() is an empty placeholeder. Just returns 1.
virtual void Refresh ()
 anXWindow::Refresh() is an empty placeholeder. Just calls Needtodraw(0) and returns 0.
virtual DisplayerMakeCurrent ()
virtual int Needtodraw ()
 Default is to return needtodraw.
virtual void Needtodraw (int nntd)
 If 0, then the window does not need refreshing. Otherwise it does.
virtual int deletenow ()
 Return whether the window is allowed to be deleted.
virtual int setWinStyle (unsigned int stylebit, int newvalue)
 Control various window related basic styling of win_style.
virtual int getWinStyle (unsigned int stylebit)
 Currently, simply return win_style&stylebit.
virtual void installColors (WindowColors *newcolors)
 Dec_count old and inc_count new.
virtual ShortcutHandlerGetShortcuts ()
 Return a ShortcutHandler that contains stacks of bound shortcuts and possible window actions.
virtual int PerformAction (int action_number)
virtual int ExposeChange (ScreenEventData *e)
 Default behavior on Expose events is to call Needtodraw(1).
virtual int DeviceChange (const DeviceEventData *e)
virtual int CharInput (unsigned int ch, const char *buffer, int len, unsigned int state, const LaxKeyboard *kb)
 Input of character data or control character presses.
virtual int KeyUp (unsigned int ch, unsigned int state, const LaxKeyboard *kb)
 Called when a key is released.
virtual int MouseMove (int x, int y, unsigned int state, const LaxMouse *m)
 Empty placeholder, just returns 1.
virtual int ButtonDown (int button, int x, int y, unsigned int state, int count, const LaxMouse *m)
virtual int ButtonUp (int button, int x, int y, unsigned int state, const LaxMouse *m)
virtual int LBDown (int x, int y, unsigned int state, int count, const LaxMouse *d)
 Default is just to return 1.
virtual int LBUp (int x, int y, unsigned int state, const LaxMouse *d)
 Default is just to return 1.
virtual int MBDown (int x, int y, unsigned int state, int count, const LaxMouse *d)
 Default is just to return 1.
virtual int MBUp (int x, int y, unsigned int state, const LaxMouse *d)
 Default is just to return 1.
virtual int RBDown (int x, int y, unsigned int state, int count, const LaxMouse *d)
 Default is just to return 1.
virtual int RBUp (int x, int y, unsigned int state, const LaxMouse *d)
 Default is just to return 1.
virtual int WheelUp (int x, int y, unsigned int state, int count, const LaxMouse *d)
 The wheel mouse rolling up. Default is just to return 1.
virtual int WheelDown (int x, int y, unsigned int state, int count, const LaxMouse *d)
 The wheel mouse rolling down. Default is just to return 1.
virtual int FocusOn (const FocusChangeData *e)
 Increment win_active, and highlights the window's border, if the event refers to this window.
virtual int FocusOff (const FocusChangeData *e)
 Decrements win_active, and de-highlights the window's border if win_active==0, if event is a real focus off.
virtual void contentChanged ()
 Windows may call this when their contents change.
virtual void selectionChanged ()
 Windows may call this when their selections change.
virtual anXWindowGetController ()
 Return the window most relevant for tab control loops.
virtual int SelectNextControl (const LaxDevice *d)
 Transfer focus to nextcontrol.
virtual int SelectPrevControl (const LaxDevice *d)
 Transfer the focus to prevcontrol.
virtual void ControlActivation (int on)
 Do special activation or not when controls are activated by tabbing.
virtual int AddPrevControl (anXWindow *prev)
virtual int AddNextControl (anXWindow *next)
virtual int ConnectControl (anXWindow *towhat, int after=1)
 Connect towhat to this. Used for tab loops.
virtual int CloseControlLoop ()
 Close a tab loop.
virtual void SetOwner (anXWindow *nowner, const char *mes=NULL, unsigned int send_mask=0)
 Set the new owner and control message.
virtual void SetOwner (unsigned long nowner_id, const char *mes=NULL, unsigned int send_mask=0)
virtual void dump_out (FILE *f, int indent, int what, anObject *context)
 Simple dumping function.
virtual LaxFiles::Attributedump_out_atts (LaxFiles::Attribute *att, int what, anObject *context)
virtual void dump_in_atts (LaxFiles::Attribute *att, int flag, anObject *context)
- Public Member Functions inherited from Laxkit::Tagged
virtual int HasTag (const char *tag, int casematters)
 Return whether the tag exists.
virtual int NumberOfTags ()
 Return the number of tags, strangely enough.
virtual const charGetTag (int i)
 Return const pointer to the tag text for tag number i, where i==0 is the first tag.
virtual charGetAllTags ()
 Return a new char[] with a space separated list of all the tags.
virtual int InsertTags (const char *tags, int casematters)
 Insert tags from a string such as 'tag1 tag2 tag3 "tag with spaces" tag4'.
virtual int InsertTag (const char *tag, int casematters)
 Insert tag if it doesn't exist already.
virtual int RemoveTag (const char *tag)
 The tag must be an exact match.
virtual int RemoveTag (int i)
 Remove tag number i. i must be in range [0..NumberOfTags()-1].
virtual void FlushTags ()
- Public Member Functions inherited from LaxFiles::DumpUtility
virtual void dump_in (FILE *f, int indent, int what, Laxkit::anObject *loadcontext, Attribute **att)
 Read in a file segment as an Attribute, and pass parsing duties to dump_in_atts.
virtual ~DumpUtility ()
 Empty virtual destructor.
- Public Member Functions inherited from Laxkit::aDrawable
 aDrawable (Drawable d=0)
virtual int DrawableType ()
virtual int ValidDrawable ()

Public Attributes

IntRectangle inrect
 The rectangle that thewindow resides in.
IntRectangle outrect
 The rectangle that holds all of thewindow and scrollers.
int scrollwidth
PanPopuppanpopup
anXWindowthewindow
Scrollerxscroller
Scrolleryscroller
- Public Attributes inherited from Laxkit::PanUser
PanControllerpanner
- Public Attributes inherited from Laxkit::anXWindow
WindowColorswin_colors
anXAppapp
charwin_name
 An arbitrary string to be used as an id.
charwin_title
 The title of the window.
anXWindowwin_parent
int win_screen
unsigned long win_style
int win_x
int win_y
int win_w
int win_h
unsigned int win_border
int win_pointer_shape
 Identifier for a stock mouse shape.
char win_on
 Nonzero if the window is mapped.
char win_active
 Should be positive when the window has a keyboard focus, 0 otherwise.
unsigned long win_owner
 Who gets control messages from this window.
unsigned int win_owner_send_mask
charwin_sendthis
 The type of message that gets sent to owner.
anXWindownextcontrol
anXWindowprevcontrol
- Public Attributes inherited from Laxkit::Tagged
int sorttags

Protected Member Functions

virtual void findoutrect ()
 Define the area that the scrollers, panpopup, and thewindow should go in.
virtual void adjustinrect ()
 Called as final command in syncWindows.
- Protected Member Functions inherited from Laxkit::anXWindow
virtual int deletekid (anXWindow *w)
 Purges child anXWindows from window's child stack.
virtual void SwapBuffers ()
 Swap buffers. This should be called from Refresh() if VIEWPORT_BACK_BUFFER is set in win_style.
virtual void SetupBackBuffer ()
 Initialize the backbuffer.

Additional Inherited Members

- Protected Attributes inherited from Laxkit::anXWindow
charwin_tooltip
 Convenience variable to hold the window's tooltip, if any.
int needtodraw
RefPtrStack< anXWindow_kids
 Stack of children of the window.
- Protected Attributes inherited from Laxkit::Tagged
PtrStack< charlist_of_tags

Detailed Description

Class to have a window associated with a vertical and horizontal scroller.

This is a somewhat simple container designed to have ONLY scrollers, a single main window, and an optional PanPopup in the corner. The scrollers can come and go or be permanent.

Todo:
*** should have option to either resize thewindow to fit within the space not taken by scrollers, and pass on panchange events to that window, OR have thewindow be just a huge window that the scrollbars automatically move around!!! That would be quite useful for containing dialogs....
#include <lax/scrolledwindow.h>
// If you do not specify TOP or BOTTOM, then the horizontal scroller is not included.
// Likewise for LEFT and RIGHT regarding the vertical scroller.
// Put an x scroller on either top or bottom
#define SW_TOP (1<<16)
#define SW_BOTTOM (1<<17)
// Put a y scroller on either left or right
#define SW_LEFT (1<<18)
#define SW_RIGHT (1<<19)
// inlude a PanWindow in corner between the scrollers
#define SW_INCLUDE_PAN (1<<20)
// Always have x or y scrollers, they do not go away when not needed.
#define SW_ALWAYS_X (1<<21)
#define SW_ALWAYS_Y (1<<22)
// Allow scrolling in the x or y direction
#define SW_X_ZOOMABLE (1<<23)
#define SW_Y_ZOOMABLE (1<<24)
// When zooming, preserve the aspect ratio of the boxed area.
#define SW_SYNC_XY (1<<25)
// Move around a subwindow in response to scroll events,
// Otherwise default is to simply relay pan changes to thewindow.
#define SW_MOVE_WINDOW (1<<26)

Constructor & Destructor Documentation

Laxkit::ScrolledWindow::ScrolledWindow ( anXWindow parnt,
const char nname,
const char ntitle,
unsigned long  nstyle,
int  xx,
int  yy,
int  ww,
int  hh,
int  brder,
anXWindow prev,
unsigned long  nowner = 0,
const char nsend = NULL,
PanController pan = NULL 
)

****maybe should not have pan inputable here.. should allow inputing spacerect bounds, and/or thewindow...


Member Function Documentation

void Laxkit::ScrolledWindow::adjustinrect ( )
protectedvirtual

Called as final command in syncWindows.

Does nothing. Derived classes can redefine to further reduce inrect if they wish.

inrect is where the main window contents should be drawn into. It is a subset of the whole window, minus the space reserved for scrollbars.

Reimplemented in Laxkit::MenuSelector, and Laxkit::TreeSelector.

Referenced by syncWindows().

int Laxkit::ScrolledWindow::Event ( const EventData e,
const char mes 
)
virtual
Todo:
*** this must respond to panner events and pass them on to the subwindows...

Reimplemented from Laxkit::anXWindow.

Reimplemented in Laxkit::MenuSelector.

void Laxkit::ScrolledWindow::findoutrect ( )
protectedvirtual

Define the area that the scrollers, panpopup, and thewindow should go in.

Default is the whole window. Derived classes can redefine this to remove any space that they want to use.

Reimplemented in Laxkit::MenuSelector, and Laxkit::TreeSelector.

References outrect.

Referenced by syncWindows().

int Laxkit::ScrolledWindow::init ( )
virtual

Create the scrollers and panpopup. Add them to panner tell stack.

Derived classes or other functions can create their own scrollers or panpopup before this function is called. They are created fresh only if they do not exist yet. In either case they are pushed (pushnodup) onto the panner tell stack.

Reimplemented from Laxkit::anXWindow.

Reimplemented in Laxkit::TreeSelector, and Laxkit::MenuSelector.

References Laxkit::anXApp::addwindow(), Laxkit::PanController::SetBoxAspect(), syncWindows(), and Laxkit::PanController::tell().

void Laxkit::ScrolledWindow::syncWindows ( int  useinrect = 0)
virtual

MoveResize the scrollers, panwindow, and thewindow.

Calls findoutrect(), then syncs the windows, then sets inrect, and finally calls adjustinrect().

Todo:
parameter useinrect is not used, in fact, i can't remember what I put it there for... maybe it'll come back to me..
Todo:
*** window shifting rather than relay messages is not implemented yet

Reimplemented in Laxkit::MenuSelector, and Laxkit::TreeSelector.

References adjustinrect(), findoutrect(), inrect, Laxkit::Scroller::MoveResize(), Laxkit::anXWindow::MoveResize(), Laxkit::PanController::SetBoxAspect(), and Laxkit::anXWindow::win_on.

Referenced by init(), MoveResize(), Resize(), and UseThisWindow().

int Laxkit::ScrolledWindow::UseThisWindow ( anXWindow nwindow)
virtual

Use nwindow as the nested window.

Any old window must be disposed of, and nwindow installed, which means reparenting to this, and setting where messages should go.

Returns 0 on success. If nwindow is NULL, nothing is done and 1 is returned.

The old window is app->destroywindow'd.

References Laxkit::anXApp::destroywindow(), Laxkit::anXApp::reparent(), syncWindows(), Laxkit::PanController::tell(), and Laxkit::PanController::tellPop().


Member Data Documentation

IntRectangle Laxkit::ScrolledWindow::inrect
IntRectangle Laxkit::ScrolledWindow::outrect

The rectangle that holds all of thewindow and scrollers.

Default is the whole window. Derived classes can redefine findoutrect() to modify outrect to not include any space that they want to use.

Referenced by findoutrect(), Laxkit::TreeSelector::findoutrect(), Laxkit::MenuSelector::findoutrect(), and Laxkit::MenuSelector::WrapToPosition().


The documentation for this class was generated from the following files:

Mon Feb 17 2014 11:53:00, Laxkit