Laxkit
0.0.7.1
|
Brief class to provide useful stuff for elements that use a PanController. More...
Public Member Functions | |
PanUser (PanController *npan=NULL) | |
Create with a new panner. | |
virtual | ~PanUser () |
Removes this from panner tellstack. Delete panner if necessary. | |
virtual PanController * | createNewPanner (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 Attributes | |
PanController * | panner |
Brief class to provide useful stuff for elements that use a PanController.
Classes derived from this one inherit these panner goodies. See for instance, Scroller, ScrolledWindow, PanPopup, PanWindow. For derived classes, make sure to inherit from the PanUser BEFORE a window class, otherwise the destructor will not function properly.
Laxkit::PanUser::PanUser | ( | PanController * | npan = NULL | ) |
Create with a new panner.
A PanUser will never leave the constructor without a valid panner. panner will not be NULL. Calls UseThisPanner(npan).
References UseThisPanner().
|
virtual |
Removes this from panner tellstack. Delete panner if necessary.
This transparently handles PanUsers being deleted BEFORE the panner.
IMPORTANT: For this destructing mechanism to work, in your class definition of the PanUser-derived class, you MUST declare the PanUser BEFORE the window part, otherwise the PanUser will not pop itself from the panner->tellstack here, since the window portion will have been destroyed, and it cannot cast itself to an anXWindow anymore.
References Laxkit::anObject::dec_count(), and Laxkit::PanController::tellPop().
|
virtual |
Replace the current panner with npanner, which can be NULL to mean make a new one.
This will always cause panner to point to a PanController. panner will not be NULL afterwards.
The old is dec_counted, the new inc_counted.
If this can be cast to anXWindow, then call this->Needtodraw(1), and add this to panner->tellstack.
Reimplemented in Laxkit::Displayer, and Laxkit::PanWindow.
References createNewPanner(), Laxkit::anObject::dec_count(), Laxkit::anObject::inc_count(), and Laxkit::PanController::tell().
Referenced by PanUser(), and LaxInterfaces::ViewportWindow::UseTheseScrollers().