Laxkit
0.0.7.1
|
A LineEdit with a label. More...
Public Member Functions | |
LineInput (anXWindow *parnt, const char *nname, const char *ntitle, unsigned int nstyle, int xx, int yy, int ww, int hh, int brder, anXWindow *prev, unsigned long nowner=0, const char *nsend=NULL, const char *newlabel=NULL, const char *newtext=NULL, unsigned int ntstyle=0, int nlew=0, int nleh=0, int npadx=-1, int npady=-1, int npadlx=-1, int npadly=-1) | |
Constructor, creates the internal LineEdit. | |
virtual const char * | whattype () |
virtual const char * | tooltip (const char *ntip) |
Set same tip for le. | |
virtual anXWindow * | GetController () |
virtual int | init () |
Adds the internal LineEdit. | |
virtual int | Event (const EventData *data, const char *mes) |
Take any StrEventData and set thetext from it. | |
virtual int | FocusOn (const FocusChangeData *e) |
virtual int | FocusOff (const FocusChangeData *e) |
Just return anXWindow::FocusOff(e);. | |
virtual void | Refresh () |
Redraw label. | |
virtual int | MoveResize (int nx, int ny, int nw, int nh) |
Calls anXWindow::MoveResize(nx,ny,nw,nh) then SetPlacement(). | |
virtual int | Resize (int nw, int nh) |
Calls anXWindow::Resize(nw,nh) then SetPlacement(). | |
virtual char * | GetText () |
Return a new'd copy of the LineEdit's text. | |
virtual const char * | GetCText () |
Return a const pointer to the LineEdit's text. | |
virtual long | GetLong (int *error_ret=NULL) |
Just returns le->GetLong(error_ret). | |
virtual double | GetDouble (int *error_ret=NULL) |
Just returns le->GetDouble(error_ret). | |
virtual void | SetLabel (const char *newlabel) |
Set the label (not the internal edit text). | |
virtual void | SetText (const char *newtext) |
Set the text of the internal LineEdit. | |
virtual void | SetText (int newtext) |
Set the text according to the given integer. | |
virtual void | SetText (double newtext) |
Set the text according to the given floating point number. | |
virtual void | SetOwner (anXWindow *nowner, const char *mes=NULL) |
virtual void | SetPlacement () |
Sets the placement of the label and LineEdit. | |
virtual int | send () |
virtual int | CloseControlLoop () |
Does: if (le) le->CloseControlLoop();. | |
virtual LineEdit * | GetLineEdit () |
Return pointer to the internal LineEdit. | |
virtual LaxFiles::Attribute * | dump_out_atts (LaxFiles::Attribute *att, int what, Laxkit::anObject *savecontext) |
virtual void | dump_in_atts (LaxFiles::Attribute *att, int flag, Laxkit::anObject *loadcontext) |
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 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 | 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 void | contentChanged () |
Windows may call this when their contents change. | |
virtual void | selectionChanged () |
Windows may call this when their selections change. | |
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 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. | |
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 () |
Protected Attributes | |
LineEdit * | le |
char * | label |
int | lx |
X coordinate of the label. | |
int | ly |
Y coordinate of the label. | |
int | lew |
The preferred width of the LineEdit portion of the window. Nonpositive means use the remainder. | |
int | leh |
The preferred height of the LineEdit portion of the window. (see below) | |
int | padx |
Horizontal inset for the whole window. | |
int | pady |
Vertical inset for the whole window. | |
int | padlx |
Horizontal inset for the internal LineEdit. | |
int | padly |
Vertical inset for the internal LineEdit. | |
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 |
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 |
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 LineEdit with a label.
This can be used as a simple one line input popup. Just pass in the style LINP_POPUP with a NULL parent. When enter is hit, the window sends a StrEventData with the text in it to owner, and then the window deletes itself.
lx,ly Coordinates of the label lew Preferred width of the edit (<=0 means use remainder after label) leh Preferred height (0==use textheight+padlx, <0 is remainder) padx Horizontal pad around both the label and edit pady Vertical pad around both the label and edit padlx Horizontal inset passed to the LineEdit padly Vertical inset passed to the LineEdit
Laxkit::LineInput::LineInput | ( | anXWindow * | parnt, |
const char * | nname, | ||
const char * | ntitle, | ||
unsigned int | nstyle, | ||
int | xx, | ||
int | yy, | ||
int | ww, | ||
int | hh, | ||
int | brder, | ||
anXWindow * | prev, | ||
unsigned long | nowner = 0 , |
||
const char * | nsend = NULL , |
||
const char * | newlabel = NULL , |
||
const char * | newtext = NULL , |
||
unsigned int | ntstyle = 0 , |
||
int | nlew = 0 , |
||
int | nleh = 0 , |
||
int | npadx = -1 , |
||
int | npady = -1 , |
||
int | npadlx = -1 , |
||
int | npadly = -1 |
||
) |
Constructor, creates the internal LineEdit.
nlew | Width of the edit box |
nleh | Height of the edit box |
npadx | Horizontal pad around the whole window |
npady | Vertical pad around the whole window |
npadlx | Horizontal pad to inset text in the edit box |
npadly | Horizontal pad to inset text in the edit box |
References appendstr(), Laxkit::getextent(), Laxkit::anXWindow::installColors(), leh, lew, makestr(), padlx, padly, padx, pady, SetPlacement(), Laxkit::anXWindow::win_name, and Laxkit::anXWindow::win_owner.
|
virtual |
Reimplemented from Laxkit::anXWindow.
|
inlinevirtual |
Return a const pointer to the LineEdit's text.
Use this quickly, before the LineEdit changes it.
References Laxkit::TextEditBaseUtf8::GetCText().
Referenced by Laxkit::FileDialog::closeWindow(), Laxkit::ImageDialog::Event(), Laxkit::FileDialog::Event(), Laxkit::FileDialog::fullFilePath(), Laxkit::FileDialog::getDirectory(), Laxkit::FileDialog::GoUp(), Laxkit::FileDialog::RefreshDir(), Laxkit::QuickFileOpen::send(), Laxkit::FileDialog::SetFile(), Laxkit::ImageDialog::updateImageInfo(), and Laxkit::ShortcutWindow::UpdateSearch().
|
virtual |
Return pointer to the internal LineEdit.
Beware using this! Should really be used only to modify things like initial cursor position and colors.
Referenced by Laxkit::FileDialog::Event(), Laxkit::ImageDialog::init(), and Laxkit::ImageDialog::reallyGeneratePreview().
|
virtual |
Adds the internal LineEdit.
Also for LINP_POPUPs, the owner and message of the internal edit are set to this->window, and "lineinput-popup-style". In this case, when the LineInput gets the corresponding ClientMessage event, it then sends a StrEventData with a copy of le->thetext to the real owning window.
Reimplemented from Laxkit::anXWindow.
References Laxkit::anXApp::addwindow(), and Laxkit::anXWindow::SetOwner().
|
virtual |
Sets the placement of the label and LineEdit.
Called when the window is resized.
assumes that win_w, win_h, lew,leh set, and le exists
sets lx,ly, le->x,y,w,h
References Laxkit::getextent(), leh, lew, lx, ly, Laxkit::TextXEditBaseUtf8::MoveResize(), padlx, padly, padx, pady, and Laxkit::anXWindow::WindowTitle().
Referenced by LineInput(), MoveResize(), Resize(), and SetLabel().
|
protected |
The preferred height of the LineEdit portion of the window. (see below)
leh<0 means use remainder,
leh=0 means use textheight+padlx
leh>0 is absolute
Referenced by LineInput(), and SetPlacement().