Laxkit
0.0.7.1
|
A frame for a stack of windows that can be sized in one dimension. More...
Public Member Functions | |
StackFrame (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, int ngap) | |
virtual const char * | whattype () |
virtual int | init () |
virtual void | Refresh () |
virtual int | LBDown (int x, int y, unsigned int state, int count, const LaxMouse *d) |
virtual int | LBUp (int x, int y, unsigned int state, const LaxMouse *d) |
virtual int | MBDown (int x, int y, unsigned int state, int count, const LaxMouse *d) |
virtual int | MBUp (int x, int y, unsigned int state, const LaxMouse *d) |
virtual int | RBDown (int x, int y, unsigned int state, int count, const LaxMouse *d) |
virtual int | RBUp (int x, int y, unsigned int state, const LaxMouse *d) |
virtual int | MouseMove (int x, int y, unsigned int state, const LaxMouse *d) |
virtual int | MoveResize (int nx, int ny, int nw, int nh) |
virtual int | Resize (int nw, int nh) |
virtual int | WrapToExtent () |
From the preferred dimensions of the panes and gap, make this sized just enough to contain them. | |
virtual anXWindow * | childWindow (int index) |
Return pointer to the childe window at index. | |
virtual int | findWhichBar (int x, int y) |
Return the index in pos of the bar under (x,y) or -1. | |
virtual int | MoveBar (int index, int pixelamount, int shift) |
virtual int | Sync (int add) |
With values in the pos array, resize the panes appropriately. | |
virtual int | UpdatePos (int useactual=0) |
Create or update this->pos from the dimensions in the panes. | |
virtual int | Gap () |
virtual int | Gap (int ngap) |
Use the given value for the pixel gap between windows. | |
virtual int | ReplaceWin (anXWindow *win, int absorbcount, int index) |
Replace the window on the stack at index with the given window. | |
virtual int | AddWin (WinFrameBox *box, char islocal=1, int where=-1) |
Add an already made WinFrameBox. | |
virtual int | AddWin (anXWindow *win, int absorbcount, int where=-1) |
Add a window using the window's width and height with no squishability. | |
virtual int | AddWin (anXWindow *win, int absorbcount, int npw, int nws, int nwg, int nhalign, int nhgap, int nph, int nhs, int nhg, int nvalign, int nvgap, int where=-1) |
Add a window with squish values. | |
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 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 | 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 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 | 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 | 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 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 Member Functions inherited from Laxkit::ListBox | |
ListBox (unsigned int flag=0) | |
Create box as either BOX_VERTICAL or BOX_HORIZONTAL. Other flag values are ignored. | |
ListBox (unsigned int nflags, int nx, int nw, int npw, int nws, int nwg, int nhalign, int nhgap, int ny, int nh, int nph, int nhs, int nhg, int nvalign, int nvgap) | |
virtual void | Push (SquishyBox *box, char islocal=0, int where=-1) |
Push box onto list with islocal. Create list if it doesn't exist. | |
virtual int | Pop (int which=-1) |
Remove item with index which from list. | |
virtual void | Flush () |
Flush list. | |
virtual void | sync () |
Sync the box to the already set values of x,y,w,h. | |
virtual int | arrangeBoxes (int distributetoo=0) |
Arrange the list stack as appropriate. | |
virtual int | distributeBoxes (int setmetrics=0) |
Sets x,y,w,h of the child boxes in list, and tells them to sync(). | |
virtual int | figureDimensions (ListBox *target, int *nextrow=NULL, SquishyBox **boxes=NULL, int n=0, double *squishx=NULL, double *squishy=NULL) |
Finds pw,s,g/ph,s,g based on the boxes in list. | |
Public Member Functions inherited from Laxkit::SquishyBox | |
SquishyBox (unsigned int nflags, int nx, int nw, int npw, int nws, int nwg, int nhalign, int nhgap, int ny, int nh, int nph, int nhs, int nhg, int nvalign, int nvgap) | |
SquishyBox Constructor. | |
virtual int | hideBox (int yeshide) |
hideBox(0) makes the box visible, otherwise, make it hidden. Returns state after call. | |
virtual int | hidden () |
Return whether the box is hidden or not. | |
virtual void | sync (int xx, int yy, int ww, int hh) |
Sync the box to x,y,w,h. | |
virtual int | x () |
virtual int | w () |
virtual int | pw () |
virtual int | ws () |
virtual int | wg () |
virtual int | halign () |
virtual int | hgap () |
virtual int | y () |
virtual int | h () |
virtual int | ph () |
virtual int | hs () |
virtual int | hg () |
virtual int | valign () |
virtual int | vgap () |
virtual int | x (int val) |
virtual int | w (int val) |
virtual int | pw (int val) |
virtual int | ws (int val) |
virtual int | wg (int val) |
virtual int | halign (int val) |
virtual int | hgap (int val) |
virtual int | y (int val) |
virtual int | h (int val) |
virtual int | ph (int val) |
virtual int | hs (int val) |
virtual int | hg (int val) |
virtual int | valign (int val) |
virtual int | vgap (int val) |
virtual int | fpenalty () |
virtual int | fpenalty (int val) |
virtual int | lpenalty () |
virtual int | lpenalty (int val) |
Protected Attributes | |
int | lastx |
int | lasty |
int | whichbar |
int | gap |
ButtonDownInfo | buttondown |
Protected Attributes inherited from Laxkit::anXWindow | |
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 |
Private Attributes | |
double * | pos |
Positions from 0 to 1.0 of draggable bars. |
Additional Inherited Members | |
Public Attributes inherited from Laxkit::anXWindow | |
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 |
Public Attributes inherited from Laxkit::ListBox | |
PtrStack< SquishyBox > | list |
Public Attributes inherited from Laxkit::SquishyBox | |
int | m [14] |
int | pad |
Pad placed around a box, which can be where a bevel or window border would go. | |
int | padinset |
Pad to inset the child boxes. | |
int | fpen |
The penalty in the flow direction. | |
int | lpen |
The penalty perpendicular to the flow direction. | |
unsigned long | flags |
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. |
A frame for a stack of windows that can be sized in one dimension.
This is analogous to GtkPaned frames in Gtk. StackFrame is a little more robust by allowing any number of windows, not just two, and is best thought of as a sort of 1-d SplitWindow.
There is a bar between each pane that can be dragged around. If you drag a bar right next to the edge of an adjacent window, that window becomes hidden, and you will see 2 bars next to each other. To make it visible again, just drag out the bar again.
The total width of the window will be:
(sum of widths of panes) + gap*(number of panes-1)
Window styles. If STACKF_BEVEL, then draw a bevel around each box. Otherwise, the default is to draw some dots in the middle of each box, and have no special border around the boxes.
If NOT_SIZEABLE, then you cannot shift the bars around.
#define STACKF_VERTICAL (1<<16) #define STACKF_NOT_SIZEABLE (1<<17) #define STACKF_ALLOW_SWAP (1<<18) #define STACKF_BEVEL (1<<19)
|
virtual |
Add an already made WinFrameBox.
This is really just a convenience function for any derived classes. It is not really necessary to create a whole box just in order to add a window.
The end result is for win to be pushed onto the top of the stack.
References Laxkit::ListBox::Push(), and Laxkit::anXApp::reparent().
Referenced by AddWin(), and ReplaceWin().
Add a window using the window's width and height with no squishability.
Reparents if win->win_parent!=this. If the window is derived from SquishyBox, then pass it on to SquishyBox::Push(). Else make a WinFrameBox and pass to AddWin(WinFrameBox *,char,int).
The end result is for win to be pushed onto position where of the stack. where==-1 means to top.
Returns 0 on success, else nonzero
References AddWin(), Laxkit::ListBox::Push(), and Laxkit::anXApp::reparent().
|
virtual |
Add a window with squish values.
Return 0 on success, else non zero error code.
The end result is for win to be pushed onto the top of the stack. Calls AddWin(WinFrameBox *,char,int) for the actual pushing.
If win==NULL, then the given dimensions is for a spacer block.
References AddWin(), Laxkit::anObject::dec_count(), Laxkit::SquishyBox::pad, and Laxkit::anXApp::reparent().
Use the given value for the pixel gap between windows.
This does not Sync() the windows.
|
virtual |
Default just calls anXWindow::init().
Reimplemented from Laxkit::anXWindow.
References Sync().
When shifting a bar, you can move just the bar (shift==0), or move all the bars on the right the same amount (shift==1), or move all the bars on the left the same amount (shift==2).
Return 0 for bar moved, else nonzero.
References Laxkit::PtrStack< T >::n, pos, and Sync().
Sync() panes in addition to default resize.
Reimplemented from Laxkit::anXWindow.
References Sync().
Replace the window on the stack at index with the given window.
Return 0 for window replaced, or nonzero for error.
References AddWin(), Laxkit::anObject::dec_count(), Laxkit::anXApp::destroywindow(), Laxkit::PtrStack< T >::e, Laxkit::PtrStack< T >::n, Laxkit::PtrStack< T >::remove(), and Laxkit::anXApp::reparent().
Sync() panes in addition to default resize.
Reimplemented from Laxkit::anXWindow.
References Sync().
With values in the pos array, resize the panes appropriately.
If add!=0, then addwindow() the child windows, if necessary.
References Laxkit::anXApp::addwindow(), Laxkit::PtrStack< T >::e, Laxkit::PtrStack< T >::n, pos, and Laxkit::SquishyBox::sync().
Referenced by init(), MoveBar(), MoveResize(), and Resize().
Create or update this->pos from the dimensions in the panes.
If useactual!=0, then use the w() and h() of the panes. Otherwise, use the pw() and ph().
This will destroy any info in pos already, and remap pos based on pane actual width and height. This function should only be called after installing new windows.
Return 0 success, 1 for not enough useful information to construct pos, such as having only 0 or 1 panes.
References Laxkit::PtrStack< T >::e, Laxkit::PtrStack< T >::n, and pos.
|
private |
Positions from 0 to 1.0 of draggable bars.
There will be the same number of elements in pos as there are child boxes. pos[numboxes-1]==1.0.
Referenced by MoveBar(), Sync(), and UpdatePos().