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

General list and menu controller. Base class for PopupMenu. More...

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

List of all members.

Public Member Functions

 MenuSelector (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 *mes=0, unsigned long long nmstyle=0, MenuInfo *minfo=NULL, char nmenuislocal=0)
 Constructor.
virtual ~MenuSelector ()
 Destructor, just does if (menu && menuislocal) delete menu.
virtual int init ()
 Set some values that are derived from other values (pagesize, hightlight, shadow, ...).
virtual void Refresh ()
 Draw the window.
virtual int Event (const EventData *e, const char *mes)
 Intercept LAX_onMapped in case MENUSEL_GRAB_ON_MAP is set.
virtual int CharInput (unsigned int ch, const char *buffer, int len, unsigned int state, const LaxKeyboard *d)
 Character input.
virtual int LBDown (int x, int y, unsigned int state, int count, const LaxMouse *d)
 Left button down.
virtual int LBUp (int x, int y, unsigned int state, const LaxMouse *d)
 Left button up.
virtual int RBDown (int x, int y, unsigned int state, int count, const LaxMouse *d)
 Right button and drag drags the screen around (with potential autoscrolling)
virtual int RBUp (int x, int y, unsigned int state, const LaxMouse *d)
 Nothing but remove tag from buttondown.
virtual int WheelUp (int x, int y, unsigned int state, int count, const LaxMouse *d)
 Scroll screen down.
virtual int WheelDown (int x, int y, unsigned int state, int count, const LaxMouse *d)
 Scroll screen up.
virtual int MouseMove (int x, int y, unsigned int state, const LaxMouse *d)
 Left might select depending on style. Right button drags. +R fast drags.
virtual int Idle (int tid)
 Autoscroll if necessary****TODO.
virtual int MoveResize (int nx, int ny, int nw, int nh)
 Calls ScrolledWindow::MoveResize(nx,ny,nw,nh).
virtual int Resize (int nw, int nh)
 Calls ScrolledWindow::Resize(nw,nh).
virtual int FocusOn (const FocusChangeData *e)
 Focus on draws the char over item.
virtual int FocusOff (const FocusChangeData *e)
 Focus off draws the char over item.
virtual int WrapToMouse (int mouseid, anXWindow *onedgeofthis=NULL)
 Resize the window to the extent of the items, and reposition near the mouse.
virtual int WrapToPosition (int screen_x, int screen_y, int screen, anXWindow *onedgeofthis=NULL)
 Orient the window's size and position to be near the given screen coordinates.
virtual int movescreen (int dx, int dy)
 Try to move the screen by dx pixels and dy pixels.
virtual int SetFirst (int which, int x, int y)
 Make item which be near screen coordinate x,y.
virtual int Curitem ()
 Return curitem, which is the last item whose state was toggled.
virtual const MenuItemItem (int c)
virtual int Select (int which)
 Programs call this to select index which.
virtual int NumSelected ()
 Return how many items are currently selected.
virtual intWhichSelected (unsigned int state)
 Return a new'd int array of which items are in the given state, if there are any, else NULL.
virtual void SetLineHeight (int ntotalheight, int newleading, char forcearrange=1)
 Set the new line height and leading.
virtual void Sync ()
 This is meant to be called when the window is going, but you just added or removed a bunch of stuff.
virtual void Sort (int t)
 Sort the items alphabetically by the name.
virtual int AddItems (const char **i, int n, int startid)
 Add a bunch of items all at once.
virtual int AddItem (const char *i, int nid, int nst)
 Add item with text i to the top index of menuitems.
- Public Member Functions inherited from 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)
virtual int send ()
 Send what? huh?***.
virtual int UseThisWindow (anXWindow *nwindow)
 Use nwindow as the nested window.
- 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 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 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 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 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

unsigned long highlight
 Highlight color of beveled graphics.
unsigned long shadow
 Shadow color of beveled graphics.
unsigned long long menustyle
int padg
 The pad to place between text and other graphic elements.
int pad
int leading
 The height of lines are leading+(text height).
- Public Attributes inherited from Laxkit::ScrolledWindow
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 adjustinrect ()
 Remove the pads from inrect.
virtual void findoutrect ()
 Set outrect to be the window minus space for title.
virtual double getitemextent (MenuItem *mitem, double *w, double *h, double *gx, double *tx)
 Find extent of text+graphic+(pad between graphic and text).
virtual double getgraphicextent (MenuItem *mitem, double *x, double *y)
 Base MenuSelector currently just does text, so points w and h to 0.
virtual void drawStatusGraphic (int x, int y, int state)
 Draw the status graphic at window coordinates x,y,width=sgw,height=textheight+leading, with state.
virtual void drawitem (MenuItem *mitem, IntRectangle *itemspot)
 Draw the item in the provided area..
virtual void drawitem (int c)
 Draw the item with the index value c.
virtual void drawsep (const char *name, IntRectangle *rect)
 Draw a separator (default is just a win_colors->grayedfg colored line) across rect widthwise.
virtual void drawarrow (int x, int y, int r, int type)
 Draw the arrows for menus, really just THING_Triangle_Up, Down, Left, Right for submenus.
virtual void drawcheck (int on, int x, int y)
 Draw a check mark in rectangle x,y,width=checkw, height=textheight+leading.
virtual void drawsubindicator (MenuItem *mitem, int x, int y)
 Draws a submenu indicator in rectangle x,y,width=subw, height=textheight+leading.
virtual void drawitemname (MenuItem *mitem, IntRectangle *rect)
 Draw the item icon and name in rect.
