GG
|
#include <Wnd.h>
Classes | |
struct | BrowseInfoMode |
Public Types | |
enum | ChildClippingMode { DontClip, ClipToClient, ClipToWindow, ClipToClientAndWindowSeparately } |
typedef std::map< const Wnd *, bool >::iterator | DropsAcceptableIter |
Static Public Member Functions | |
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) |
Protected Types | |
enum | DragDropRenderingState { NOT_DRAGGED, IN_PLACE_COPY, DRAGGED_OVER_UNACCEPTING_DROP_TARGET, DRAGGED_OVER_ACCEPTING_DROP_TARGET } |
Protected Attributes | |
bool | m_done |
Friends | |
class | GUI |
class | Timer |
class | ZList |
Structors | |
virtual | ~Wnd () |
Wnd () | |
Wnd (X x, Y y, X w, Y h, Flags< WndFlag > flags=INTERACTIVE|DRAGABLE) | |
Accessors | |
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 |
virtual void | DropsAcceptable (DropsAcceptableIter first, DropsAcceptableIter last, const Pt &pt) 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 |
virtual Pt | MinUsableSize () const |
virtual Pt | ClientUpperLeft () const |
virtual Pt | ClientLowerRight () 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 |
DragDropRenderingState | GetDragDropRenderingState () const |
Mutators | |
void | SetDragDropDataType (const std::string &data_type) |
virtual void | StartingChildDragDrop (const Wnd *wnd, const Pt &offset) |
virtual void | AcceptDrops (const std::vector< Wnd * > &wnds, const Pt &pt) |
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) |
virtual void | SizeMove (const Pt &ul, const Pt &lr) |
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 void | Render () |
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) |
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 | 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 | MouseWheel (const Pt &pt, int move, Flags< ModKey > mod_keys) |
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 | KeyPress (Key key, boost::uint32_t key_code_point, Flags< ModKey > mod_keys) |
virtual void | KeyRelease (Key key, boost::uint32_t key_code_point, Flags< ModKey > mod_keys) |
virtual void | GainingFocus () |
virtual void | LosingFocus () |
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 () |
Exceptions | |
GG_ABSTRACT_EXCEPTION (Exception) | |
GG_CONCRETE_EXCEPTION (BadLayout, GG::Wnd, Exception) | |
This is the basic GG window class.
The coordinates of Wnd boundaries are STL-style (as are most range-values throughout GG), meaning that LowerRight() denotes the "last +
1" pixel of a Wnd. The on-screen representation of a rectangular Wnd covers the pixels from UpperLeft() to LowerRight() - Pt(X1,Y 1), not UpperLeft() to LowerRight(). Each Wnd has a client area from ClientUpperLeft() to ClientLowerRight(). These two methods are virtual, and may return anything the user likes; the default implementation is to return UpperLeft() and LowerRight(), respectively, meaning that the client area is the entire window.
It is assumed that child windows exists within the boundaries of their parents, although this is not required. By default, Wnds do not clip their children; child clipping can be turned on or off using SetChildClippingMode(), which clips all children to the client and/or non-client areas of the Wnd. Subclasses can override BeginClippingImpl(), EndClippingImpl(), BeginNonclientClippingImpl(), and EndNonclientClippingImpl() if the clipping should be done using techniques other than scissor clipping and stencil testing, or if the Wnd is nonrectangular. Regardless of clipping, all clicks that land on a child but outside of the parent will not reach the child, since clicks are detected by seaching the top-level Wnds and then searching the children within the ones that are hit. Ideally, "sibling" child windows should not overlap (unless they can without interfering). If this is impossible or undesirable, and control is needed over the order in which children are layered, MoveChildUp() and MoveChildDown() provide such control.
Resizable() windows are able to be stretched by the user by dragging the areas of the window outside the client area. So the RESIZABLE flag will have no effect on a window that does not have non-default ClientUpperLeft() and/or ClientLowerRight(). The WindowRegion() method can also be overidden in derived classes, and can return regions that are appropriate to nonrectangular windows, or those whose client area must cover the entire window.
OnTop() windows are drawn after all others (except Modal() ones), to ensure that they remain on top. This means that other non-OnTop() windows that are moved to the top of the z-order stop at some z-value below the lowest OnTop() window in the z-order. On-topness is useful for modeless dialog boxes, among other things.
Modal() windows are available (by setting the MODAL window creation flag), and are also always-on-top, but are handled differently and do not have ONTOP specified in their creation flags. Modal windows are executed by calling Run(), which registers them as modal windows and starts the local execution of the GUI's event pump. Execution of the code that calls Run() is effectively halted until Run() returns. Derived classes that wish to use modal execution should set m_done = true to escape from the modal execution loop. EventPump has more information about processing during modal dialog execution.
Note that OnTop() and Modal() flags only apply to top-level (Parent()-less) Wnds.
Wnd inherits from boost::signals::trackable. This means that any slots contained in a Wnd object or Wnd-derived object will automatically be disconnected from any connected signals when the Wnd is destroyed. Every Wnd responds to input as driven by the singleton GUI object.
Every Wnd can also have its incoming WndEvents filtered by an arbitrary number of other Wnds. Each such Wnd in a Wnd's "filter chain" gets an opportunity, one at a time, to process an incoming WndEvent, or pass it on to the next filter in the chain. If all EventFilter() calls in the chain return false, the filtered Wnd then gets the chance to process the WndEvent as normal. Filter Wnds are traversed in reverse order that they are installed, and no filter Wnd can be in a filter chain more than once. Installing the same filter Wnd more than once removes the Wnd from the filter chain and re-adds it to the beginning of the chain. Note that the default implementation of EventFilter() is to return false and do nothing else, so installing a Wnd-derived type with no overridden EventFilter() in a filter Wnd will have no effect. Also note that just as it is legal for keyboard accelerator slots to do nontrivial work and still return false (causing a keystroke event to be generated), EventFilter() may return false even when it does nontrivial work, and the next filter in the chain will also get a chance to process the WndEvent. It is even possible to have an arbitrary number of filters that all do processing on an WndEvent, and finally let the filtered Wnd do its normal WndEvent processing.
Layouts arrange children in the client area of a window, and can be assigned to a window in 4 ways. HorizontalLayout(), VerticalLayout(), and GridLayout() all arrange the window's client-area children automatically, and take ownership of them as their own children, becoming the window's only client-area child. Any existing layout is removed first. SetLayout() allows you to attach a pre-configured Layout object directly, without automatically arranging the window's client-area children. Because SetLayout() does no auto-arrangement, it does not know how to place any client-area children the window may have at the time it is called; for this reason, it not only removes any previous layout, but deletes all current client-area children as well. Therefore, SetLayout() should usually only be called before any client-area children are attached to a window; all client-area children should be attached directly to the layout.
When a window has an attached layout and is resized, it resizes its layout automatically. Further, if a window is part of a layout, it notifies its containing layout whenever it is moved, resized, or has its MinSize() changed. This ensures that layouts are always current. Note the use of the phrase "client-area children". This refers to children entirely within the client area of the window.
Browse info is a non-interactive informational window that pops up after the user keeps the mouse over the Wnd for a certain period of time. This can reproduce "tooltip"-like functionality, but is not limited to displaying only text. An arbitrary BrowseInfoWnd-derived window can be displayed. There can be multiple browse info modes, numbered 0 through N - 1. Each mode has a time associated with it, and after the associated time has elapsed, that mode is entered. This is intended to allow different levels of detail to be shown for different lengths of mouse presence. For instance, hovering over a Wnd for 1 second might produce a box that says "FooWnd", but leaving it there a total of 2 seconds might produce a box that says "FooWnd: currently doing nothing". When the mouse leaves the Wnd, a click occurs, etc., the Wnd reverts to browse mode -1, indicating that no browse info should be displayed. By default, every Wnd has a single browse info mode at time DefaultBrowseTime(), using the DefaultBrowseInfoWnd(), with no associated text. Note that DefaultBrowseInfoWnd() returns a null window unless it is set by the user. As this implies, it is legal to have no BrowseInfoWnd associated with a browse mode, in which case nothing is shown. Also note that it is legal to have no text associated with a browse mode.
A StyleFactory is responsible for creating controls and dialogs that other Wnds may need (e.g. when Slider needs to create a Button for its sliding tab). There is an GUI-wide StyleFactory available, but for complete customization, each Wnd may have one installed as well. The GetStyleFactory() method returns the one installed in the Wnd, if one exists, or the GUI-wide one otherwise.
typedef std::map<const Wnd*, bool>::iterator GG::Wnd::DropsAcceptableIter |
The type of the iterator parameters passed to DropsAcceptable().
The modes of child clipping.
Enumerator | |
---|---|
DontClip |
No child clipping is performed. |
ClipToClient |
Children or parts of children that fall outside the client area are not visible. |
ClipToWindow |
Children or parts of children that fall outside the window's area are not visible. |
ClipToClientAndWindowSeparately |
Acts as ClipToClient on children whose NonClientChild() member returns false. For a child C whose NonClientChild() returns true, any part of C that is inside the client area or outside the window's area is not visible. This mode is useful for Wnds that have client contents that should be clipped, but that also have nonclient children (e.g. minimize/maximize/close buttons). |
|
protected |
The states a Wnd may be in, with respect to drag-and-drop operations. Wnds may wish to consider the current state when rendering to provide visual feedback to the user.
Enumerator | |
---|---|
NOT_DRAGGED |
No drag-and-drop is taking place at all with this Wnd. |
IN_PLACE_COPY |
This Wnd is being dragged-and-dropped, but we're currently rendering the unmoving copy. The dragged copy is rendered at another time. |
DRAGGED_OVER_UNACCEPTING_DROP_TARGET |
This Wnd is being dragged-and-dropped, and it is currently over a drop target that will not accept it. |
DRAGGED_OVER_ACCEPTING_DROP_TARGET |
This Wnd is being dragged-and-dropped, and it is currently over a drop target that will accept it. |
Ctor that allows a size and position to be specified, as well as creation flags.
bool GG::Wnd::Interactive | ( | ) | const |
Returns true iff a click over this window does not pass through. Note that this also determines whether a mouse-over will detect this window or the ones under it.
bool GG::Wnd::RepeatButtonDown | ( | ) | const |
Returns true iff holding a mouse button down over this Wnd generates multiple button-down messages.
bool GG::Wnd::Dragable | ( | ) | const |
Returns true iff this Wnd be dragged by the user.
bool GG::Wnd::Resizable | ( | ) | const |
Returns true iff this Wnd can be resized by the user.
ChildClippingMode GG::Wnd::GetChildClippingMode | ( | ) | const |
Returns the mode to use for child clipping.
bool GG::Wnd::NonClientChild | ( | ) | const |
Returns true iff this Wnd should be considered a non-client-area child of its parent, for clipping purposes.
bool GG::Wnd::Visible | ( | ) | const |
Returns true iff this Wnd will be rendered if it is registered.
const std::string& GG::Wnd::Name | ( | ) | const |
const std::string& GG::Wnd::DragDropDataType | ( | ) | const |
|
virtual |
Sets the second member of each iterator to true or false, indicating whether the Wnd in the first member would be accepted if dropped on this Wnd at pt.
Reimplemented in GG::ListBox, and GG::Control.
Pt GG::Wnd::UpperLeft | ( | ) | const |
Returns the upper-left corner of window in screen coordinates (taking into account parent's screen position, if any)
Pt GG::Wnd::LowerRight | ( | ) | const |
Returns (one pixel past) the lower-right corner of window in screen coordinates (taking into account parent's screen position, if any)
Pt GG::Wnd::RelativeUpperLeft | ( | ) | const |
Returns the upper-left corner of window, relative to its parent's client area, or in screen coordinates if no parent exists.
Pt GG::Wnd::RelativeLowerRight | ( | ) | const |
Returns (one pixel past) the lower-right corner of window, relative to its parent's client area, or in screen coordinates if no parent exists.
int GG::Wnd::ZOrder | ( | ) | const |
Returns the position of this window in the z-order (root (non-child) windows only).
|
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 in GG::ListBox, GG::TabBar, GG::RadioButtonGroup, GG::StateButton, GG::TabWnd, GG::MenuBar, GG::Layout, GG::Spin< T >, GG::TextControl, GG::Edit, GG::Scroll, GG::MultiEdit, GG::Slider< T >, GG::Slider< int >, and GG::OverlayWnd.
|
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 in GG::ListBox, GG::PopupMenu, GG::DropDownList, GG::Edit, and GG::GroupBox.
|
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 in GG::ListBox, GG::DropDownList, GG::Edit, GG::MultiEdit, and GG::GroupBox.
Returns pt translated from screen- to window-coordinates.
Returns pt translated from screen- to client-coordinates.
|
virtual |
Returns true if screen-coordinate point pt falls within the window.
|
virtual |
Returns true if screen-coordinate point pt falls within the window's client area.
const std::list<Wnd*>& GG::Wnd::Children | ( | ) | const |
Returns child list; the list is const, but the children may be manipulated.
Wnd* GG::Wnd::Parent | ( | ) | const |
Returns the window's parent (may be null).
Wnd* GG::Wnd::RootParent | ( | ) | const |
Returns the earliest ancestor window (may be null).
Layout* GG::Wnd::GetLayout | ( | ) | const |
Returns the layout for the window, if any.
Layout* GG::Wnd::ContainingLayout | ( | ) | const |
Returns the layout containing the window, if any.
const std::vector<BrowseInfoMode>& GG::Wnd::BrowseModes | ( | ) | const |
Returns the browse modes for the Wnd, including time cutoffs (in milliseconds), the BrowseInfoWnds to be displayed for each browse info mode, and the text (if any) to be displayed in each mode. As the time that the cursor is over this Wnd exceeds each mode's time, the corresponding Wnd is shown superimposed over this Wnd and its children. Set the first time cutoff to 0 for immediate browse info display.
const std::string& GG::Wnd::BrowseInfoText | ( | std::size_t | mode | ) | const |
Returns the text to display for browse info mode mode.
std::out_of_range | May throw std::out_of_range if mode is not a valid browse mode. |
const boost::shared_ptr<StyleFactory>& GG::Wnd::GetStyleFactory | ( | ) | const |
Returns the currently-installed style factory if none exists, or the GUI-wide one otherwise.
Returns the region under point pt.
void GG::Wnd::SetDragDropDataType | ( | const std::string & | data_type | ) |
Indicates to the Wnd that a child Wnd wnd is being dragged in a drag-and-drop operation, which gives it the opportunity to add other associated drag-and-drop Wnds (see GUI::RegisterDragDropWnd()). offset indicates the position of the mouse relative to wnd's UpperLeft().
Reimplemented in GG::ListBox, and GG::Layout.
When the user drops Wnds onto this Wnd, DropsAcceptable() is passed the list of dropped Wnds. The Wnds marked acceptable by DropsAcceptable() are then passed to AcceptDrops(), which handles the receipt of one or more drag-and-drop wnds into this Wnd.
Reimplemented in GG::ListBox, and GG::Control.
|
virtual |
Handles the cancellation of the dragging of one or more child windows, whose dragging was established by the most recent call to StartingChildDragDrop(). Note that even if an accepting Wnd accepts some but not all Wnds via DropsAcceptable(), this function will be called on those Wnds not accepted.
Reimplemented in GG::Layout.
|
virtual |
Handles the removal of one or more child windows that have been dropped onto another window which has accepted them as drops via DropsAcceptable(). The accepting window retains ownership, so this function must not delete the children.
Reimplemented in GG::ListBox, and GG::Layout.
void GG::Wnd::SetName | ( | const std::string & | name | ) |
void GG::Wnd::Hide | ( | bool | children = true | ) |
Suppresses rendering of this window (and possibly its children) during render loop.
void GG::Wnd::Show | ( | bool | children = true | ) |
Enables rendering of this window (and possibly its children) during render loop.
|
virtual |
Called during Run(), after a modal window is registered, this is the place that subclasses should put specialized modal window initialization, such as setting focus to child controls.
void GG::Wnd::SetChildClippingMode | ( | ChildClippingMode | mode | ) |
Sets the mode to use for child clipping.
void GG::Wnd::NonClientChild | ( | bool | b | ) |
Sets whether this Wnd should be considered a non-client-area child of its parent, for clipping purposes.
Resizes and/or moves window to new upper-left and lower right boundaries.
Reimplemented in GG::ListBox, GG::TabBar, GG::StateButton, GG::TextControl, GG::MenuBar, GG::Layout, GG::DropDownList, GG::Spin< T >, GG::Scroll, GG::Slider< T >, GG::Slider< int >, and GG::MultiEdit.
Referenced by GG::Slider< T >::SizeMove(), and GG::Spin< T >::SizeMove().
void GG::Wnd::Resize | ( | const Pt & | sz | ) |
Resizes window without moving upper-left corner.
void GG::Wnd::SetMinSize | ( | const Pt & | sz | ) |
Sets the minimum allowable size of window pt.
void GG::Wnd::SetMaxSize | ( | const Pt & | sz | ) |
Sets the maximum allowable size of window pt.
void GG::Wnd::AttachChild | ( | Wnd * | wnd | ) |
Places wnd in child ptr list, sets's child's m_parent member to this.
void GG::Wnd::MoveChildUp | ( | Wnd * | wnd | ) |
Places wnd at the end of the child ptr list, so it is rendered last (on top of the other children).
void GG::Wnd::MoveChildDown | ( | Wnd * | wnd | ) |
Places wnd at the beginning of the child ptr list, so it is rendered first (below the other children).
void GG::Wnd::DetachChild | ( | Wnd * | wnd | ) |
Removes wnd from child ptr list, sets child's m_parent = 0.
void GG::Wnd::DetachChildren | ( | ) |
Removes all Wnds from child ptr list, sets childrens' m_parent = 0.
void GG::Wnd::DeleteChild | ( | Wnd * | wnd | ) |
Removes, detaches, and deletes wnd; does nothing if wnd is not in the child list.
void GG::Wnd::DeleteChildren | ( | ) |
Removes, detaches, and deletes all Wnds in the child list.
void GG::Wnd::InstallEventFilter | ( | Wnd * | wnd | ) |
Adds wnd to the front of the event filtering chain.
void GG::Wnd::RemoveEventFilter | ( | Wnd * | wnd | ) |
Removes wnd from the filter chain.
void GG::Wnd::HorizontalLayout | ( | ) |
Places the window's client-area children in a horizontal layout, handing ownership of the window's client-area children over to the layout. Removes any current layout which may exist.
void GG::Wnd::VerticalLayout | ( | ) |
Places the window's client-area children in a vertical layout, handing ownership of the window's client-area children over to the layout. Removes any current layout which may exist.
void GG::Wnd::GridLayout | ( | ) |
Places the window's client-area children in a grid layout, handing ownership of the window's client-area children over to the layout. Removes any current layout which may exist.
void GG::Wnd::SetLayout | ( | Layout * | layout | ) |
Sets layout as the layout for the window. Removes any current layout which may exist, and deletes all client-area child windows.
void GG::Wnd::RemoveLayout | ( | ) |
Removes the window's layout, handing ownership of all its children back to the window, with the sizes and positions they had before the layout resized them. If no layout exists for the window, no action is taken.
Layout* GG::Wnd::DetachLayout | ( | ) |
Removes the window's layout, including all attached children, and returns it. If no layout exists for the window, no action is taken.
void GG::Wnd::SetLayoutBorderMargin | ( | unsigned int | margin | ) |
Sets the margin that should exist between the outer edges of the windows in the layout and the edge of the client area. If no layout exists for the window, this has no effect.
void GG::Wnd::SetLayoutCellMargin | ( | unsigned int | margin | ) |
Sets the margin that should exist between the windows in the layout. If no layout exists for the window, this has no effect.
|
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 in GG::ListBox, GG::RadioButtonGroup, GG::PopupMenu, GG::TabBar, GG::ColorDlg, GG::ColorDlg::ColorDisplay, GG::ListBox::Row, GG::StateButton, GG::MenuBar, GG::TextControl, GG::Layout, GG::TextBoxBrowseInfoWnd, GG::DynamicGraphic, GG::DropDownList, GG::Spin< T >, GG::ValuePicker, GG::FileDlg, GG::Edit, GG::Slider< T >, GG::Slider< int >, GG::Scroll, GG::MultiEdit, GG::ThreeButtonDlg, GG::Button, GG::StaticGraphic, GG::HueSaturationPicker, GG::BrowseInfoWnd, GG::Control, and GG::GroupBox.
|
virtual |
This executes a modal window and gives it its modality. For non-modal windows, this function is a no-op. It returns false if the window is non-modal, or true after successful modal execution.
Reimplemented in GG::PopupMenu.
void GG::Wnd::EndRun | ( | ) |
Ends the current execution of Run(), if any.
void GG::Wnd::SetBrowseModeTime | ( | unsigned int | time, |
std::size_t | mode = 0 |
||
) |
Sets the time cutoff (in milliseconds) for a browse info mode. If mode is not less than the current number of modes, extra modes will be created as needed. The extra nodes will be set to the value of the last time at the time the method is called, or time if there were initially no modes.
void GG::Wnd::SetBrowseInfoWnd | ( | const boost::shared_ptr< BrowseInfoWnd > & | wnd, |
std::size_t | mode = 0 |
||
) |
void GG::Wnd::ClearBrowseInfoWnd | ( | std::size_t | mode = 0 | ) |
void GG::Wnd::SetBrowseText | ( | const std::string & | text, |
std::size_t | mode = 0 |
||
) |
Sets the browse info window for mode mode to a Wnd with the specified color and border color which contains the specified text.
std::out_of_range | May throw std::out_of_range if mode is not a valid browse mode. |
void GG::Wnd::SetBrowseModes | ( | const std::vector< BrowseInfoMode > & | modes | ) |
Sets the browse modes for the Wnd, including time cutoffs (in milliseconds), the BrowseInfoWnds to be displayed for each browse info mode, and the text (if any) to be displayed in each mode. As the time that the cursor is over this Wnd exceeds each mode's time, the corresponding Wnd is shown superimposed over this Wnd and its children. Set the first time cutoff to 0 for immediate browse info display.
void GG::Wnd::SetStyleFactory | ( | const boost::shared_ptr< StyleFactory > & | factory | ) |
Sets the currently-installed style factory.
|
static |
Returns the single time to place in the browse modes during Wnd construction.
|
static |
Sets the single time to place in the browse modes during Wnd construction.
|
static |
Returns the single BrowseInfoWnd to place in the browse modes during Wnd construction. This returns a TextBoxBrowseInfoWnd with a default parameterization.
|
static |
Sets the single BrowseInfoWnd to place in the browse modes during Wnd construction.
GG::Wnd::GG_ABSTRACT_EXCEPTION | ( | Exception | ) |
The base class for Wnd exceptions.
GG::Wnd::GG_CONCRETE_EXCEPTION | ( | BadLayout | , |
GG::Wnd | , | ||
Exception | |||
) |
Thrown when a request to perform a layout fails due to child Wnds in illegal starting positions, or when a SetLayout() call would result in an illegal state.
|
protected |
Returns the states the Wnd is in, with respect to drag-and-drop operations. Wnds may wish to consider the current state when rendering to provide visual feedback to the user.
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 in GG::MultiEdit, GG::Edit, GG::MenuBar, GG::Scroll, GG::ValuePicker, GG::Button, and GG::HueSaturationPicker.
|
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 in GG::PopupMenu, GG::MultiEdit, GG::Edit, GG::ValuePicker, GG::Button, and GG::HueSaturationPicker.
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 in GG::PopupMenu, GG::Edit, GG::Scroll, and GG::Button.
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 in GG::PopupMenu, GG::StateButton, GG::Edit, GG::DropDownList, GG::Scroll, GG::Slider< T >, GG::Slider< int >, and GG::Button.
Respond to second left click in window within the time limit. A window will receive an LDoubleClick() message instead of an LButtonDown() or LClick() message if the left input device button is pressed over a window that was l-clicked within a double-click time interval. Note that this means a double click is always preceded by a click. For a double click to occur, no other window may have received a *Click() or *ButtonDown() message in during the interval.
Respond to middle button down msg.
Respond to release of middle mouse button outside this Wnd, if it was originally depressed over this Wnd.
Respond to second middle click in window within the time limit.
Respond to right button down msg.
Respond to release of right mouse button outside this Wnd, if it was originally depressed over this Wnd.
Reimplemented in GG::PopupMenu.
Respond to release of right mouse button over this Wnd, if it was also originally depressed over this Wnd.
Reimplemented in GG::PopupMenu.
Respond to second right click in window within the time limit.
Respond to cursor entering window's coords.
Respond to cursor moving about within the Wnd, or to cursor lingering within the Wnd for a long period of time. A MouseHere() message will not be generated the first time the cursor enters the window's area. In that case, a MouseEnter() message is generated.
Reimplemented in GG::PopupMenu, GG::MenuBar, GG::Scroll, and GG::Button.
|
protectedvirtual |
Respond to cursor leaving window's coords.
Reimplemented in GG::MenuBar, and GG::Button.
|
protectedvirtual |
Respond to movement of the mouse wheel (move > 0 indicates the wheel is rolled up, < 0 indicates down)
Reimplemented in GG::ListBox, GG::Layout, GG::MultiEdit, GG::Spin< T >, and GG::Control.
|
protectedvirtual |
Respond to the cursor entering the Wnd's coords while dragging drag-and-drop Wnds. The Pts in drag_drop_wnds are the Wnds' offsets from pt.
Reimplemented in GG::ListBox.
|
protectedvirtual |
Respond to cursor moving about within the Wnd, or to cursor lingering within the Wnd for a long period of time, while dragging drag-and-drop Wnds. A DragDropHere() message will not be generated the first time the cursor enters the window's area. In that case, a DragDropEnter() message is generated The Pts in drag_drop_wnds are the Wnds' offsets from pt.
Reimplemented in GG::ListBox.
|
protectedvirtual |
Respond to cursor leaving the Wnd's bounds while dragging drag-and-drop Wnds.
Reimplemented in GG::ListBox.
|
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 in GG::ListBox, GG::ColorDlg, GG::Layout, GG::MultiEdit, GG::Edit, GG::DropDownList, GG::Spin< T >, GG::Slider< T >, GG::Slider< int >, GG::FileDlg, GG::ThreeButtonDlg, and GG::Control.
|
protectedvirtual |
Respond to up-keystrokes (focus window only). A window may receive KeyRelease() messages passed up to it from its children. For instance, Control-derived classes pass KeyRelease() messages to their Parent() windows by default.
Reimplemented in GG::Layout, and GG::Control.
|
protectedvirtual |
Respond to this window gaining the input focus.
Reimplemented in GG::Edit.
|
protectedvirtual |
Respond to this window losing the input focus.
Reimplemented in GG::Edit.
|
protectedvirtual |
Respond to Timer timer firing at time ticks.
Reimplemented in GG::ListBox.
Handles an WndEvent destined for Wnd w, but which this Wnd is allowed to handle first. Returns true if this filter processed the message.
Reimplemented in GG::ListBox, GG::TabBar, GG::Spin< T >, GG::Scroll, GG::Slider< T >, and GG::Slider< int >.
|
protected |
Handles all messages, and calls appropriate function (LButtonDown(), LDrag(), etc.).
|
protected |
|
protected |
Sets up child clipping for this window.
|
protected |
Restores state to what it was before BeginClipping() was called.
|
protected |
Sets up non-client-area-only child clipping for this window.
|
protected |
Restores state to what it was before BeginNonclientClipping() was called.
|
protected |