GG
|
#include <Edit.h>
Static Protected Attributes | |
static const int | PIXEL_MARGIN |
Signal Types | |
typedef boost::signal< void(const std::string &)> | EditedSignalType |
typedef boost::signal< void(const std::string &)> | FocusUpdateSignalType |
Structors | |
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) | |
Edit () | |
Accessors | |
EditedSignalType | EditedSignal |
FocusUpdateSignalType | FocusUpdateSignal |
virtual Pt | MinUsableSize () const |
virtual Pt | ClientUpperLeft () const |
virtual Pt | ClientLowerRight () const |
const std::pair< CPSize, CPSize > & | CursorPosn () const |
Clr | InteriorColor () const |
Clr | HiliteColor () const |
Clr | SelectedTextColor () const |
virtual bool | MultiSelected () const |
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 |
Mutators | |
virtual void | Render () |
virtual void | SetColor (Clr c) |
void | SetInteriorColor (Clr c) |
void | SetHiliteColor (Clr c) |
void | SetSelectedTextColor (Clr c) |
virtual void | SelectRange (CPSize from, CPSize to) |
virtual void | SelectAll () |
virtual void | SetText (const std::string &str) |
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 | LButtonUp (const Pt &pt, Flags< ModKey > mod_keys) |
virtual void | LClick (const Pt &pt, Flags< ModKey > mod_keys) |
virtual void | KeyPress (Key key, boost::uint32_t key_code_point, 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 () |
Additional Inherited Members | |
![]() | |
enum | ChildClippingMode { DontClip, ClipToClient, ClipToWindow, ClipToClientAndWindowSeparately } |
typedef std::map< const Wnd *, bool >::iterator | DropsAcceptableIter |
![]() | |
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 |
virtual void | SizeMove (const Pt &ul, const Pt &lr) |
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 unsigned int | DefaultBrowseTime () |
static void | SetDefaultBrowseTime (unsigned int time) |
static const boost::shared_ptr < BrowseInfoWnd > & | DefaultBrowseInfoWnd () |
static void | SetDefaultBrowseInfoWnd (const boost::shared_ptr< BrowseInfoWnd > &browse_info_wnd) |
![]() | |
enum | DragDropRenderingState { NOT_DRAGGED, IN_PLACE_COPY, DRAGGED_OVER_UNACCEPTING_DROP_TARGET, DRAGGED_OVER_ACCEPTING_DROP_TARGET } |
![]() | |
TextControl () | |
const std::vector < Font::LineData > & | GetLineData () const |
const boost::shared_ptr< Font > & | GetFont () const |
bool | FitToText () const |
![]() | |
virtual void | MouseWheel (const Pt &pt, int move, Flags< ModKey > mod_keys) |
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) | |
![]() | |
Clr | m_color |
bool | m_disabled |
This is a single-line edit box control.
Note that the constructor determines the height of the control based on the height of the font used and the value of the constant PIXEL_MARGIN. There are two types of signals emitted by an Edit control. The first is EditedSignal; this is emitted every time the contents of the Edit change. Sometimes, however, you don't want that. For instance, say you want to keep the value of the text in the Edit to between (numerical values) 100 and 300. If the Edit currently reads "200", the user may decide to highlight the "2", hit delete, then type a "1". If updates are immediate, you will receive notification that the Edit says "00" (an invalid value), when that is just a temporary value you don't care about. In such situations, the other signal, FocusUpdateSignal, should be useful. It is only emitted when the Edit has changed and is losing focus, or one of enter or return is pressed. So you would only receive a single update, namely "100", which is a valid number for that control, and you would receive it only when it is certain that the user is finished editing the text (when the focus changes). Note that both signals may be used at the same time, if desired.
typedef boost::signal<void (const std::string&)> GG::Edit::EditedSignalType |
typedef boost::signal<void (const std::string&)> GG::Edit::FocusUpdateSignalType |
GG::Edit::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 |
||
) |
Ctor. Height is determined from the font and point size used.
|
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::TextControl.
Reimplemented in GG::MultiEdit.
|
virtual |
Returns upper-left 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::Wnd.
|
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::Wnd.
Reimplemented in GG::MultiEdit.
Returns the current position of the cursor (first selected character to one past the last selected one).
Clr GG::Edit::InteriorColor | ( | ) | const |
Returns the color used to render the iterior of the control.
Clr GG::Edit::HiliteColor | ( | ) | const |
Returns the color used to render hiliting around selected text.
Clr GG::Edit::SelectedTextColor | ( | ) | const |
Returns the color used to render selected text.
|
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::TextControl.
Reimplemented in GG::MultiEdit.
|
virtual |
Just like Control::SetColor(), except that this one also adjusts the text color.
Reimplemented from GG::TextControl.
void GG::Edit::SetInteriorColor | ( | Clr | c | ) |
Sets the interior color of the control.
void GG::Edit::SetHiliteColor | ( | Clr | c | ) |
Sets the color used to render hiliting around selected text.
void GG::Edit::SetSelectedTextColor | ( | Clr | c | ) |
Sets the color used to render selected text.
Selects all text in the given range. When from == to, this function just places the caret at from. Note that it is legal to pass values such that to < from. The difference is that from < to simulates a drag-selection from left to right, and to < from simulates one from right to left. The direction of the simulated drag affects which part of the text is visible at the end of the function call.
|
virtual |
Selects all text in the entire control. This function leaves the beginning of the text in view; see SelectRange().
Reimplemented in GG::MultiEdit.
|
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::TextControl.
Reimplemented in GG::MultiEdit.
|
protectedvirtual |
Returns true if >= 1 characters selected.
Reimplemented in GG::MultiEdit.
|
protected |
Returns the index of the first character visible in the Edit.
|
protected |
Returns true iff the contents have been changed since the last time the focus was gained.
Returns the index of the code point x pixels from left edge of visible portion of string.
|
protected |
Returns the distance from the beginning of the string to just before the first visible character.
Returns the screen x-coordinate of the left side of the code point at index idx.
|
protected |
Returns the last visible char (not one past the last visible char).
|
protected |
Returns the value of GUI::Ticks() at the last left button press.
|
protected |
Returns true iff the button is still down after being pressed twice within GUI::DoubleClickInterval() ticks.
Returns the cursor position at the time of the most recent double-button-down.
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::Wnd.
Reimplemented in GG::MultiEdit.
|
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::Wnd.
Reimplemented in GG::MultiEdit.
Respond to release of left mouse button outside this Wnd, if it was originally depressed over this Wnd. A Wnd will receive an LButtonUp() message whenever a drag that started over its area ends, even if the cursor is not currently over the window when this happens.
Reimplemented from GG::Wnd.
Respond to release of left mouse button over this Wnd, if it was also originally depressed over this Wnd. A Wnd will receive an LButtonUp() message whenever a drag that started over its area ends over its area as well.
Reimplemented from GG::Wnd.
|
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::Control.
Reimplemented in GG::MultiEdit.
|
protectedvirtual |
Respond to this window gaining the input focus.
Reimplemented from GG::Wnd.
|
protectedvirtual |
Respond to this window losing the input focus.
Reimplemented from GG::Wnd.
Does a bit more than its name suggests. Records the current time, and if it's within GUI::DoubleClickInterval() of the last button down time, returns the code point indices that delimit the word around index char_index. If not within the time limit, or if no such word exists, the returned range will be empty (its .first and .second members will be equal). This function should be called in LButtonDown() overrides.
|
protected |
Returns the code point indices that delimit the word around index char_index. If no such word exists, the returned range will be empty (its .first and .second members will be equal). This function should be called in LDrag() overrides when InDoubleButtonDownMode() is true.
|
protected |
Sets the value of InDoubleButtonDownMode() to false. This should be called in LClick() and LButtonUp() overrides.
|
mutable |
|
mutable |
|
staticprotected |