virtual void drawtitle ()
 Draw the menu title if present. Default is print it out at top of window (not inrect).
virtual int send (int deviceid)
 Send message to owner.
virtual void addselect (int i, unsigned int state)
 This is called on a mouse down or a space press.
virtual int findmaxwidth (int s, int e, int *h_ret)
 Find the maximum width of (text+ pad+ graphic+ statusgraphicw+ checkwidth+ subw) of items in range [s,e].
virtual int findItem (int x, int y)
 Find the would be item at window coordinates (x,y).
virtual int findRect (int c, IntRectangle *itemspot)
 Find screen rectangle item c goes in.
virtual void editInPlace ()
 Set up the edit in place mode. ****TODO!!
virtual int numItems ()
 Default is to return the number of items in menu->menuitems stack.
virtual MenuItemitem (int i, char skipcache=0)
 Return the item corresponding to screen index i.
virtual void arrangeItems (int forwrapping=0)
 Setup columns based on inrect, then sync up the panner.
virtual void setcuritem (int i)
 Sets curitem and curmenuitem. Internal function.
virtual void syncWindows (int useinrect=0)
 Called same for ScrolledWindow, then arrangeItems.
virtual int makeinwindow ()
 Make sure that ccuritem is visible by shifting screen so it is.

Protected Attributes

ButtonDownInfo buttondown
int mousedragged
 Flag for whether the mouse has been dragged since a button was down.
NumStack< intcolumns
 Each element of the stack holds the width of that column.
MenuInfomenu
 Stores the actual menu items.
char menuislocal
 Whether menu is local to this MenuSelector.
int mx
int my
int sgw
 The width of the status graphic element of a menu item. (only one width, not per item)
int checkw
 The width of the check mark graphic of a menu item. (only one width, not per item)
int subw
 The width of the sub menu indicator graphic of a menu item. (only one width, not per item)
int firstinw
 The equivalent index of the first line in the window.
int textheight
 The height of lines are leading+(text height).
int lineheight
int pagesize
 The number of lines that can be comfortably fit in inrect.
int columnsize
 The maximum number of actual elements in any the columns.
MenuItemcurmenuitem
 The MenuItem corresponding to curitem.
int curitem
 The last selected or deselected item.
int ccuritem
 The item which one has cursored to.
int timerid

Detailed Description

General list and menu controller. Base class for PopupMenu.

#include <lax/menuselector.h>
Todo:
*** need style USE_ALL_OPEN, where all open submenus are used, should also be able to toggle wether the actual item text is displayed when the sub stuff is used: or put that in a TreeSelector?? item -item- <–item has open sub menu, the submenu's title is ignored sub1 -sub2- <–sub2 has open sub menu, the submenu's title is ignored subsub1 subsub1

For speed, all lines have the same height. This is really a little bit of a cop-out for not wanting to program for lines that have differing heights.

Please note that the ridiculously large number of style flags are passed in through a dedicated long long in the constructor, rather than the normal or'ing with the anXWindow::win_style flags. These menu flags are stored in menustyle.

This class handles only one level of a menu. Multiple levels are handled in the more specialized derived classes TreeSelector (***todo!) and PopupMenu. All items can be selected. They are indicated by being highlighted (or having a status graphic checked). There is a separate highlighting corresponding to a current item on which the next action will be performed. For instance, say you press up or down, you are not necessarily selecting the items that are up or down, but if you then press space, then that curitem is selected. This 'user focused' item is stored in ccuritem. The last item to have its state actually changed is stored in curitem.

Items can be displayed in 1 long vertical list. Alternately, the items fill columns the size of the window, and columns extend off to the left and right. A third (*** not implemented) style has how ever many columns fit across the width of the window, and the contents extend off the top and bottom. Items fill downward in the first column, then fill the second column, etc.

MenuItems that have LAX_ISTOGGLE are allowed to be checked on and off. This is different then being selected/highlighted. Items can also be hidden (***not implemented), but still be stored in the stack.

Todo:
*** implement hidden items

This class uses a PanController such that the panner wholebox (min and max) is the bounding box of all the items, and the selbox (start and end) is inrect. However, any shifting changes the panner's selbox, but this does not trigger any change in inrect.

There are three standard color schemes to choose from. First, there are the standard button colors for text and background (MENUSEL_BUTTONCOLORS). Second are the standard text edit colors (MENUSEL_TEXTCOLORS). And last and default are the standard menu panel colors.

