Laxkit
0.0.7.1
|
This is the basic window unit for the Laxkit. More...
Public Member Functions | |
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 char * | whattype () |
virtual const char * | WindowTitle (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 char * | tooltip (int mouseid=0) |
By default, return win_tooltip. | |
virtual const char * | tooltip (const char *newtooltip) |
Replace the current tooltip, return the current tooltip (after replacing). | |
virtual anXWindow * | findChildWindowByTitle (const char *title) |
Find the first immediate child window that has win_title==title. | |
virtual anXWindow * | findChildWindowByName (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 | init () |
Empty placeholeder. Just returns 0. | |
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 Displayer * | MakeCurrent () |
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 ShortcutHandler * | GetShortcuts () |
Return a ShortcutHandler that contains stacks of bound shortcuts and possible window actions. | |
virtual int | PerformAction (int action_number) |
virtual int | Event (const EventData *data, const char *mes) |
Default event handler. | |
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 int | MoveResize (int nx, int ny, int nw, int nh) |
Move and resize the window. | |
virtual int | Resize (int nw, int nh) |
Resize with new nw, and nh. | |
virtual void | contentChanged () |
Windows may call this when their contents change. | |
virtual void | selectionChanged () |
Windows may call this when their selections change. | |
virtual anXWindow * | GetController () |
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::Attribute * | dump_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 char * | GetTag (int i) |
Return const pointer to the tag text for tag number i, where i==0 is the first tag. | |
virtual char * | GetAllTags () |
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 | |
WindowColors * | win_colors |
anXApp * | app |
char * | win_name |
An arbitrary string to be used as an id. | |
char * | win_title |
The title of the window. | |
anXWindow * | win_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 |
char * | win_sendthis |
The type of message that gets sent to owner. | |
anXWindow * | nextcontrol |
anXWindow * | prevcontrol |
Public Attributes inherited from Laxkit::Tagged | |
int | sorttags |
Protected Member Functions | |
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. |
Protected Attributes | |
char * | win_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< char > | list_of_tags |
Friends | |
class | anXApp |
This is the basic window unit for the Laxkit.
anXWindow is the barest form of a window class available in the Laxkit. Most people will not use this class directly, using all the various subclasses instead. If you design your own windows basically from scratch, you would subclass anXWindow.
anXWindow::event() routes the X events to the corresponding member functions. Any X events not dealt with there are ignored, but classes derived from anXWindow can redefine event to catch those. Just be sure to also call anXWindow::event() to ensure proper focusing and such. Dealt with is resizing the window when the user resizes via the mouse dragging window manager decorations, and also implements the delete protocol when the 'x' (provided by your window manager, unrelated to Laxkit) is clicked. It tells anXApp to destroy this window only if deletenow() returns 1. If deletenow() returns 2, then the window is just unmapped. If deletenow() returns 3, the window is kept mapped.
Event handling functions must return 0 if they actually deal with an event. If a nonzero value is returned, then typically the event will be propagated to the window's parent.
The base style of a window is stored in win_style. Currently, anXWindow reserves the right to uses bits 0..15. Derived classes can use any other bits in win_style if they want. All the bits taken by anXWindow can be screened for with ANXWIN_MASK (==0xffff).
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.
Just assigns all the passed in variables to their given values, and everything else to 0/NULL.
If brder<0, then set win_border to app->default_inactiveborder.
These attributes are set here: win_xatts.border_pixel=app->color_inactiveborder; win_xattsmask|=CWEventMask|CWBorderPixel; // set to 0 in anXWindow win_xatts.event_mask|=FocusChangeMask|StructureNotifyMask|ResizeRedirectMask| ExposureMask|EnterWindowMask|LeaveWindowMask;
See Xlib Primer for Laxkit for what other events Constructors can set for.
Constructor, appends itself to the (incomplete) tab loop in prev. Later, it is assumed that that loop in prev is not yet a closed loop, ie that some prev->prev->... is NULL.
prev | prevcontrol gets set to this. |
nowner | Who gets control messages from this window |
nsend | The control message to send |
References ConnectControl(), and newstr().
|
virtual |
anXWindow destructor. Its X window should have been XDestroy'd before here.
App->destroywindow() must be called for this window for the X window to be properly destroyed. The anXApp::destroyqueued() provokes the actual deleting by calling win->deletekid(whateverwindow).
If nextcontrol or prevcontrol exist, then take this out of that control loop by connecting those two.
|
virtual |
Input of character data or control character presses.
If key>0 and key<=0x10ffff, then key is the USC code of a character. In this case, buffer will contain the utf8 representation of key. If key>0x1000000, then key can be compared to various Laxkit defined keys, such as LAX_Pgdown, LAX_Del, etc. In this case, currently, key&0xffffff is the Xlib keysym of the key. Also in this case, buffer will be NULL.
If key==0 but buffer!=NULL, then buffer contains multiple utf8 characters, all of which should be considered input. This will have resulted from input that was somehow composed from key sequences at a higher level.
len is the length in bytes of buffer, if any.
state will be a combination of ShiftMask, ControlMask, AltMask, MetaMask, KeypadMask, CapsLockMask, and NumLockMask. Numpad keys will have the KeypadMask bit set in state. You can check what combination of shift, control, alt, and meta masks are presest by examining state&LAX_STATE_MASK.
See laxdefs.h for various definitions for keys and LAX_STATE_MASK.
Currently, no distinction is made between left and right control, alt, or meta keys. If you really, really need the distinction, you can intercept the key events in anXWindow::event(), or complain to the developers.
Default behavior for this function is for tab press to make the input focus go to the nextcontrol (if it is not NULL), shift-tab transfers focus to prevcontrol (if not NULL). See SelectNextControl() and SelectPrevControl().
Reimplemented in Laxkit::TreeSelector, Laxkit::MenuSelector, LaxInterfaces::ViewportWindow, Laxkit::SplitWindow, Laxkit::FileDialog, Laxkit::PrintDialog, Laxkit::Scroller, Laxkit::ButtonBase, Laxkit::ColorBox, Laxkit::LineEdit, Laxkit::DateSelector, Laxkit::ImageDialog, LaxInterfaces::ViewerWindow, Laxkit::SliderPopup, Laxkit::PromptEdit, Laxkit::SimplePrint, Laxkit::PopupMenu, and Laxkit::InputDialog.
Referenced by Laxkit::ColorBox::CharInput().
|
virtual |
Called by anXApp from anXApp::destroywindow() when a window is to be destroyed.
This function is called before the Xlib window is destroyed, so windows can do any specific cleanup that still depends on that window value here.
If win_parent==NULL and win_style&ANXWIN_REMEMBER, then call app->Resource() with a new Attribute found via dump_out_atts().
The Laxkit does not do anything with the default return value, but 0 should mean success.
Referenced by Laxkit::anXApp::destroywindow().
|
virtual |
Close a tab loop.
Usually this will be called from the init() function of some frame class to signal an end to a tab loop.
This just connects the most previous control that is NULL to the most next control that is NULL. Assumes that for each control in the current loop, thatcontrol->nextcontrol->prevcontrol==thatcontrol if thatcontrol is not NULL, some thing for prevcontrol. If controls were added strictly through the anXWindow control loop functions, this will be true.
Reimplemented in Laxkit::LineInput.
Referenced by Laxkit::LineInput::CloseControlLoop(), Laxkit::ImageDialog::init(), Laxkit::FileDialog::init(), and Laxkit::SimplePrint::SimplePrint().
Connect towhat to this. Used for tab loops.
If towhat is passed in as NULL, then detach this from its loop, connecting next and prev.
Actually this function connects towhat->GetController() and this->GetController(). This is so the focus goes to, for instance, the editing part of a LineInput, rather than the LineInput itself, which is just a container.
If towhat is part of an open loop, then the bounds of that loop are squeezed in between this and either nextcontrol or prevcontrol, depending on whether after==1 or not. If towhat is part of a closed loop, then that loop is cut between towhat and towhat->prevcontrol.
Return 0 for successful attachment or detachment. 1 for when there was nothing to attach, that is, GetController() for this or towhat returned NULL.
References GetController(), and WindowTitle().
Referenced by anXWindow(), and Laxkit::FileDialog::init().
|
virtual |
Windows may call this when their contents change.
This would be when a text edit has more text entered, for instance.
If (win_owner_send_mask & LAX_onContentChange), then the default here would trigger sending a SimpleEvent of type onContentChange to win_owner.
|
virtual |
Do special activation or not when controls are activated by tabbing.
This would be done in FocusOn()/FocusOff(), but XI2 seems to send a ton of useless Enter/Leave events upon a button down.
Purges child anXWindows from window's child stack.
You should not call this function directly. This normally is called from anXApp::destroyqueued. anXApp is responsible for maintaining anXWindow's _kids stack.
Removes only if w is a direct kid, not grand kid or more.
Referenced by Laxkit::anXApp::destroyqueued().
|
inlinevirtual |
Return whether the window is allowed to be deleted.
Return 1 means ok to unmap AND delete, Return 2 means unmap only. Return 3 to neither unmap nor delete.
This function is called during processing of the delete protocol
|
virtual |
Default is to read in win_x, win_y, win_w, win_h, win_tooltip, win_flags.
Implements LaxFiles::DumpUtility.
Reimplemented in Laxkit::CurveWindow, Laxkit::RulerWindow, Laxkit::Scroller, Laxkit::MessageBar, Laxkit::DateSelector, and Laxkit::Button.
References deletestrs(), Laxkit::PtrStack< T >::e, LaxFiles::IntAttribute(), isblank(), Laxkit::PtrStack< T >::n, and splitspace().
Simple dumping function.
Default is to dump out an Attribute retrieved from dump_out_atts(), so subclasses need only redefine dump_out_atts() and dump_in_atts() for all the DumpUtility functions to work.
Implements LaxFiles::DumpUtility.
References LaxFiles::Attribute::dump_out().
|
virtual |
Append to att if att!=NULL, else return a new Attribute whose name is whattype().
Default is to add attributes for win_x, win_y, win_w, and win_h.
Reimplemented from LaxFiles::DumpUtility.
Reimplemented in Laxkit::CurveWindow, Laxkit::RulerWindow, Laxkit::Scroller, Laxkit::MessageBar, Laxkit::DateSelector, and Laxkit::Button.
References LaxFiles::Attribute::push().
Default event handler.
Events dispatched here automatically are mouse, device, and keyboard events other than LAX_onFocusOn and LAX_onFocusOff events. The events are relayed to the proper LBDown(), RBDown(), etc.
None of the events that reach this function are strictly necessary for the functioning of a window at a low level. If you need to override LAX_onFocusOn and LAX_onFocusOff events, you must redefine FocusOn() and FocusOff().
Returns 0 for event accepted, or 1 for ignored.
Reimplemented from Laxkit::EventReceiver.
Reimplemented in Laxkit::MenuSelector, LaxInterfaces::ViewportWindow, Laxkit::ColorSliders, Laxkit::SplitWindow, Laxkit::FileDialog, Laxkit::BoxSelector, Laxkit::PaletteWindow, Laxkit::PrintDialog, Laxkit::RulerWindow, Laxkit::ButtonBase, Laxkit::PanWindow, Laxkit::ScrolledWindow, LaxInterfaces::ViewerWindow, Laxkit::ImageDialog, Laxkit::LineInput, Laxkit::MultiLineEdit, Laxkit::SimplePrint, Laxkit::MessageBox, Laxkit::InputDialog, LaxInterfaces::ViewportWithStack, Laxkit::NumInputSlider, Laxkit::ToolTip, and Laxkit::Overwrite.
Referenced by Laxkit::anXApp::processSingleDataEvent().
|
inlinevirtual |
Default behavior on Expose events is to call Needtodraw(1).
For smart refreshing, windows would redefine this to record which areas of the window need to be updated. Imlib2, by the way, provides for this via imlib_updates.
References Needtodraw().
Find the first immediate child window that has win_name==name.
If name==NULL, NULL is returned, not the first window that has a NULL name.
If win_name==NULL, then win_title is compared against instead.
Note that this does not check kids of child windows.
Referenced by Laxkit::FileDialog::BuildBookmarks(), Laxkit::InputDialog::CharInput(), LaxInterfaces::ViewportWithStack::Event(), Laxkit::InputDialog::Event(), LaxInterfaces::ViewerWindow::Event(), Laxkit::ShortcutWindow::SetSearch(), and Laxkit::ShortcutWindow::UpdateSearch().
Find the first immediate child window that has win_title==title.
If title==NULL, NULL is returned, not the first window that has a NULL title.
Note that this does not check kids of child windows.
This will only check against win_title. See also findChildWindowByName().
|
virtual |
Increment win_active, and highlights the window's border, if the event refers to this window.
The default here is to activate for any focus on from any keyboard.
If it is an actual focus on, then app->xim_ic is updated for this window. Also the border color is changed to app->color_activeborder.
Reimplemented in Laxkit::TreeSelector, Laxkit::MenuSelector, Laxkit::LineEdit, Laxkit::LineInput, and Laxkit::TextXEditBaseUtf8.
Referenced by Laxkit::anXApp::processSingleDataEvent().
|
virtual |
Return the window most relevant for tab control loops.
For instance, a LineInput has a label, and a LineEdit embedded in it. For the purposes of adding to a tab loop, the LineEdit should be connected, and not the LineInput. So the LineInput::GetController() returns its LineEdit rather than itself, which is the default.
Referenced by ConnectControl().
|
virtual |
Return a ShortcutHandler that contains stacks of bound shortcuts and possible window actions.
NULL means there are none defined for this window.
Windows that do use shortcuts, and want them stored in an easy manner should use the ShortcutManager system, accessed with GetDefaultShortcutManager(). They can then install a single list of shortcuts and actions bound to the window type name, and any future window instances can borrow those.
Currently, simply return win_style&stylebit.
|
virtual |
Return whether this window is grayed.
If this window does not have gray set, but an ancestor window does, then it is considered gray. The return value is the level back one must go before the next grayed window. 1==this window, 2==win_parent is grayed, and so on.
0 means not grayed.
Reimplemented in Laxkit::ButtonBase.
anXWindow::Idle() is an empty placeholeder. Just returns 1.
This function will be called if there is a timer that ticks off. The timer's id is passed as tid.
If Idle returns 1, then the timer is removed. If Idles returns 0, the timer is left active. This makes it very easy to turn off any residual mouse timers with a check to see if any buttons are still down, and if so, return 1.
Reimplemented in Laxkit::TreeSelector, Laxkit::MenuSelector, Laxkit::LineEdit, Laxkit::MultiLineEdit, Laxkit::Scroller, Laxkit::ItemSlider, Laxkit::PopupMenu, and Laxkit::ToolTip.
|
inlinevirtual |
Empty placeholeder. Just returns 0.
When anXApp::addwindow() is called with this window, init() is called after the window is allocated (in Xlib, this is with XCreatWindow()), but before the window is mapped (made visible). Normally, windows will create and install child windows via app->addwindow() from init(), since the anXWindow will now have a valid allocation.
The following is relevant for Laxkit using Xlib.
Also, if a window wants to set anything in win_hints or win_sizehints, they should do so here or before init() somewhere. anXApp::addwindow() sets all other relevant hints after this init returns, and before the window is mapped. Setting the win_sizehints with USPosition and USSize causes the window to be popped up in a definite place, rather than thrown about willy nilly by the window manager.
As a convenience, if init() returns 1 then it is assumed that win_w and/or win_h are not the same as before init() was called. anXApp::addwindow() then sets up win_sizehints accordingly, before the window is mapped. If the window has ANXWIN_CENTER set, then the x and y in win_sizehints are also set accordingly, and win_x and win_y are set to the recomputed x and y.
Reimplemented in Laxkit::TreeSelector, Laxkit::MenuSelector, LaxInterfaces::ViewportWindow, Laxkit::SplitWindow, Laxkit::FileDialog, Laxkit::BoxSelector, Laxkit::RulerWindow, Laxkit::RowFrame, Laxkit::ScrolledWindow, Laxkit::TabFrame, Laxkit::ImageDialog, LaxInterfaces::ViewerWindow, Laxkit::LineInput, Laxkit::TextXEditBaseUtf8, Laxkit::MultiLineEdit, Laxkit::ItemSlider, Laxkit::StackFrame, and Laxkit::SimplePrint.
Referenced by Laxkit::anXApp::addwindow().
|
inlinevirtual |
Called when a key is released.
See anXWindow::CharInput() for what the ch actually corresponds to. This function is different than CharInput() in that there is no composed character passed in. One would use this function to check whether a shift (LAX_Shift) or control (LAX_Control) key is released, for instance.
|
inlinevirtual |
Default is just to return 1.
Count is usually 1, but double click is 2, triple click==3, etc.
Reimplemented in Laxkit::TreeSelector, Laxkit::MenuSelector, LaxInterfaces::ViewportWindow, Laxkit::SplitWindow, Laxkit::BoxSelector, Laxkit::PaletteWindow, Laxkit::Scroller, Laxkit::ButtonBase, Laxkit::LineEdit, Laxkit::ColorBox, Laxkit::SliderPopup, Laxkit::MultiLineEdit, Laxkit::ItemSlider, Laxkit::MenuButton, Laxkit::PanPopup, and Laxkit::NumInputSlider.
|
virtual |
Default is to return the default Displayer via GetDefaultDisplayer(). Also calls dp->MakeCurrent(this). Subclasses that use other custom displayers should redefine if necessary.
References Laxkit::dp, Laxkit::GetDefaultDisplayer(), and Laxkit::Displayer::MakeCurrent().
Referenced by Laxkit::RulerWindow::Refresh().
|
inlinevirtual |
Default is just to return 1.
Count is usually 1, but double click is 2, triple click==3, etc.
Reimplemented in LaxInterfaces::ViewportWindow, and Laxkit::ColorBox.
Move and resize the window.
This will call XMoveResizeWindow(app->dpy,window,nx,ny,nw,nh), and update win_x, win_y, win_w, and win_h. Please ensure that the supplied values are reasonable.
Reimplemented in Laxkit::TreeSelector, Laxkit::MenuSelector, LaxInterfaces::ViewportWindow, Laxkit::SplitWindow, Laxkit::ColorSliders, Laxkit::PaletteWindow, Laxkit::BoxSelector, Laxkit::PanWindow, Laxkit::RowFrame, Laxkit::MultiLineEdit, Laxkit::ScrolledWindow, Laxkit::Scroller, Laxkit::LineInput, Laxkit::TextXEditBaseUtf8, Laxkit::StackFrame, and Laxkit::FuncFrame.
Referenced by Laxkit::SplitWindow::Change(), Laxkit::TabFrame::mapWindow(), Laxkit::SplitWindow::Maximize(), Laxkit::SplitWindow::scaleWindows(), Laxkit::WinFrameBox::sync(), and Laxkit::ScrolledWindow::syncWindows().
|
inlinevirtual |
Default is to return needtodraw.
This function is consulted during the event loop, during the refresh and idle stage. If it returns nonzero, then Refresh() is called.
Reimplemented in LaxInterfaces::ViewportWindow.
Referenced by Laxkit::FileDialog::Event(), ExposeChange(), Laxkit::FileDialog::getDirectory(), Refresh(), and Laxkit::anXApp::refresh().
If 0, then the window does not need refreshing. Otherwise it does.
My hat's off to Fltk for using overloaded functions to either set or retrieve values! What a great idea!
This method exists to aid standardizing access to shortcut actions from potential scripting. Return 1 for not found or otherwise not done, or 0 for success. Default is return 1.
|
virtual |
When anXApp::addwindow() is called with this window, preinit() is called before the window is allocated (in xlib, this is with XCreatWindow()). Derived classes would redefine this to do some last minute tinkering before the window is allocated. Windows get another chance to do tinkering when init() is called after allocating, but before being made visible (aka mapped).
In win_style&ANXWIN_REMEMBER and win_w and/or win_h==0, then look up the anXApp::Resource() corresponding to this->whattype(), and set the win_x,y,w,h to the corresponding values.
The return value is currently ignored in the default anXApp, but 0 should mean success.
Just for reference, the following code can be used to make a window get mapped initially to a particular place on the screen. This is basically what is done with windows that have ANXWIN_CENTER set in win_style.
Reimplemented in Laxkit::FileDialog, Laxkit::PrintDialog, Laxkit::ImageDialog, and Laxkit::MessageBox.
Referenced by Laxkit::anXApp::addwindow().
|
inlinevirtual |
Default is just to return 1.
Count is usually 1, but double click is 2, triple click==3, etc.
Reimplemented in Laxkit::TreeSelector, Laxkit::MenuSelector, LaxInterfaces::ViewportWindow, Laxkit::SplitWindow, Laxkit::ColorBox, Laxkit::Scroller, Laxkit::SliderPopup, Laxkit::MultiLineEdit, and Laxkit::PopupMenu.
|
inlinevirtual |
anXWindow::Refresh() is an empty placeholeder. Just calls Needtodraw(0) and returns 0.
Any window appearance updating is done here. This is called only when there are no more events in anXApp's event queue.
Reimplemented in Laxkit::TreeSelector, Laxkit::MenuSelector, Laxkit::SplitWindow, LaxInterfaces::ViewportWindow, Laxkit::BoxSelector, Laxkit::RowFrame, Laxkit::RulerWindow, Laxkit::ButtonBase, Laxkit::PanWindow, Laxkit::Scroller, Laxkit::LineInput, Laxkit::TabFrame, Laxkit::SliderPopup, Laxkit::ShortcutTreeSelector, Laxkit::TextXEditBaseUtf8, Laxkit::FilePreviewer, Laxkit::FuncFrame, Laxkit::PanPopup, Laxkit::NumSlider, LaxInterfaces::ViewportWithStack, and Laxkit::ToolTip.
References Needtodraw().
Referenced by Laxkit::anXApp::refresh().
Resize with new nw, and nh.
This function will normally be called automatically, in response to an event, and not when the user wants to resize a window. If you need to resize a window yourself, you should probably use MoveResize().
This will call XResizeWindow(app->dpy,window,nw,nh), and update win_w and win_h.
If this is called from event(), note that the window is under override redirect as per ICCCM.
Reimplemented in Laxkit::TreeSelector, Laxkit::MenuSelector, LaxInterfaces::ViewportWindow, Laxkit::SplitWindow, Laxkit::ColorSliders, Laxkit::PaletteWindow, Laxkit::BoxSelector, Laxkit::PanWindow, Laxkit::RowFrame, Laxkit::ScrolledWindow, Laxkit::Scroller, Laxkit::MultiLineEdit, Laxkit::LineInput, Laxkit::TextXEditBaseUtf8, Laxkit::StackFrame, and Laxkit::FuncFrame.
|
virtual |
Windows may call this when their selections change.
This would be when more or less text gets selected in a text edit, for instance.
If (win_owner_send_mask & onSelectionChange), then this would trigger sending a SimpleEvent of type onSelectionChange to win_owner.
Transfer focus to nextcontrol.
Referenced by Laxkit::LineEdit::CharInput().
|
virtual |
Set the new owner and control message.
Sets win_owner whether or not nowner==NULL. Sets win_sendthis only if mes!=NULL.
If send_mask!=0, then set win_owner_send_mask to it.
References makestr(), and WindowTitle().
Referenced by Laxkit::SimplePrint::init(), Laxkit::LineInput::init(), Laxkit::FileDialog::init(), LaxInterfaces::ViewportWindow::UseTheseRulers(), and LaxInterfaces::ViewportWindow::UseTheseScrollers().
|
protectedvirtual |
Initialize the backbuffer.
This is a convenience function for windows that have ANXWIN_DOUBLEBUFFER set. If that is not set in win_style, then no back buffer is set up.
By default, this will be called by anXApp after it calls anXWindow::init(). As long as ANXWIN_DOUBLEBUFFER is set, then normally windows do not need to call this themselves.
All it does is this:
xlib_backbuffer=XdbeAllocateBackBufferName(app->dpy,window,XdbeBackground);
Referenced by Laxkit::anXApp::addwindow().
Control various window related basic styling of win_style.
The default is to set and unset style bit in win_style, as long as stylebit is not within ANXWIN_MASK. Warning: do not randomly call this function unless you know what you're doing, as most predefined windows have specific ways to manage win_style.
Return 0 for style updated, and 1 for not.
Referenced by Laxkit::Button::dump_in_atts(), Laxkit::DateSelector::dump_in_atts(), Laxkit::Scroller::dump_in_atts(), Laxkit::RulerWindow::dump_in_atts(), and Laxkit::MenuButton::MenuButton().
|
protectedvirtual |
Swap buffers. This should be called from Refresh() if VIEWPORT_BACK_BUFFER is set in win_style.
Default is to call XdbeSwapBuffers(app->dpy,&swapinfo,1)
with swapinfo.swap_window=window
and swapinfo.swap_action=XdbeBackground
.
Reimplemented in Laxkit::ShortcutTreeSelector.
Referenced by LaxInterfaces::ViewportWithStack::Refresh(), Laxkit::RulerWindow::Refresh(), LaxInterfaces::ViewportWindow::Refresh(), and Laxkit::TreeSelector::Refresh().
By default, return win_tooltip.
By default, mouseid is ignored. Derived classes may redefine this function to take into account which mouse is requesting a tooltip.
Reimplemented in Laxkit::ColorBox.
Referenced by Laxkit::ImageDialog::init(), Laxkit::FileDialog::init(), Laxkit::FileDialog::OkButton(), Laxkit::LineInput::tooltip(), and Laxkit::anXApp::tooltipcheck().
Replace the current tooltip, return the current tooltip (after replacing).
If tooltips are active, the anXApp calls tooltip() to find the tip for this window. Thus, the window can redefine this function if there are multiple tooltips for some reason.
Note that calling tooltip(NULL) will remove the tooltip.
Reimplemented in Laxkit::LineInput.
References makestr().
Return basically the name of the window.
If which==0, then return win_title, or win_name if win_title==NULL, or "(untitled)" if win_name==NULL. If which==1, return win_name, or win_title if win_name==NULL, or "(unnamed)" if win_title==NULL. If which==2, return win_name, or NULL if name is NULL. If which==3, return win_title, or NULL if title is NULL.
Referenced by Laxkit::TreeSelector::addselect(), Laxkit::MenuSelector::addselect(), Laxkit::anXApp::addtimer(), Laxkit::anXApp::addwindow(), Laxkit::LineEdit::CharInput(), Laxkit::SplitWindow::CharInput(), Laxkit::anXApp::checkOutClicks(), ConnectControl(), Laxkit::anXApp::destroyqueued(), Laxkit::anXApp::destroywindow(), Laxkit::ProgressBar::Drawbar(), Laxkit::InputDialog::Event(), Laxkit::MessageBox::Event(), Laxkit::ButtonBase::Event(), Laxkit::MenuSelector::FocusOff(), Laxkit::TreeSelector::FocusOff(), Laxkit::MenuSelector::init(), Laxkit::TreeSelector::init(), Laxkit::TabFrame::mapWindow(), Laxkit::MessageBar::MessageBar(), Laxkit::PopupMenu::MouseMove(), Laxkit::Scroller::MoveResize(), Laxkit::printxcrossing(), Laxkit::LineInput::Refresh(), Laxkit::anXApp::refresh(), Laxkit::Scroller::Resize(), Laxkit::Scroller::send(), Laxkit::TreeSelector::send(), Laxkit::MenuSelector::send(), SetOwner(), Laxkit::LineInput::SetPlacement(), Laxkit::PanController::tell(), Laxkit::PanController::tellPop(), and Laxkit::TUIOListener::tuioHandler().
|
protected |
Stack of children of the window.
Consider this to be readonly. Class anXApp maintains it by pushing during addwindow, anXWindow should not access _kids directly. anXWindow is ultimately responsible for destruction of child windows via deletekid() which is called by anXApp. The app is responsible for destruction of anxwindow->xlib_window and topwindows. These things are typically done without extra user intervention, as long as the normal app->addwindow/app->destroywindow system is used.
Referenced by Laxkit::anXApp::addwindow(), Laxkit::anXApp::deactivatekids(), Laxkit::anXApp::find_subwindow_by_id(), Laxkit::anXApp::findDropCandidate(), Laxkit::anXApp::refresh(), Laxkit::anXApp::reparent(), and Laxkit::anXApp::resetkids().
char * Laxkit::anXWindow::win_name |
An arbitrary string to be used as an id.
This can be used by programmers to help keep track of windows rather than win_title, since win_title is most likely to change.
Referenced by Laxkit::CheckBox::CheckBox(), Laxkit::Button::dump_out_atts(), Laxkit::RowFrame::findWindow(), Laxkit::RowFrame::findWindowIndex(), Laxkit::LineInput::LineInput(), and Laxkit::anXApp::reparent().
int Laxkit::anXWindow::win_pointer_shape |
Identifier for a stock mouse shape.
Currently, if this value is less than 200, then try to use an X cursor based on that number, with 0 being the default shape.
See laxmouseshapes.h for other values.
Referenced by Laxkit::anXApp::addwindow(), Laxkit::LineEdit::LineEdit(), and Laxkit::MultiLineEdit::MultiLineEdit().
char * Laxkit::anXWindow::win_title |
The title of the window.
If the window is a top level window, then this is the text that is displayed by the window manager.
Referenced by Laxkit::PrintDialog::addOptions(), Laxkit::anXApp::addwindow(), Laxkit::RowFrame::findWindow(), Laxkit::RowFrame::findWindowIndex(), and Laxkit::SplitWindow::Refresh().
|
protected |
Convenience variable to hold the window's tooltip, if any.
The app retrieves win_tooltip with a call to tooltip(). It does not access win_tooltip directly
Referenced by Laxkit::ColorBox::tooltip().