GG
|
#include <MultiEdit.h>
Edit (X x, Y y, X w, const std::string &str, const boost::shared_ptr< Font > &font, Clr color, Clr text_color=CLR_BLACK, Clr interior=CLR_ZERO, Flags< WndFlag > flags=INTERACTIVE) | |
virtual Pt | ClientUpperLeft () const |
const std::pair< CPSize, CPSize > & | CursorPosn () const |
Clr | InteriorColor () const |
Clr | HiliteColor () const |
Clr | SelectedTextColor () const |
virtual void | SetColor (Clr c) |
void | SetInteriorColor (Clr c) |
void | SetHiliteColor (Clr c) |
void | SetSelectedTextColor (Clr c) |
virtual void | SelectRange (CPSize from, CPSize to) |
TextControl (X x, Y y, X w, Y h, const std::string &str, const boost::shared_ptr< Font > &font, Clr color=CLR_BLACK, Flags< TextFormat > format=FORMAT_NONE, Flags< WndFlag > flags=Flags< WndFlag >()) | |
TextControl (X x, Y y, const std::string &str, const boost::shared_ptr< Font > &font, Clr color=CLR_BLACK, Flags< TextFormat > format=FORMAT_NONE, Flags< WndFlag > flags=Flags< WndFlag >()) | |
const std::string & | Text () const |
Flags< TextFormat > | GetTextFormat () const |
Clr | TextColor () const |
bool | ClipText () const |
bool | SetMinSize () const |
template<class T > | |
void | operator>> (T &t) const |
template<class T > | |
T | GetValue () const |
operator const std::string & () const | |
bool | Empty () const |
CPSize | Length () const |
Pt | TextUpperLeft () const |
Pt | TextLowerRight () const |
void | SetTextFormat (Flags< TextFormat > format) |
void | SetTextColor (Clr color) |
void | ClipText (bool b) |
void | SetMinSize (bool b) |
template<class T > | |
void | operator<< (T t) |
void | operator+= (const std::string &s) |
void | operator+= (char c) |
void | Clear () |
void | Insert (CPSize pos, char c) |
void | Insert (CPSize pos, const std::string &s) |
void | Erase (CPSize pos, CPSize num=CP1) |
void | Insert (std::size_t line, CPSize pos, char c) |
void | Insert (std::size_t line, CPSize pos, const std::string &s) |
void | Erase (std::size_t line, CPSize pos, CPSize num=CP1) |
virtual void | DropsAcceptable (DropsAcceptableIter first, DropsAcceptableIter last, const Pt &pt) const |
Clr | Color () const |
bool | Disabled () const |
virtual void | AcceptDrops (const std::vector< Wnd * > &wnds, const Pt &pt) |
virtual void | Disable (bool b=true) |
virtual | ~Wnd () |
bool | Interactive () const |
bool | RepeatButtonDown () const |
bool | Dragable () const |
bool | Resizable () const |
bool | OnTop () const |
bool | Modal () const |
ChildClippingMode | GetChildClippingMode () const |
bool | NonClientChild () const |
bool | Visible () const |
const std::string & | Name () const |
const std::string & | DragDropDataType () const |
Pt | UpperLeft () const |
Pt | LowerRight () const |
Pt | RelativeUpperLeft () const |
Pt | RelativeLowerRight () const |
X | Width () const |
Y | Height () const |
int | ZOrder () const |
Pt | Size () const |
Pt | MinSize () const |
Pt | MaxSize () const |
Pt | ClientSize () const |
X | ClientWidth () const |
Y | ClientHeight () const |
Pt | ScreenToWindow (const Pt &pt) const |
Pt | ScreenToClient (const Pt &pt) const |
virtual bool | InWindow (const Pt &pt) const |
virtual bool | InClient (const Pt &pt) const |
const std::list< Wnd * > & | Children () const |
Wnd * | Parent () const |
Wnd * | RootParent () const |
Layout * | GetLayout () const |
Layout * | ContainingLayout () const |
const std::vector < BrowseInfoMode > & | BrowseModes () const |
const std::string & | BrowseInfoText (std::size_t mode) const |
const boost::shared_ptr < StyleFactory > & | GetStyleFactory () const |
virtual WndRegion | WindowRegion (const Pt &pt) const |
void | SetDragDropDataType (const std::string &data_type) |
virtual void | StartingChildDragDrop (const Wnd *wnd, const Pt &offset) |
virtual void | CancellingChildDragDrop (const std::vector< const Wnd * > &wnds) |
virtual void | ChildrenDraggedAway (const std::vector< Wnd * > &wnds, const Wnd *destination) |
void | SetName (const std::string &name) |
void | Hide (bool children=true) |
void | Show (bool children=true) |
virtual void | ModalInit () |
void | SetChildClippingMode (ChildClippingMode mode) |
void | NonClientChild (bool b) |
void | MoveTo (const Pt &pt) |
void | OffsetMove (const Pt &pt) |
void | Resize (const Pt &sz) |
void | SetMinSize (const Pt &sz) |
void | SetMaxSize (const Pt &sz) |
void | AttachChild (Wnd *wnd) |
void | MoveChildUp (Wnd *wnd) |
void | MoveChildDown (Wnd *wnd) |
void | DetachChild (Wnd *wnd) |
void | DetachChildren () |
void | DeleteChild (Wnd *wnd) |
void | DeleteChildren () |
void | InstallEventFilter (Wnd *wnd) |
void | RemoveEventFilter (Wnd *wnd) |
void | HorizontalLayout () |
void | VerticalLayout () |
void | GridLayout () |
void | SetLayout (Layout *layout) |
void | RemoveLayout () |
Layout * | DetachLayout () |
void | SetLayoutBorderMargin (unsigned int margin) |
void | SetLayoutCellMargin (unsigned int margin) |
virtual bool | Run () |
void | EndRun () |
void | SetBrowseModeTime (unsigned int time, std::size_t mode=0) |
void | SetBrowseInfoWnd (const boost::shared_ptr< BrowseInfoWnd > &wnd, std::size_t mode=0) |
void | ClearBrowseInfoWnd (std::size_t mode=0) |
void | SetBrowseText (const std::string &text, std::size_t mode=0) |
void | SetBrowseModes (const std::vector< BrowseInfoMode > &modes) |
void | SetStyleFactory (const boost::shared_ptr< StyleFactory > &factory) |
GG_ABSTRACT_EXCEPTION (Exception) | |
GG_CONCRETE_EXCEPTION (BadLayout, GG::Wnd, Exception) |
Static Public Attributes | |
static const std::size_t | ALL_LINES |
static const unsigned int | BORDER_THICK |
Edit () | |
CPSize | FirstCharShown () const |
bool | RecentlyEdited () const |
CPSize | CharIndexOf (X x) const |
X | FirstCharOffset () const |
X | ScreenPosOfChar (CPSize idx) const |
CPSize | LastVisibleChar () const |
unsigned int | LastButtonDownTime () const |
bool | InDoubleButtonDownMode () const |
std::pair< CPSize, CPSize > | DoubleButtonDownCursorPos () const |
virtual void | LButtonUp (const Pt &pt, Flags< ModKey > mod_keys) |
virtual void | LClick (const Pt &pt, Flags< ModKey > mod_keys) |
virtual void | GainingFocus () |
virtual void | LosingFocus () |
std::pair< CPSize, CPSize > | GetDoubleButtonDownWordIndices (CPSize char_index) |
std::pair< CPSize, CPSize > | GetDoubleButtonDownDragWordIndices (CPSize char_index) |
void | ClearDoubleButtonDownMode () |
TextControl () | |
const std::vector < Font::LineData > & | GetLineData () const |
const boost::shared_ptr< Font > & | GetFont () const |
bool | FitToText () const |
![]() | |
virtual void | KeyRelease (Key key, boost::uint32_t key_code_point, Flags< ModKey > mod_keys) |
Control () | |
Control (X x, Y y, X w, Y h, Flags< WndFlag > flags=INTERACTIVE) | |
Wnd () | |
Wnd (X x, Y y, X w, Y h, Flags< WndFlag > flags=INTERACTIVE|DRAGABLE) | |
DragDropRenderingState | GetDragDropRenderingState () const |
virtual void | LDoubleClick (const Pt &pt, Flags< ModKey > mod_keys) |
virtual void | MButtonDown (const Pt &pt, Flags< ModKey > mod_keys) |
virtual void | MDrag (const Pt &pt, const Pt &move, Flags< ModKey > mod_keys) |
virtual void | MButtonUp (const Pt &pt, Flags< ModKey > mod_keys) |
virtual void | MClick (const Pt &pt, Flags< ModKey > mod_keys) |
virtual void | MDoubleClick (const Pt &pt, Flags< ModKey > mod_keys) |
virtual void | RButtonDown (const Pt &pt, Flags< ModKey > mod_keys) |
virtual void | RDrag (const Pt &pt, const Pt &move, Flags< ModKey > mod_keys) |
virtual void | RButtonUp (const Pt &pt, Flags< ModKey > mod_keys) |
virtual void | RClick (const Pt &pt, Flags< ModKey > mod_keys) |
virtual void | RDoubleClick (const Pt &pt, Flags< ModKey > mod_keys) |
virtual void | MouseEnter (const Pt &pt, Flags< ModKey > mod_keys) |
virtual void | MouseHere (const Pt &pt, Flags< ModKey > mod_keys) |
virtual void | MouseLeave () |
virtual void | DragDropEnter (const Pt &pt, const std::map< Wnd *, Pt > &drag_drop_wnds, Flags< ModKey > mod_keys) |
virtual void | DragDropHere (const Pt &pt, const std::map< Wnd *, Pt > &drag_drop_wnds, Flags< ModKey > mod_keys) |
virtual void | DragDropLeave () |
virtual void | TimerFiring (unsigned int ticks, Timer *timer) |
virtual bool | EventFilter (Wnd *w, const WndEvent &event) |
void | HandleEvent (const WndEvent &event) |
void | ForwardEventToParent () |
void | BeginClipping () |
void | EndClipping () |
void | BeginNonclientClipping () |
void | EndNonclientClipping () |
Static Protected Attributes | |
static const unsigned int | SCROLL_WIDTH |
![]() | |
static const int | PIXEL_MARGIN |
Structors | |
MultiEdit (X x, Y y, X w, Y h, const std::string &str, const boost::shared_ptr< Font > &font, Clr color, Flags< MultiEditStyle > style=MULTI_LINEWRAP, Clr text_color=CLR_BLACK, Clr interior=CLR_ZERO, Flags< WndFlag > flags=INTERACTIVE) | |
virtual | ~MultiEdit () |
MultiEdit () |
Accessors | |
virtual Pt | MinUsableSize () const |
virtual Pt | ClientLowerRight () const |
Flags< MultiEditStyle > | Style () const |
std::size_t | MaxLinesOfHistory () const |
virtual bool | MultiSelected () const |
X | RightMargin () const |
Y | BottomMargin () const |
std::pair< std::size_t, CPSize > | CharAt (const Pt &pt) const |
std::pair< std::size_t, CPSize > | CharAt (CPSize idx) const |
Pt | ScrollPosition () const |
CPSize | CharIndexOf (std::size_t row, CPSize char_idx, const std::vector< Font::LineData > *line_data=0) const |
X | RowStartX (std::size_t row) const |
X | CharXOffset (std::size_t row, CPSize idx) const |
std::size_t | RowAt (Y y) const |
CPSize | CharAt (std::size_t row, X x) const |
std::size_t | FirstVisibleRow () const |
std::size_t | LastVisibleRow () const |
std::size_t | FirstFullyVisibleRow () const |
std::size_t | LastFullyVisibleRow () const |
CPSize | FirstVisibleChar (std::size_t row) const |
CPSize | LastVisibleChar (std::size_t row) const |
std::pair< std::size_t, CPSize > | HighCursorPos () const |
std::pair< std::size_t, CPSize > | LowCursorPos () const |
Mutators | |
virtual void | Render () |
virtual void | SizeMove (const Pt &ul, const Pt &lr) |
virtual void | SelectAll () |
virtual void | SetText (const std::string &str) |
void | SetStyle (Flags< MultiEditStyle > style) |
void | SetMaxLinesOfHistory (std::size_t max) |
virtual void | LButtonDown (const Pt &pt, Flags< ModKey > mod_keys) |
virtual void | LDrag (const Pt &pt, const Pt &move, Flags< ModKey > mod_keys) |
virtual void | MouseWheel (const Pt &pt, int move, Flags< ModKey > mod_keys) |
virtual void | KeyPress (Key key, boost::uint32_t key_code_point, Flags< ModKey > mod_keys) |
void | RecreateScrolls () |
void | PreserveTextPositionOnNextSetText () |
Additional Inherited Members | |
typedef boost::signal< void(const std::string &)> | EditedSignalType |
typedef boost::signal< void(const std::string &)> | FocusUpdateSignalType |
EditedSignalType | EditedSignal |
FocusUpdateSignalType | FocusUpdateSignal |
This is a multi-line text input and display control.
MultiEdit is designed to be used as a basic text-input control for text longer than one line, or to display large amounts of formatted or unformatted text. MultiEdit supports text formatting tags. See GG::Font for details. Several style flags are available. If the MULTI_TERMINAL_STYLE flag is in use, lines that exceed the history limit will be removed from the beginning of the text; otherwise, they are removed from the end. If either MULTI_LINEWRAP of MULTI_WORDBREAK are in use, MULTI_NO_HSCROLL must be in use as well. MULTI_VCENTER is not an allowed style; if it is specified, MULTI_TOP will be used in its place. The justification introduced by text formatting tags is very different from that introduced by the TF_* styles. The former justifies lines within the space taken up by the text. The latter justifies the entire block of text within the client area of the control. So if you specify MULTI_LEFT and use <right> formatting tags on the entire text, the text will appear to be right-justified, but you will probably only see the extreme left of the text area without scrolling. If none of the no-scroll style flags are in use, the scrolls are created and destroyed automatically, as needed.
Definition at line 60 of file MultiEdit.h.
GG::MultiEdit::MultiEdit | ( | X | x, |
Y | y, | ||
X | w, | ||
Y | h, | ||
const std::string & | str, | ||
const boost::shared_ptr< Font > & | font, | ||
Clr | color, | ||
Flags< MultiEditStyle > | style = MULTI_LINEWRAP , |
||
Clr | text_color = CLR_BLACK , |
||
Clr | interior = CLR_ZERO , |
||
Flags< WndFlag > | flags = INTERACTIVE |
||
) |
Ctor.
|
virtual |
Dtor.
|
virtual |
Returns the size of the minimum bounding box that can enclose the Wnd and still show all of its elements, plus enough room for interaction with those elements (if applicable). For example, a TextControl's MinUsableSize() is just the area of its text, and a Scroll's MinUsableSize() is the combined sizes of its up-button, down-button, and tab (plus a bit of room in which to drag the tab).
Reimplemented from GG::Edit.
|
virtual |
Returns (one pixel past) lower-right corner of window's client area in screen coordinates (or of the entire area, if no client area is specified). Virtual because different windows have different shapes (and so ways of calculating client area).
Reimplemented from GG::Edit.
std::size_t GG::MultiEdit::MaxLinesOfHistory | ( | ) | const |
Returns the maximum number of lines of text that the control keeps. This number includes the lines that are visible in the control. A value of ALL_LINES indicates that there is no limit.
|
virtual |
Draws this Wnd. Note that Wnds being dragged for a drag-and-drop operation are rendered twice – once in-place as normal, once in the location of the drag operation, attached to the cursor. Such Wnds may wish to render themselves differently in those two cases. To determine which render is being performed, they can call GUI::GetGUI()->RenderingDragDropWnds().
Reimplemented from GG::Edit.
Resizes and/or moves window to new upper-left and lower right boundaries.
Reimplemented from GG::TextControl.
|
virtual |
Selects all text in the entire control. This function leaves the beginning of the text in view; see SelectRange().
Reimplemented from GG::Edit.
|
virtual |
Sets the text displayed in this control to str. May resize the window. If FitToText() returns true (i.e. if the second ctor was used), calls to this function cause the window to be resized to whatever space the newly rendered text occupies.
Reimplemented from GG::Edit.
void GG::MultiEdit::SetStyle | ( | Flags< MultiEditStyle > | style | ) |
Sets the style flags for this MultiEdit to style.
void GG::MultiEdit::SetMaxLinesOfHistory | ( | std::size_t | max | ) |
Sets the maximum number of rows of text that the control will keep. ALL_LINES indicates no limit.
|
protectedvirtual |
Returns true if >= 1 characters are selected.
Reimplemented from GG::Edit.
|
protected |
Returns the width of the scrollbar on the right side of the control (0 if none).
|
protected |
Returns the width of the scrollbar at the bottom of the control (0 if none).
Returns row and character index of pt, or (0, 0) if pt falls outside the text. pt is in client-space coordinates.
Returns row and character index of char at idx, or (0, 0) if idx falls outside the text, or if idx refers to a non-visible character.
|
protected |
Returns the positions of the scrollbars.
|
protected |
Returns the code point index of the start of the UTF-8 sequence for the code point at char_idx in row row, using line_data instead of the current line data, if it is supplied. If row, char_idx refers to a character preceeded by formatting tags, the index of the first character of the first formatting tag is returned instead. Not range-checked.
|
protected |
Returns the the x-coordinate of the beginning of row row, in cleint-space coordinates. Not range-checked.
Returns the distance from the start of row row to the character at index idx. Not range-checked.
|
protected |
Returns the line that falls under Y coordinate y. y must be in client-space coordinates.
Returns the index of the character in row row that falls under X coordinate x. x must be in client-space coordinates.
|
protected |
Returns the index of the first visible row, or 0 if none.
|
protected |
Returns the index of the last visible row, or 0 if none.
|
protected |
Returns the index of the first fully visible row, or 0 if none.
|
protected |
Returns the index of the last fully visible row, or 0 if none.
|
protected |
Returns the index of the first visible character of row row, or 0 if none.
|
protected |
Returns the index of the last visible character of row row, or 0 if none.
|
protected |
Returns the greater of m_cursor_begin and m_cursor_end.
|
protected |
Returns the lesser of m_cursor_begin and m_cursor_end.
|
protectedvirtual |
Respond to left button down msg. A window receives this whenever any input device button changes from up to down while over the window.
Reimplemented from GG::Edit.
|
protectedvirtual |
Respond to left button drag msg (even if this Wnd is not dragable). Drag messages are only sent to the window over which the button was pressed at the beginning of the drag. A window receives this whenever any input device button is down and the cursor is moving while over the window. The window will also receive drag messages when the mouse is being dragged outside the window's area.
Reimplemented from GG::Edit.
|
protectedvirtual |
Respond to movement of the mouse wheel (move > 0 indicates the wheel is rolled up, < 0 indicates down)
Reimplemented from GG::Control.
|
protectedvirtual |
Respond to down-keystrokes (focus window only). A window may receive KeyPress() messages passed up to it from its children. For instance, Control-derived classes pass KeyPress() messages to their Parent() windows by default.
Reimplemented from GG::Edit.
|
protected |
Recreates the vertical and horizontal scrolls as needed.
|
protected |
Ensures that the next call to SetText() preserves the positioning of the text. This should only be called if it is known that the call to SetText() will not put the text-position in an illegal state. For instance, if creating a MultiEdit that contains hyperlink text then coloring or underlining a link may require a call to SetText(), but may be guaranteed not to change the text layout. Without a call to this function, the scroll positions will be reset.
|
static |
A sentinel value that indicates that there is no limit on the number of lines of history are to be stored.
Definition at line 105 of file MultiEdit.h.
|
static |
The thickness with which to render the border of the control.
Definition at line 108 of file MultiEdit.h.
|
staticprotected |
The width used to create the control's vertical and horizontal Scrolls.
Definition at line 212 of file MultiEdit.h.