// Item placement and display flags
#define MENUSEL_CHECK_ON_RIGHT (1LL<<0)
#define MENUSEL_CHECK_ON_LEFT (1LL<<1)
#define MENUSEL_SUB_ON_RIGHT (1LL<<2)
#define MENUSEL_SUB_ON_LEFT (1LL<<3)
#define MENUSEL_STATUS_ON_RIGHT (1LL<<4)
#define MENUSEL_STATUS_ON_LEFT (1LL<<5)
#define MENUSEL_GRAPHIC_ON_RIGHT (1LL<<6)
#define MENUSEL_GRAPHIC_ON_LEFT (1LL<<7)
#define MENUSEL_SUB_FOLDER (1LL<<8)
#define MENUSEL_SUB_ARROW (1LL<<9)
#define MENUSEL_CENTER (1LL<<10)
#define MENUSEL_LEFT (1LL<<11)
#define MENUSEL_RIGHT (1LL<<12)
#define MENUSEL_TAB_JUSTIFY (1LL<<13)
#define MENUSEL_CHECKS (1LL<<14)
#define MENUSEL_CHECKBOXES (1LL<<15)
#define MENUSEL_SHOW_LEAF_ONLY (1LL<<16)
#define MENUSEL_SHOW_SUB_ONLY (1LL<<17)
#define MENUSEL_SCROLLERS (1LL<<18)
#define MENUSEL_USE_TITLE (1LL<<19)
#define MENUSEL_BUTTONCOLORS (1LL<<20)
#define MENUSEL_TEXTCOLORS (1LL<<21)
#define MENUSEL_FIT_TO_WIDTH (1LL<<22)
#define MENUSEL_FIT_TO_HEIGHT (1LL<<23)
#define MENUSEL_TREE (1LL<<24)
#define MENUSEL_COMPOUND_TREE (1LL<<25)
#define MENUSEL_SORT_NUMBERS (1LL<<26)
#define MENUSEL_SORT_LETTERS (1LL<<27)
#define MENUSEL_SORT_REVERSE (1LL<<28)
#define MENUSEL_SORT_SUBS_FIRST (1LL<<29)
#define MENUSEL_SORT_IGNORE_CASE (1LL<<30)
#define MENUSEL_SORT_BY_EXTENSIONS (1LL<<31)
#define MENUSEL_USE_DOT (1LL<<32)
#define MENUSEL_USE_DOT_DOT (1LL<<33)
#define MENUSEL_USE_UP (1LL<<34)
#define MENUSEL_USE_BACK (1LL<<35)
#define MENUSEL_ONE_ONLY (1LL<<36)
#define MENUSEL_ZERO_OR_ONE (1LL<<37)
#define MENUSEL_SELECT_ANY (1LL<<38)
#define MENUSEL_SELECT_LEAF_ONLY (1LL<<39)
#define MENUSEL_SELECT_SUB_ONLY (1LL<<40)
#define MENUSEL_CURSSELECTS (1LL<<41)
#define MENUSEL_FOLLOW_MOUSE (1LL<<42)
#define MENUSEL_GRAB_ON_MAP (1LL<<43)
#define MENUSEL_GRAB_ON_ENTER (1LL<<44)
#define MENUSEL_OUT_CLICK_DESTROYS (1LL<<45)
#define MENUSEL_CLICK_UP_DESTROYS (1LL<<46)
#define MENUSEL_DESTROY_ON_LEAVE (1LL<<47)
#define MENUSEL_DESTROY_ON_FOCUS_OFF (1LL<<48)
#define MENUSEL_REARRANGEABLE (1LL<<49)
#define MENUSEL_EDIT_IN_PLACE (1LL<<50)
// *** add items?? (more than just editing names)
// *** remove items??
#define MENUSEL_SEND_ON_UP (1LL<<51)
#define MENUSEL_SEND_ON_ENTER (1LL<<52)
#define MENUSEL_SEND_IDS (1LL<<53)
#define MENUSEL_SEND_STRINGS (1LL<<54)
  //... remember that the buck stops with (1<<63)
 TODO: label in 2 parts: "Blah\t+t" –> 'Blah    +t' (2 part labels, also 
 underline character for hot keys??), rearrange, edit in place
   TODO
   *** RemoveItem
   *** put in a newstate(int newstate,int drawnow)/toggle(item,-1)
   *** when mouseover up arrow or autoscroll up, moving down should not shiftscreen
   *** scrollbar (x/y) versus up/down arrows and right click dragging??
   *** Menu
        | Blah        ^x | <– parse item in two parts, "Blah\t^x" -> "Blah" —> "^x"??
        | Yack       +^y |
        | Pshaww      ^p |
    Shift:   + //   Control: ^ //   Alt:     * //   Mod4:    ~

  • <– key menu shortcut (on P) No!! use the progressive scanning? both?
   *** non-constant item height, easier facility for graphic+text??
   *** menu groups, so you can push groups of things onto a single menu, without
        the need of poping up a submenu!! Quite useful for many of the potential
        menus in laidout ==== this is basically a tree, without all the tree lines...
   *** neat from fltk:
            Add("File")
            Add("File/Save")
            Add("File/Save As")....
 
Todo:
a lot of stuff, see class MenuSelector

Constructor & Destructor Documentation

Laxkit::MenuSelector::MenuSelector ( 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 atom = 0,
unsigned long long  nmstyle = 0,
MenuInfo usethismenu = NULL,
char  nmenuislocal = 0 
)

Constructor.

If you pass in a MenuInfo, you can also pass in whether the MenuSelector should be resposible for deleting it (menuislocal==1) or not. If usethismenu is NULL, then a new MenuInfo is created and menuislocal is set to 1. If usethismenu is not NULL, then the value of nmenuislocal is used. The default is 1: for the MenuSelector to take possession of the MenuInfo. This allows programs to create a menuinfo themselves, and then not worry about deleting it, because the selector will delete it.

Sets up colors, and pushes 0 onto the columns stack.

Parameters:
nstyleHolds the usual anXWindow style flags
nmstyleHolds the menu style defines
usethismenuPass in a MenuInfo class, if not NULL is assumed to not be local
nmenuislocalWhether the passed in menu is local. Default is 1

References ccuritem, columns, columnsize, curitem, curmenuitem, firstinw, Laxkit::anXWindow::installColors(), leading, menu, menuislocal, mousedragged, pagesize, Laxkit::NumStack< T >::push(), and textheight.


Member Function Documentation

int Laxkit::MenuSelector::AddItem ( const char i,
int  nid,
int  newstate 
)
virtual

Add item with text i to the top index of menuitems.

You can specify an initial state, such as LAX_GRAY, etc. Automatically sorts if sort is the style.

Returns the number of items in the stack, or -1 if error.

Does not synchronize the display. You must do that manually later on, unless init() hasn't been called yet. init() synchronizes the display.

References Laxkit::MenuInfo::AddItem(), item(), menu, and numItems().

Referenced by AddItems().

int Laxkit::MenuSelector::AddItems ( const char **  i,
int  n,
int  startid 
)
virtual

Add a bunch of items all at once.

Returns number of items added

Todo:
***this is cheap, should be optimized for large arrays?? add in one lump, then sort??

References AddItem().

void Laxkit::MenuSelector::addselect ( int  i,
unsigned int  state 
)
protectedvirtual

This is called on a mouse down or a space press.

Sets the state of the affected items, and also draws the results on the window. A plain select will deselect all, and select just i. A control select will toggle whether an item is on or off, without deselecting all the others. A shift select will turn on any items in the range that are off. A control-shift select will make all in the range [curitem,i] have the same state as curitem.

An item's state is only modified if it is already LAX_ON or LAX_OFF.

Does not send the control message from here.

Reimplemented in Laxkit::PopupMenu.

References ccuritem, curitem, curmenuitem, drawitem(), item(), numItems(), Laxkit::MenuItem::state, and Laxkit::anXWindow::WindowTitle().

Referenced by CharInput(), LBUp(), MouseMove(), and Select().

void Laxkit::MenuSelector::adjustinrect ( )
protectedvirtual

Remove the pads from inrect.

This is called last thing from ScrolledWindow::syncWindows(). Also sets pagesize=(inrect.height+leading)/(textheight+leading)

This and arrangeItems are the only places that pagesize gets set.

Reimplemented from Laxkit::ScrolledWindow.

References Laxkit::ScrolledWindow::inrect, leading, pagesize, and textheight.

Referenced by WrapToPosition().

void Laxkit::MenuSelector::arrangeItems ( int  forwrapping = 0)
protectedvirtual

Setup columns based on inrect, then sync up the panner.

Default is for single column. FIT_TO_HEIGHT causes multiple columns that continue off horizontally. Assumes inrect has been found and arranges items to fit in that. Sets columnsize to something appropriate.

This sets pagesize if necessary.

Syncs the panner such that the wholebox of the panner is the newly found wholerect, and the selbox is inrect. However, any shifting changes the panner's selbox, but this does not trigger any change in inrect.

If forwrapping!=0 then do not try to expand wholerect to fill up inrect, and do not update the panner. This is when you are arranging items first, and then wrapping the window to the extent of the items.

Todo:
***Need to implement FIT_TO_WIDTH, or remove is as possibility...

References columns, columnsize, Laxkit::NumStack< T >::e, findmaxwidth(), Laxkit::NumStack< T >::flush(), Laxkit::ScrolledWindow::inrect, leading, Laxkit::NumStack< T >::n, numItems(), pagesize, Laxkit::NumStack< T >::push(), Laxkit::PanController::SetCurPos(), Laxkit::PanController::SetWholebox(), and textheight.

Referenced by init(), SetLineHeight(), Sync(), syncWindows(), and WrapToPosition().

int Laxkit::MenuSelector::CharInput ( unsigned int  ch,
const char buffer,
int  len,
unsigned int  state,
const LaxKeyboard d 
)
virtual

Character input.

Currently:

  enter      ???send/select currently selected items
  space      addselect(ccuritem)
  pgup/down, Jump ccuritem 1 page up or down
  up/down,   Move ccuritem 1 item up or down
  'a'        If none selected, select all, else deselect any selected.
  ^'m'       (***imp me!) move selected items to ccuritem
  '/'        (***imp me!) start search mode?– have either sep search mode
                   or make all selecting keys above be control-key, not just key
                   so can use normal typing as progressive search
  *** need to have type to search, or hotkeys
 

Reimplemented from Laxkit::anXWindow.

Reimplemented in Laxkit::PopupMenu.

References addselect(), ccuritem, columns, columnsize, Laxkit::anXApp::destroywindow(), drawitem(), item(), leading, makeinwindow(), movescreen(), Laxkit::NumStack< T >::n, numItems(), pagesize, Laxkit::ScrolledWindow::send(), Laxkit::MenuItem::state, and textheight.

int Laxkit::MenuSelector::Curitem ( )
inlinevirtual

Return curitem, which is the last item whose state was toggled.

Note that this is not necessarily ccuritem which is what one might go to with the arrow keys without actually selecting.

References curitem.

void Laxkit::MenuSelector::drawarrow ( int  x,
int  y,
int  r,
int  type 
)
protectedvirtual

Draw the arrows for menus, really just THING_Triangle_Up, Down, Left, Right for submenus.

Centers around x,y within a box of side 2*r. This function is also used for the up and down arrows when the menu contents extend beyond the screen.

References Laxkit::draw_thing().

Referenced by drawsubindicator().

void Laxkit::MenuSelector::drawitem ( MenuItem mitem,
IntRectangle itemspot 
)
protectedvirtual

Draw the item in the provided area..

All the things that go on an item line:
[status graphic=whether highlighted][check toggle][graphic icon][text][submenu indicator] First XClearArea, then put it in..

  1. If the item is a separator, call drawsep() and return.
  2. Otherwise, determine whether there is a status graphic, submenu indicator, and checkmark. If so, from the original line, the status graphic is either put flush left or right.
  3. Then a checkmark is placed either flush left or right in the remaining space.
  4. Then the submenu indicator is put flush left or right of the remaining space.
  5. Finally, the actual item text and icon fill the remaining space.

    Normally, drawitem would use drawStatusGraphic,****is this right and getitemextent to determine these things.

Todo:
*** Highlighting should go right across the item, behind any other doodads put up, currently just goes across text...
Todo:
*** set clip to intersection of itemspot and inrect??

References checkw, drawcheck(), drawitemname(), drawsep(), drawStatusGraphic(), drawsubindicator(), Laxkit::fill_rectangle(), sgw, Laxkit::MenuItem::state, and subw.

Referenced by addselect(), CharInput(), drawitem(), FocusOff(), FocusOn(), MouseMove(), and Refresh().

void Laxkit::MenuSelector::drawitem ( int  c)
protectedvirtual

Draw the item with the index value c.

All the things that go on an item line:
[status graphic=whether highlighted][check toggle][graphic icon][text][submenu indicator]

First, determine if this item is actually on screen, and find the area to draw it in. Return if not on screen. If it is found, then find the item and call drawitem(theitem,thebounds).

References drawitem(), findRect(), Laxkit::ScrolledWindow::inrect, item(), and numItems().

void Laxkit::MenuSelector::drawStatusGraphic ( int  x,
int  y,
int  state 
)
protectedvirtual

Draw the status graphic at window coordinates x,y,width=sgw,height=textheight+leading, with state.

This is not an item's icon. It is the menu style in which the items are not highlighted, but act like several checkboxes. The boxes are marked instead of the whole item being hightlighted.

Of this scheme, MENUSEL_CHECKBOXES causes the graphic to be a circle with the mark inside the circle. Otherwise, the mark is drawn without a surrounding circle.

References highlight, sgw, shadow, and textheight.

Referenced by drawitem().

void Laxkit::MenuSelector::drawsubindicator ( MenuItem mitem,
int  x,
int  y 
)
protectedvirtual

Draws a submenu indicator in rectangle x,y,width=subw, height=textheight+leading.

Todo:
for MENUSEL_SUB_FOLDER, draw an open or closed folder.

References Laxkit::draw_lines(), drawarrow(), Laxkit::fill_polygon(), leading, Laxkit::MenuItem::state, subw, and textheight.

Referenced by drawitem().

void Laxkit::MenuSelector::editInPlace ( )
protectedvirtual

Set up the edit in place mode. ****TODO!!

Todo:
*** imp me!

Referenced by LBUp().

int Laxkit::MenuSelector::Event ( const EventData e,
const char mes 
)
virtual

Intercept LAX_onMapped in case MENUSEL_GRAB_ON_MAP is set.

Grabs the pointer if that style is set. In either case, it then properly calls anXWindow::Event().

Todo:
*** is just selecting a default keyboard, which might be unacceptible

Reimplemented from Laxkit::ScrolledWindow.

References Laxkit::anXApp::destroywindow(), and Laxkit::anXApp::setfocus().

int Laxkit::MenuSelector::findItem ( int  x,
int  y 
)
protectedvirtual

Find the would be item at window coordinates (x,y).

The value returned is not necessarily an actual element index. It could be -1, or >=menuitems.n.

References columns, columnsize, Laxkit::NumStack< T >::e, Laxkit::PanController::GetCurPos(), Laxkit::ScrolledWindow::inrect, leading, Laxkit::NumStack< T >::n, and textheight.

Referenced by LBUp(), and MouseMove().

int Laxkit::MenuSelector::findmaxwidth ( int  s,
int  e,
int h_ret 
)
protectedvirtual

Find the maximum width of (text+ pad+ graphic+ statusgraphicw+ checkwidth+ subw) of items in range [s,e].

Clamp s and e to [0,numItems()-1]. Return -1 if e<s.

If the corresponding style (like for submenu indicator for instance) is not set in menustyle, then that width is not included.

Return the maximum height in h_ret.

References checkw, Laxkit::getextent(), getgraphicextent(), item(), numItems(), padg, sgw, and subw.

Referenced by arrangeItems().

int Laxkit::MenuSelector::findRect ( int  c,
IntRectangle itemspot 
)
protectedvirtual

Find screen rectangle item c goes in.

Return 0 for rectangle found, otherwise 1 for unable to find (for instance when called before necessary initialization done).

References columns, columnsize, Laxkit::NumStack< T >::e, Laxkit::PanController::GetCurPos(), Laxkit::ScrolledWindow::inrect, leading, and textheight.

Referenced by Laxkit::PopupMenu::addselect(), drawitem(), makeinwindow(), and movescreen().

int Laxkit::MenuSelector::FocusOff ( const FocusChangeData e)
virtual

Focus off draws the char over item.

Also, if MENUSEL_FOCUS_OFF_DESTROYS, then an off focus destroys this window.

Reimplemented from Laxkit::anXWindow.

References ccuritem, Laxkit::anXApp::destroywindow(), drawitem(), Laxkit::anXWindow::win_active, and Laxkit::anXWindow::WindowTitle().

double Laxkit::MenuSelector::getgraphicextent ( MenuItem mitem,
double *  w,
double *  h 
)
protectedvirtual

Base MenuSelector currently just does text, so points w and h to 0.

Todo:
*** incorporate icons/XImages/Pixmaps.. wait to do this until laxkit has more definite image handling setup

Returns the width.

Parameters:
mitemthe item
wPut the x extent here
hPut the y extent here

References Laxkit::LaxImage::h(), and Laxkit::LaxImage::w().

Referenced by findmaxwidth(), and getitemextent().

double Laxkit::MenuSelector::getitemextent ( MenuItem mitem,
double *  w,
double *  h,
double *  gx,
double *  tx 
)
protectedvirtual

Find extent of text+graphic+(pad between graphic and text).

If the graphic extent is 0, then the pad is not included. w and h must not be NULL! Note that the y extent is the actual y extent of the graphic+text. The actual space on the window that the line takes up is still textheight+leading.

Returns the x extent.

Parameters:
mitemthe index, MUST already be in bounds
wPut the x extent here
hPut the y extent here
gxWhere the graphic would start, relative to whole item
txWhere the text would start, relative to whole item

References Laxkit::getextent(), getgraphicextent(), and padg.

Referenced by drawitemname().

int Laxkit::MenuSelector::Idle ( int  tid)
virtual

Autoscroll if necessary****TODO.

Todo:
*** must autoscroll when mouse over arrow and FOLLOW_MOUSE

Reimplemented from Laxkit::anXWindow.

Reimplemented in Laxkit::PopupMenu.

int Laxkit::MenuSelector::init ( )
virtual

Set some values that are derived from other values (pagesize, hightlight, shadow, ...).

Sets leading to have a little bit extra if MENUSEL_CHECKBOXES and not otherwise specified. Also sets the shadow and hightlight colors, and determines the pagesize.

Reimplemented from Laxkit::ScrolledWindow.

References arrangeItems(), Laxkit::coloravg(), highlight, leading, padg, Laxkit::rgbcolor(), SetLineHeight(), sgw, shadow, textheight, and Laxkit::anXWindow::WindowTitle().

MenuItem * Laxkit::MenuSelector::item ( int  i,
char  skipcache = 0 
)
protectedvirtual

Return the item corresponding to screen index i.

This is not necessarily a direct index into the menu->menuitems stack, though that is the default behavior of this function.

If open menus are displayed with this menu, like in a tree, then this function must be redefined to access the thing associated with screen index i.

This function does not implement a search cache, but provides the tag for subclasses to use if they want.

Todo:
maybe have option to force remapping==bypassing any search cache??

References Laxkit::PtrStack< T >::e, menu, Laxkit::MenuInfo::menuitems, and Laxkit::PtrStack< T >::n.

Referenced by AddItem(), addselect(), CharInput(), drawitem(), drawitemname(), findmaxwidth(), NumSelected(), Select(), send(), setcuritem(), and WhichSelected().

int Laxkit::MenuSelector::LBDown ( int  x,
int  y,
unsigned int  state,
int  count,
const LaxMouse d 
)
virtual

Left button down.

If MENUSEL_OUT_CLICK_DESTROYS is set, then app->destroywindow(this) when clicking down outside the window.

Reimplemented from Laxkit::anXWindow.

References curitem, curmenuitem, Laxkit::anXApp::destroywindow(), Laxkit::ButtonDownInfo::down(), mousedragged, and Laxkit::ScrolledWindow::send().

int Laxkit::MenuSelector::LBUp ( int  x,
int  y,
unsigned int  state,
const LaxMouse d 
)
virtual

Left button up.

If clicked on an arrow, then shift screen. If on item, then addselect(that item). Send the control message if MENUSEL_SEND_ON_UP is set. Destroy this window if MENUSEL_CLICK_UP_DESTROYS is set.

Todo:
*** lbdown/up no drag on an already selected item should initiate EDIT_IN_PLACE
Todo:
*** mousedragged==2 means a rearrangement might be required

Reimplemented from Laxkit::anXWindow.

References addselect(), Laxkit::anXApp::destroywindow(), editInPlace(), findItem(), Laxkit::ButtonDownInfo::isdown(), mousedragged, numItems(), Laxkit::ScrolledWindow::send(), and Laxkit::ButtonDownInfo::up().

int Laxkit::MenuSelector::makeinwindow ( )
protectedvirtual

Make sure that ccuritem is visible by shifting screen so it is.

Returns 1 if x shifted, 2 if y, 3 if both.

References ccuritem, findRect(), Laxkit::ScrolledWindow::inrect, and Laxkit::PanController::Shift().

Referenced by CharInput().

int Laxkit::MenuSelector::MouseMove ( int  x,
int  y,
unsigned int  state,
const LaxMouse d 
)
virtual

Left might select depending on style. Right button drags. +R fast drags.

Todo:
*** should implement speedy shifting with shift/cntl-RB drag
Todo:
*** also, if right-click shifting, and is off screen, do a sort of auto scrolling, like if mouse above, then move if mouse moving up, but not if mouse is moving down?? or on timer?

Reimplemented from Laxkit::anXWindow.

Reimplemented in Laxkit::PopupMenu.

References addselect(), Laxkit::ButtonDownInfo::any(), ccuritem, drawitem(), findItem(), Laxkit::ButtonDownInfo::isdown(), mousedragged, movescreen(), and numItems().

int Laxkit::MenuSelector::movescreen ( int  dx,
int  dy 
)
virtual

Try to move the screen by dx pixels and dy pixels.

Also resets ccuritem so that it refers to an item that is actually visible.

Returns whether shifting occured. 1=x, 2=y, 3=x and y

References ccuritem, columns, columnsize, Laxkit::NumStack< T >::e, findRect(), Laxkit::ScrolledWindow::inrect, leading, Laxkit::NumStack< T >::n, numItems(), Laxkit::PanController::Shift(), and textheight.

Referenced by CharInput(), MouseMove(), WheelDown(), and WheelUp().

int Laxkit::MenuSelector::numItems ( )
protectedvirtual

Default is to return the number of items in menu->menuitems stack.

A tree class, for instance would return the number of items plus the items from any open submenus.

References menu, Laxkit::MenuInfo::menuitems, and Laxkit::PtrStack< T >::n.

Referenced by AddItem(), addselect(), arrangeItems(), CharInput(), drawitem(), findmaxwidth(), LBUp(), MouseMove(), movescreen(), NumSelected(), Refresh(), Select(), send(), Sort(), and WhichSelected().

int Laxkit::MenuSelector::RBDown ( int  x,
int  y,
unsigned int  state,
int  count,
const LaxMouse d 
)
virtual

Right button and drag drags the screen around (with potential autoscrolling)

Todo:
***perhaps someday have a hook so that right click on an item calls up some menu? like copy to, delete item, etc..

Reimplemented from Laxkit::anXWindow.

Reimplemented in Laxkit::PopupMenu.

References Laxkit::ButtonDownInfo::down().

void Laxkit::MenuSelector::Refresh ( )
virtual

Draw the window.

Draws the items by calling drawitem(). Then draws the up arrow and down arrow if they are needed. Draws the title along top of window

// *** will need a smart refreshing to XCopyArea instead of redrawing the whole thing
// *** need itemrect????

 Goes like:
  drawtitle()
  drawitem(int) for each item
    then with that item and rect on screen where it goes, call:
    drawitem(MenuItem *mitem,IntRectangle *itemspot)
      which might call as appropriate:
      drawsep(const char *name,IntRectangle *rect) <– separator
      drawStatusGraphic(int x,int y,int state) <– in lieu of highlighting
      drawcheck(int on, int x,int y)          <– togglable check mark
      drawsubindicator(MenuItem *mitem,int x,int y)  <– whether there's a submenu
      drawitemname(MenuItem *mitem,IntRectangle *rect) <– item name and/or icon
 

Reimplemented from Laxkit::anXWindow.

References Laxkit::clear_window(), drawitem(), drawtitle(), numItems(), and Laxkit::anXWindow::win_on.

int Laxkit::MenuSelector::Select ( int  which)
virtual

Programs call this to select index which.

This has the same effect as left button down on it.

Todo:
*** add state to it, for more control... that is be able to modify state of any element...

Returns index of the new curitem.

References addselect(), curitem, item(), numItems(), and Laxkit::MenuItem::state.

Referenced by Laxkit::FileDialog::getDirectory(), Laxkit::SliderPopup::makePopup(), Laxkit::MenuButton::makePopup(), and Laxkit::PopupMenu::PopupMenu().

int Laxkit::MenuSelector::send ( int  deviceid)
protectedvirtual

Send message to owner.

If !(menustyle&MENUSEL_SEND_STRINGS) Sends SimpleMessage with:

info1 = curitem (which might be -1 for nothing)
info2 = id of curitem
info3 = nitems selected
info4 = menuitem->info

Otherwise, sends a list of the selected strings in a StrsEventData, with info=curitem.

Todo:

*** there needs to be option to send id or list of ids..

maybe send device id of the device that triggered the send

References curitem, Laxkit::MenuItem::info, item(), newstr(), numItems(), Laxkit::anXApp::SendMessage(), Laxkit::MenuItem::state, Laxkit::anXWindow::win_owner, Laxkit::anXWindow::win_sendthis, and Laxkit::anXWindow::WindowTitle().

void Laxkit::MenuSelector::setcuritem ( int  i)
protectedvirtual

Sets curitem and curmenuitem. Internal function.

*** doesn't seem to be used anywhere.. get rid of it?

References curitem, curmenuitem, and item().

int Laxkit::MenuSelector::SetFirst ( int  which,
int  x,
int  y 
)
virtual

Make item which be near screen coordinate x,y.

Returns ???***.

Todo:
*** no bounds check, should at least make sure something is in window?
Todo:
*** fix me!

Referenced by WrapToPosition().

void Laxkit::MenuSelector::SetLineHeight ( int  ntotalheight,
int  newleading,
char  forcearrange = 1 
)
virtual

Set the new line height and leading.

textheight is set to ntotalheight-newleading. If forcearrange==1 then also syncWindows() which also causes adjustinrect() and arrangeItems() to be called. If forcearrange==2, then do not call syncWindows, instead call arrangeItems(0). If forcearrange==3, then call arrangeItems(1). This last one is when you are seeking setup in preparation for wrapping a window's boundaries to the items extent.

Usually from outside the class, a program would just call SetLineHeight(h,l), and this would call arrangeItems(). init() needs to set some other stuff before arranging, so it calls with forcearrange==0.

References arrangeItems(), checkw, leading, padg, sgw, subw, syncWindows(), and textheight.

Referenced by init(), and WrapToPosition().

void Laxkit::MenuSelector::Sort ( int  t)
virtual

Sort the items alphabetically by the name.

t is passed on to MenuInfo::sortstyle. t==0 means do the default sorting.

Todo:
*** should be able to sort only a subset, for instance all items between separators.

References menu, numItems(), and Laxkit::MenuInfo::sort().

void Laxkit::MenuSelector::syncWindows ( int  useinrect = 0)
protectedvirtual

Called same for ScrolledWindow, then arrangeItems.

Has the effect of resizing scrollers, and remapping inrect and outrect.

Reimplemented from Laxkit::ScrolledWindow.

References arrangeItems().

Referenced by SetLineHeight().

int Laxkit::MenuSelector::WheelDown ( int  x,
int  y,
unsigned int  state,
int  count,
const LaxMouse d 
)
virtual

Scroll screen up.

Control OR shift mask shifts by whole page lengths. Shift AND Control shifts by 3 times whole page lengths.

Reimplemented from Laxkit::anXWindow.

References leading, movescreen(), pagesize, and textheight.

int Laxkit::MenuSelector::WheelUp ( int  x,
int  y,
unsigned int  state,
int  count,
const LaxMouse d 
)
virtual

Scroll screen down.

Control OR Shift mask shifts by whole page lengths. Shift AND Control shifts by 3 times whole page lengths.

Reimplemented from Laxkit::anXWindow.

References leading, movescreen(), pagesize, and textheight.

int * Laxkit::MenuSelector::WhichSelected ( unsigned int  state)
virtual

Return a new'd int array of which items are in the given state, if there are any, else NULL.

Same state means MenuItem::state&LAX_MSTATE_MASK == state.

The first element is the number of selected items. The calling code is responsible for deleting the array.

References Laxkit::NumStack< T >::e, Laxkit::NumStack< T >::extractArray(), item(), Laxkit::NumStack< T >::n, numItems(), and Laxkit::NumStack< T >::push().

Referenced by Laxkit::FileDialog::send().

int Laxkit::MenuSelector::WrapToPosition ( int  screen_x,
int  screen_y,
int  screen,
anXWindow onedgeofthis = NULL 
)
virtual

Orient the window's size and position to be near the given screen coordinates.

This function tries to place the window near screen coordinates of the mouse.

If onedgeofthis is None, it prefers to put the window to the left of the mouse. If it does not fit then it tries to put the window to the right of x,y. Also, the currently selected item is made to be at the same height of y.

If onedgeofthis is not NULL, then it also tries to place itself on a nearby right edge of onedgeofthis.

Currently, it assumes that this window is a top level window, such as a popup menu, and that it is not a tree, that is it does not consider submenus.

This also calls anXWindow::MoveResize().

Todo:
*** BROKEN! fix me!

References adjustinrect(), arrangeItems(), columns, columnsize, curitem, Laxkit::NumStack< T >::e, Laxkit::PtrStack< T >::e, findoutrect(), Laxkit::LaxImage::h(), Laxkit::ScrolledWindow::inrect, leading, menu, Laxkit::MenuInfo::menuitems, MoveResize(), Laxkit::NumStack< T >::n, Laxkit::PtrStack< T >::n, Laxkit::ScrolledWindow::outrect, Laxkit::anXApp::ScreenInfo(), SetFirst(), SetLineHeight(), and textheight.

Referenced by Laxkit::PopupMenu::PopupMenu(), and WrapToMouse().


Member Data Documentation

NumStack< int > Laxkit::MenuSelector::columns
protected

Each element of the stack holds the width of that column.

So of course, columns.n is the number of columns. The height of a full column is just pagesize*(textheight+leading).

Referenced by arrangeItems(), CharInput(), findItem(), findRect(), MenuSelector(), movescreen(), and WrapToPosition().

int Laxkit::MenuSelector::columnsize
protected

The maximum number of actual elements in any the columns.

When the style is wrapping to the height, columnsize should be equal to pagesize.

Referenced by arrangeItems(), CharInput(), findItem(), findRect(), MenuSelector(), movescreen(), and WrapToPosition().

int Laxkit::MenuSelector::firstinw
protected

The equivalent index of the first line in the window.

This could be a negative value, and so should not be interpreted as an index into the menuitems stack. It is useful for instance when popping up menus and you want the current selection to be near the mouse, no matter where the actual bounds of the window are.

Todo:
*** should remove this variable, i don't think it is needed

Referenced by MenuSelector().

int Laxkit::MenuSelector::leading

The height of lines are leading+(text height).

Any highlighting does not include the leading pixels.

Referenced by adjustinrect(), arrangeItems(), CharInput(), drawcheck(), drawitemname(), drawsubindicator(), drawtitle(), findItem(), findRect(), init(), MenuSelector(), movescreen(), SetLineHeight(), WheelDown(), WheelUp(), and WrapToPosition().

MenuInfo * Laxkit::MenuSelector::menu
protected

Stores the actual menu items.

The MenuInfo may be owned by MenuSelector or not, based on whether menuislocal is nonzero or not. If it is non-zero, then the destructor calls 'delete menu'.

Referenced by AddItem(), Laxkit::PopupMenu::addselect(), drawtitle(), findoutrect(), item(), MenuSelector(), numItems(), Laxkit::PopupMenu::PopupMenu(), Sort(), WrapToPosition(), and ~MenuSelector().

int Laxkit::MenuSelector::mousedragged
protected

Flag for whether the mouse has been dragged since a button was down.

If it is a simple move, then mousedragged==1. If the menuselector is REARRANGEABLE, and items are in the process of being moved, then mousedragged==2.

Referenced by LBDown(), LBUp(), MenuSelector(), and MouseMove().

int Laxkit::MenuSelector::pagesize
protected

The number of lines that can be comfortably fit in inrect.

That is, pagesize=(inrect.height+leading)/(textheight+leading)

Referenced by adjustinrect(), arrangeItems(), CharInput(), MenuSelector(), WheelDown(), and WheelUp().

int Laxkit::MenuSelector::textheight
protected

The height of lines are leading+(text height).

Any highlighting only includes the textheight pixels.

Referenced by adjustinrect(), arrangeItems(), CharInput(), drawcheck(), drawitemname(), drawStatusGraphic(), drawsubindicator(), drawtitle(), findItem(), findoutrect(), findRect(), init(), MenuSelector(), movescreen(), SetLineHeight(), WheelDown(), WheelUp(), and WrapToPosition().


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

Mon Feb 17 2014 11:52:59, Laxkit