00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include "CEGUIWindow.h"
00027 #include "CEGUIExceptions.h"
00028 #include "CEGUIWindowManager.h"
00029 #include "CEGUISystem.h"
00030 #include "CEGUIFontManager.h"
00031 #include "CEGUIImagesetManager.h"
00032 #include "CEGUIImageset.h"
00033 #include "CEGUIMouseCursor.h"
00034 #include "elements/CEGUITooltip.h"
00035 #include "falagard/CEGUIFalWidgetLookManager.h"
00036 #include "falagard/CEGUIFalWidgetLookFeel.h"
00037 #include <algorithm>
00038 #include <cmath>
00039 #include <stdio.h>
00040
00041
00042 namespace CEGUI
00043 {
00044 const String Window::EventNamespace("Window");
00045
00046
00047
00048
00049 WindowProperties::AbsoluteHeight Window::d_absHeightProperty;
00050 WindowProperties::AbsoluteMaxSize Window::d_absMaxSizeProperty;
00051 WindowProperties::AbsoluteMinSize Window::d_absMinSizeProperty;
00052 WindowProperties::AbsolutePosition Window::d_absPositionProperty;
00053 WindowProperties::AbsoluteRect Window::d_absRectProperty;
00054 WindowProperties::AbsoluteSize Window::d_absSizeProperty;
00055 WindowProperties::AbsoluteWidth Window::d_absWidthProperty;
00056 WindowProperties::AbsoluteXPosition Window::d_absXPosProperty;
00057 WindowProperties::AbsoluteYPosition Window::d_absYPosProperty;
00058 WindowProperties::Alpha Window::d_alphaProperty;
00059 WindowProperties::AlwaysOnTop Window::d_alwaysOnTopProperty;
00060 WindowProperties::ClippedByParent Window::d_clippedByParentProperty;
00061 WindowProperties::DestroyedByParent Window::d_destroyedByParentProperty;
00062 WindowProperties::Disabled Window::d_disabledProperty;
00063 WindowProperties::Font Window::d_fontProperty;
00064 WindowProperties::Height Window::d_heightProperty;
00065 WindowProperties::ID Window::d_IDProperty;
00066 WindowProperties::InheritsAlpha Window::d_inheritsAlphaProperty;
00067 WindowProperties::MetricsMode Window::d_metricsModeProperty;
00068 WindowProperties::MouseCursorImage Window::d_mouseCursorProperty;
00069 WindowProperties::Position Window::d_positionProperty;
00070 WindowProperties::Rect Window::d_rectProperty;
00071 WindowProperties::RelativeHeight Window::d_relHeightProperty;
00072 WindowProperties::RelativeMaxSize Window::d_relMaxSizeProperty;
00073 WindowProperties::RelativeMinSize Window::d_relMinSizeProperty;
00074 WindowProperties::RelativePosition Window::d_relPositionProperty;
00075 WindowProperties::RelativeRect Window::d_relRectProperty;
00076 WindowProperties::RelativeSize Window::d_relSizeProperty;
00077 WindowProperties::RelativeWidth Window::d_relWidthProperty;
00078 WindowProperties::RelativeXPosition Window::d_relXPosProperty;
00079 WindowProperties::RelativeYPosition Window::d_relYPosProperty;
00080 WindowProperties::RestoreOldCapture Window::d_restoreOldCaptureProperty;
00081 WindowProperties::Size Window::d_sizeProperty;
00082 WindowProperties::Text Window::d_textProperty;
00083 WindowProperties::Visible Window::d_visibleProperty;
00084 WindowProperties::Width Window::d_widthProperty;
00085 WindowProperties::XPosition Window::d_xPosProperty;
00086 WindowProperties::YPosition Window::d_yPosProperty;
00087 WindowProperties::ZOrderChangeEnabled Window::d_zOrderChangeProperty;
00088 WindowProperties::WantsMultiClickEvents Window::d_wantsMultiClicksProperty;
00089 WindowProperties::MouseButtonDownAutoRepeat Window::d_autoRepeatProperty;
00090 WindowProperties::AutoRepeatDelay Window::d_autoRepeatDelayProperty;
00091 WindowProperties::AutoRepeatRate Window::d_autoRepeatRateProperty;
00092 WindowProperties::DistributeCapturedInputs Window::d_distInputsProperty;
00093 WindowProperties::CustomTooltipType Window::d_tooltipTypeProperty;
00094 WindowProperties::Tooltip Window::d_tooltipProperty;
00095 WindowProperties::InheritsTooltipText Window::d_inheritsTooltipProperty;
00096 WindowProperties::RiseOnClick Window::d_riseOnClickProperty;
00097 WindowProperties::VerticalAlignment Window::d_vertAlignProperty;
00098 WindowProperties::HorizontalAlignment Window::d_horzAlignProperty;
00099 WindowProperties::UnifiedAreaRect Window::d_unifiedAreaRectProperty;
00100 WindowProperties::UnifiedPosition Window::d_unifiedPositionProperty;
00101 WindowProperties::UnifiedXPosition Window::d_unifiedXPositionProperty;
00102 WindowProperties::UnifiedYPosition Window::d_unifiedYPositionProperty;
00103 WindowProperties::UnifiedSize Window::d_unifiedSizeProperty;
00104 WindowProperties::UnifiedWidth Window::d_unifiedWidthProperty;
00105 WindowProperties::UnifiedHeight Window::d_unifiedHeightProperty;
00106 WindowProperties::UnifiedMinSize Window::d_unifiedMinSizeProperty;
00107 WindowProperties::UnifiedMaxSize Window::d_unifiedMaxSizeProperty;
00108
00109
00110
00111
00112 Window* Window::d_captureWindow = NULL;
00113
00114
00115
00116
00117
00118 const String Window::EventParentSized( (utf8*)"ParentSized" );
00119 const String Window::EventSized( (utf8*)"Sized" );
00120 const String Window::EventMoved( (utf8*)"Moved" );
00121 const String Window::EventTextChanged( (utf8*)"TextChanged" );
00122 const String Window::EventFontChanged( (utf8*)"FontChanged" );
00123 const String Window::EventAlphaChanged( (utf8*)"AlphaChanged" );
00124 const String Window::EventIDChanged( (utf8*)"IDChanged" );
00125 const String Window::EventActivated( (utf8*)"Activated" );
00126 const String Window::EventDeactivated( (utf8*)"Deactivated" );
00127 const String Window::EventShown( (utf8*)"Shown" );
00128 const String Window::EventHidden( (utf8*)"Hidden" );
00129 const String Window::EventEnabled( (utf8*)"Enabled" );
00130 const String Window::EventDisabled( (utf8*)"Disabled" );
00131 const String Window::EventMetricsModeChanged( (utf8*)"MetricsChanged" );
00132 const String Window::EventClippedByParentChanged( (utf8*)"ClippingChanged" );
00133 const String Window::EventDestroyedByParentChanged( (utf8*)"DestroyedByParentChanged" );
00134 const String Window::EventInheritsAlphaChanged( (utf8*)"InheritAlphaChanged" );
00135 const String Window::EventAlwaysOnTopChanged( (utf8*)"AlwaysOnTopChanged" );
00136 const String Window::EventInputCaptureGained( (utf8*)"CaptureGained" );
00137 const String Window::EventInputCaptureLost( (utf8*)"CaptureLost" );
00138 const String Window::EventRenderingStarted( (utf8*)"StartRender" );
00139 const String Window::EventRenderingEnded( (utf8*)"EndRender" );
00140 const String Window::EventChildAdded( (utf8*)"AddedChild" );
00141 const String Window::EventChildRemoved( (utf8*)"RemovedChild" );
00142 const String Window::EventDestructionStarted( (utf8*)"DestructStart" );
00143 const String Window::EventZOrderChanged( (utf8*)"ZChanged" );
00144 const String Window::EventDragDropItemEnters("DragDropItemEnters");
00145 const String Window::EventDragDropItemLeaves("DragDropItemLeaves");
00146 const String Window::EventDragDropItemDropped("DragDropItemDropped");
00147 const String Window::EventVerticalAlignmentChanged("VerticalAlignmentChanged");
00148 const String Window::EventHorizontalAlignmentChanged("HorizontalAlignmentChanged");
00149 const String Window::EventMouseEnters( (utf8*)"MouseEnter" );
00150 const String Window::EventMouseLeaves( (utf8*)"MouseLeave" );
00151 const String Window::EventMouseMove( (utf8*)"MouseMove" );
00152 const String Window::EventMouseWheel( (utf8*)"MouseWheel" );
00153 const String Window::EventMouseButtonDown( (utf8*)"MouseButtonDown" );
00154 const String Window::EventMouseButtonUp( (utf8*)"MouseButtonUp" );
00155 const String Window::EventMouseClick( (utf8*)"MouseClick" );
00156 const String Window::EventMouseDoubleClick( (utf8*)"MouseDoubleClick" );
00157 const String Window::EventMouseTripleClick( (utf8*)"MouseTripleClick" );
00158 const String Window::EventKeyDown( (utf8*)"KeyDown" );
00159 const String Window::EventKeyUp( (utf8*)"KeyUp" );
00160 const String Window::EventCharacterKey( (utf8*)"CharacterKey" );
00161
00162
00163
00164
00165
00166 Window::Window(const String& type, const String& name) :
00167 d_type(type),
00168 d_name(name)
00169 {
00170
00171 d_metricsMode = Relative;
00172 d_parent = NULL;
00173 d_font = NULL;
00174 d_ID = 0;
00175 d_alpha = 1.0f;
00176 d_mouseCursor = (const Image*)DefaultMouseCursor;
00177 d_userData = NULL;
00178 d_needsRedraw = true;
00179
00180
00181 d_enabled = true;
00182 d_visible = true;
00183 d_active = false;
00184 d_clippedByParent = true;
00185 d_destroyedByParent = true;
00186 d_alwaysOnTop = false;
00187 d_inheritsAlpha = true;
00188 d_restoreOldCapture = false;
00189 d_zOrderingEnabled = true;
00190 d_wantsMultiClicks = true;
00191 d_distCapturedInputs = false;
00192 d_riseOnClick = true;
00193
00194
00195 d_repeatButton = NoButton;
00196 d_autoRepeat = false;
00197 d_repeating = false;
00198 d_repeatDelay = 0.3f;
00199 d_repeatRate = 0.06f;
00200
00201
00202 d_customTip = 0;
00203 d_weOwnTip = false;
00204 d_inheritsTipText = false;
00205
00206
00207 addStandardEvents();
00208
00209
00210 d_minSize = UVector2(cegui_reldim(0), cegui_reldim(0));
00211 d_maxSize = UVector2(cegui_reldim(1), cegui_reldim(1));
00212
00213
00214 d_area = URect(cegui_reldim(0), cegui_reldim(0), cegui_reldim(0), cegui_reldim(0));
00215 d_pixelSize = Size(0, 0);
00216
00217
00218 d_horzAlign = HA_LEFT;
00219 d_vertAlign = VA_TOP;
00220
00221
00222 addStandardProperties();
00223 }
00224
00225
00226
00227
00228 Window::~Window(void)
00229 {
00230
00231 }
00232
00233
00234
00235
00236
00237 const String& Window::getType(void) const
00238 {
00239 return d_falagardType.empty() ? d_type : d_falagardType;
00240 }
00241
00242
00243
00244
00245
00246 bool Window::isDisabled(bool localOnly) const
00247 {
00248 bool parDisabled = ((d_parent == NULL) || localOnly) ? false : d_parent->isDisabled();
00249
00250 return (!d_enabled) || parDisabled;
00251 }
00252
00253
00254
00255
00256
00257 bool Window::isVisible(bool localOnly) const
00258 {
00259 bool parVisible = ((d_parent == NULL) || localOnly) ? true : d_parent->isVisible();
00260
00261 return d_visible && parVisible;
00262 }
00263
00264
00265
00266
00267
00268
00269 bool Window::isActive(void) const
00270 {
00271 bool parActive = (d_parent == NULL) ? true : d_parent->isActive();
00272
00273 return d_active && parActive;
00274 }
00275
00276
00277
00278
00279
00280
00281 bool Window::isChild(const String& name) const
00282 {
00283 uint child_count = getChildCount();
00284
00285 for (uint i = 0; i < child_count; ++i)
00286 {
00287 if (d_children[i]->getName() == name)
00288 {
00289 return true;
00290 }
00291
00292 }
00293
00294 return false;
00295 }
00296
00297
00298
00299
00300
00301 bool Window::isChild(uint ID) const
00302 {
00303 uint child_count = getChildCount();
00304
00305 for (uint i = 0; i < child_count; ++i)
00306 {
00307 if (d_children[i]->getID() == ID)
00308 {
00309 return true;
00310 }
00311
00312 }
00313
00314 return false;
00315 }
00316
00317
00318
00319
00320
00321 bool Window::isChild(const Window* window) const
00322 {
00323 uint child_count = getChildCount();
00324
00325 for (uint i = 0; i < child_count; ++i)
00326 {
00327 if (d_children[i] == window)
00328 {
00329 return true;
00330 }
00331
00332 }
00333
00334 return false;
00335 }
00336
00337
00338
00339
00340
00341 Window* Window::getChild(const String& name) const
00342 {
00343 uint child_count = getChildCount();
00344
00345 for (uint i = 0; i < child_count; ++i)
00346 {
00347 if (d_children[i]->getName() == name)
00348 {
00349 return d_children[i];
00350 }
00351
00352 }
00353
00354 throw UnknownObjectException((utf8*)"Window::getChild - The Window object named '" + name +"' is not attached to Window '" + d_name + "'.");
00355 }
00356
00357
00358
00359
00360
00361
00362 Window* Window::getChild(uint ID) const
00363 {
00364 uint child_count = getChildCount();
00365
00366 for (uint i = 0; i < child_count; ++i)
00367 {
00368 if (d_children[i]->getID() == ID)
00369 {
00370 return d_children[i];
00371 }
00372
00373 }
00374
00375
00376 char strbuf[16];
00377 sprintf(strbuf, "%X", ID);
00378 throw UnknownObjectException("Window::getChild - The Window with ID: '" + std::string(strbuf) + "' is not attached to Window '" + d_name + "'.");
00379 }
00380
00381
00382
00383
00384
00385
00386 Window* Window::getActiveChild(void)
00387 {
00388 return const_cast<Window*>(static_cast<const Window*>(this)->getActiveChild());
00389 }
00390
00391
00392
00393
00394
00395
00396 const Window* Window::getActiveChild(void) const
00397 {
00398
00399 if (!isActive())
00400 {
00401 return NULL;
00402 }
00403
00404 uint pos = getChildCount();
00405
00406 while (pos-- > 0)
00407 {
00408
00409
00410 if (d_drawList[pos]->d_active)
00411 return d_drawList[pos]->getActiveChild();
00412 }
00413
00414
00415 return this;
00416 }
00417
00418
00419
00420
00421
00422 bool Window::isAncestor(const String& name) const
00423 {
00424
00425 if (d_parent == NULL)
00426 {
00427 return false;
00428 }
00429
00430
00431 if (d_parent->getName() == name)
00432 {
00433 return true;
00434 }
00435
00436
00437 return d_parent->isAncestor(name);
00438 }
00439
00440
00441
00442
00443
00444
00445 bool Window::isAncestor(uint ID) const
00446 {
00447
00448 if (d_parent == NULL)
00449 {
00450 return false;
00451 }
00452
00453
00454 if (d_parent->getID() == ID)
00455 {
00456 return true;
00457 }
00458
00459
00460 return d_parent->isAncestor(ID);
00461 }
00462
00463
00464
00465
00466
00467 bool Window::isAncestor(const Window* window) const
00468 {
00469
00470 if (d_parent == NULL)
00471 {
00472 return false;
00473 }
00474
00475
00476 if (d_parent == window)
00477 {
00478 return true;
00479 }
00480
00481
00482 return d_parent->isAncestor(window);
00483 }
00484
00485
00486
00487
00488
00489 const Font* Window::getFont(bool useDefault) const
00490 {
00491 if (d_font == NULL)
00492 {
00493 return useDefault ? System::getSingleton().getDefaultFont() : 0;
00494 }
00495
00496 return d_font;
00497 }
00498
00499
00500
00501
00502
00503
00504
00505 float Window::getEffectiveAlpha(void) const
00506 {
00507 if ((d_parent == NULL) || (!inheritsAlpha()))
00508 {
00509 return d_alpha;
00510 }
00511
00512 return d_alpha * d_parent->getEffectiveAlpha();
00513 }
00514
00515
00516
00517
00518
00519 Rect Window::getRect(void) const
00520 {
00521 return (getMetricsMode() == Relative) ? getRelativeRect() : getAbsoluteRect();
00522 }
00523
00524
00525
00526
00527
00528 Rect Window::getPixelRect(void) const
00529 {
00530
00531 if (isClippedByParent() && (d_parent != NULL))
00532 {
00533 return getUnclippedPixelRect().getIntersection(d_parent->getInnerRect());
00534 }
00535
00536 else
00537 {
00538 return getUnclippedPixelRect().getIntersection(System::getSingleton().getRenderer()->getRect());
00539 }
00540
00541 }
00542
00543
00544
00545
00546
00547 Rect Window::getInnerRect(void) const
00548 {
00549
00550 if (isClippedByParent() && (d_parent != NULL))
00551 {
00552 return getUnclippedInnerRect().getIntersection(d_parent->getInnerRect());
00553 }
00554
00555 else
00556 {
00557 return getUnclippedInnerRect().getIntersection(System::getSingleton().getRenderer()->getRect());
00558 }
00559
00560 }
00561
00562
00563
00564
00565
00566
00567 Rect Window::getUnclippedPixelRect(void) const
00568 {
00569 if (getMetricsMode() == Relative)
00570 {
00571 return windowToScreen(Rect(0, 0, 1, 1));
00572 }
00573 else
00574 {
00575 return windowToScreen(Rect(0, 0, getAbsoluteWidth(), getAbsoluteHeight()));
00576 }
00577 }
00578
00579
00580
00581
00582
00583
00584
00585
00586 Rect Window::getUnclippedInnerRect(void) const
00587 {
00588 return getUnclippedPixelRect();
00589 }
00590
00591
00592
00593
00594
00595 bool Window::isHit(const Point& position) const
00596 {
00597
00598 if (isDisabled())
00599 {
00600 return false;
00601 }
00602
00603 Rect clipped_area(getPixelRect());
00604
00605 if (clipped_area.getWidth() == 0)
00606 {
00607 return false;
00608 }
00609
00610 return clipped_area.isPointInRect(position);
00611 }
00612
00613
00614
00615
00616 Window* Window::getChildAtPosition(const Point& position) const
00617 {
00618 ChildList::const_reverse_iterator child, end;
00619
00620 end = d_drawList.rend();
00621
00622 for (child = d_drawList.rbegin(); child != end; ++child)
00623 {
00624 if ((*child)->isVisible())
00625 {
00626
00627 Window* wnd = (*child)->getChildAtPosition(position);
00628
00629
00630 if (wnd != NULL)
00631 {
00632 return wnd;
00633 }
00634
00635 else
00636 {
00637
00638 if ((*child)->isHit(position))
00639 {
00640 return (*child);
00641 }
00642
00643 }
00644
00645 }
00646
00647 }
00648
00649
00650 return NULL;
00651 }
00652
00653
00654
00655
00656
00657 MetricsMode Window::getMetricsMode(void) const
00658 {
00659 if (d_metricsMode == Inherited)
00660 {
00661 return getInheritedMetricsMode();
00662 }
00663
00664 return d_metricsMode;
00665 }
00666
00667
00668
00669
00670
00671
00672 float Window::getXPosition(void) const
00673 {
00674 return (getMetricsMode() == Relative) ? getRelativeXPosition() : getAbsoluteXPosition();
00675 }
00676
00677
00678
00679
00680
00681
00682 float Window::getYPosition(void) const
00683 {
00684 return (getMetricsMode() == Relative) ? getRelativeYPosition() : getAbsoluteYPosition();
00685 }
00686
00687
00688
00689
00690
00691
00692 Point Window::getPosition(void) const
00693 {
00694 return (getMetricsMode() == Relative) ? getRelativePosition() : getAbsolutePosition();
00695 }
00696
00697
00698
00699
00700
00701
00702 float Window::getWidth(void) const
00703 {
00704 return (getMetricsMode() == Relative) ? getRelativeWidth() : getAbsoluteWidth();
00705 }
00706
00707
00708
00709
00710
00711
00712 float Window::getHeight(void) const
00713 {
00714 return (getMetricsMode() == Relative) ? getRelativeHeight() : getAbsoluteHeight();
00715 }
00716
00717
00718
00719
00720
00721
00722 Size Window::getSize(void) const
00723 {
00724 return (getMetricsMode() == Relative) ? getRelativeSize() : getAbsoluteSize();
00725 }
00726
00727
00728
00729
00730
00731
00732 void Window::setAlwaysOnTop(bool setting)
00733 {
00734
00735 if (isAlwaysOnTop() != setting)
00736 {
00737 d_alwaysOnTop = setting;
00738
00739
00740 if (d_parent != NULL)
00741 {
00742 Window* org_parent = d_parent;
00743
00744 org_parent->removeChild_impl(this);
00745 org_parent->addChild_impl(this);
00746
00747 onZChange_impl();
00748 }
00749
00750 WindowEventArgs args(this);
00751 onAlwaysOnTopChanged(args);
00752 }
00753
00754 }
00755
00756
00757
00758
00759
00760
00761 void Window::setEnabled(bool setting)
00762 {
00763
00764 if (d_enabled != setting)
00765 {
00766 d_enabled = setting;
00767 WindowEventArgs args(this);
00768
00769 if (d_enabled)
00770 {
00771
00772
00773 if ((d_parent && !d_parent->isDisabled()) || !d_parent)
00774 onEnabled(args);
00775 }
00776 else
00777 {
00778 onDisabled(args);
00779 }
00780 }
00781 }
00782
00783
00784
00785
00786
00787 void Window::setVisible(bool setting)
00788 {
00789
00790 if (d_visible != setting)
00791 {
00792 d_visible = setting;
00793 WindowEventArgs args(this);
00794 d_visible ? onShown(args) : onHidden(args);
00795 }
00796
00797 }
00798
00799
00800
00801
00802
00803
00804 void Window::activate(void)
00805 {
00806
00807
00808
00809 if ((d_captureWindow != NULL) && (d_captureWindow != this))
00810 {
00811 Window* tmpCapture = d_captureWindow;
00812 d_captureWindow = NULL;
00813
00814 WindowEventArgs args(NULL);
00815 tmpCapture->onCaptureLost(args);
00816 }
00817
00818 moveToFront();
00819 }
00820
00821
00822
00823
00824
00825
00826
00827 void Window::deactivate(void)
00828 {
00829 ActivationEventArgs args(this);
00830 args.otherWindow = NULL;
00831 onDeactivated(args);
00832 }
00833
00834
00835
00836
00837
00838 void Window::setClippedByParent(bool setting)
00839 {
00840
00841 if (d_clippedByParent != setting)
00842 {
00843 d_clippedByParent = setting;
00844 WindowEventArgs args(this);
00845 onClippingChanged(args);
00846 }
00847
00848 }
00849
00850
00851
00852
00853
00854 void Window::setText(const String& text)
00855 {
00856 d_text = text;
00857 WindowEventArgs args(this);
00858 onTextChanged(args);
00859 }
00860
00861
00862
00863
00864
00865
00866 void Window::setWidth(float width)
00867 {
00868 setSize(Size(width, getHeight()));
00869 }
00870
00871
00872
00873
00874
00875
00876 void Window::setHeight(float height)
00877 {
00878 setSize(Size(getWidth(), height));
00879 }
00880
00881
00882
00883
00884
00885
00886 void Window::setSize(const Size& size)
00887 {
00888 setSize(getMetricsMode(), size);
00889 }
00890
00891
00892
00893
00894
00895
00896
00897 void Window::setXPosition(float x)
00898 {
00899 setPosition(Point(x, getYPosition()));
00900 }
00901
00902
00903
00904
00905
00906
00907
00908 void Window::setYPosition(float y)
00909 {
00910 setPosition(Point(getXPosition(), y));
00911 }
00912
00913
00914
00915
00916
00917
00918 void Window::setPosition(const Point& position)
00919 {
00920 setPosition(getMetricsMode(), position);
00921 }
00922
00923
00924
00925
00926
00927
00928
00929 void Window::setAreaRect(const Rect& area)
00930 {
00931 setRect(getMetricsMode(), area);
00932 }
00933
00934
00935
00936
00937
00938 void Window::setFont(const Font* font)
00939 {
00940 d_font = font;
00941 WindowEventArgs args(this);
00942 onFontChanged(args);
00943 }
00944
00945
00946
00947
00948
00949 void Window::setFont(const String& name)
00950 {
00951 if (name.empty())
00952 {
00953 setFont(NULL);
00954 }
00955 else
00956 {
00957 setFont(FontManager::getSingleton().getFont(name));
00958 }
00959
00960 }
00961
00962
00963
00964
00965
00966
00967
00968 void Window::addChildWindow(const String& name)
00969 {
00970 addChildWindow(WindowManager::getSingleton().getWindow(name));
00971 }
00972
00973
00974
00975
00976
00977
00978
00979 void Window::addChildWindow(Window* window)
00980 {
00981 addChild_impl(window);
00982 WindowEventArgs args(window);
00983 onChildAdded(args);
00984 window->onZChange_impl();
00985 }
00986
00987
00988
00989
00990
00991 void Window::removeChildWindow(const String& name)
00992 {
00993 uint child_count = getChildCount();
00994
00995 for (uint i = 0; i < child_count; ++i)
00996 {
00997 if (d_children[i]->getName() == name)
00998 {
00999 removeChildWindow(d_children[i]);
01000 return;
01001 }
01002
01003 }
01004
01005 }
01006
01007
01008
01009
01010
01011 void Window::removeChildWindow(Window* window)
01012 {
01013 removeChild_impl(window);
01014 WindowEventArgs args(window);
01015 onChildRemoved(args);
01016 window->onZChange_impl();
01017 }
01018
01019
01020
01021
01022
01023
01024
01025 void Window::removeChildWindow(uint ID)
01026 {
01027 uint child_count = getChildCount();
01028
01029 for (uint i = 0; i < child_count; ++i)
01030 {
01031 if (d_children[i]->getID() == ID)
01032 {
01033 removeChildWindow(d_children[i]);
01034 return;
01035 }
01036
01037 }
01038
01039 }
01040
01041
01042
01043
01044
01045 void Window::moveToFront()
01046 {
01047 moveToFront_impl(false);
01048 }
01049
01050
01051
01052
01053
01054 void Window::moveToFront_impl(bool wasClicked)
01055 {
01056
01057 if (d_parent == NULL)
01058 {
01059
01060 if (!isActive())
01061 {
01062 ActivationEventArgs args(this);
01063 args.otherWindow = NULL;
01064 onActivated(args);
01065 }
01066
01067 return;
01068 }
01069
01070
01071 wasClicked ? d_parent->doRiseOnClick() : d_parent->moveToFront_impl(false);
01072
01073
01074 Window* activeWnd = getActiveSibling();
01075
01076
01077 if (activeWnd != this)
01078 {
01079
01080 ActivationEventArgs args(this);
01081 args.otherWindow = activeWnd;
01082 onActivated(args);
01083
01084
01085 if (activeWnd)
01086 {
01087 args.window = activeWnd;
01088 args.otherWindow = this;
01089 args.handled = false;
01090 activeWnd->onDeactivated(args);
01091 }
01092 }
01093
01094
01095 if (d_zOrderingEnabled)
01096 {
01097
01098 d_parent->removeWindowFromDrawList(*this);
01099
01100
01101 d_parent->addWindowToDrawList(*this);
01102
01103 onZChange_impl();
01104 }
01105 }
01106
01107
01108
01109
01110
01111 void Window::moveToBack()
01112 {
01113
01114 if (isActive())
01115 {
01116 ActivationEventArgs args(this);
01117 args.otherWindow = NULL;
01118 onDeactivated(args);
01119 }
01120
01121
01122 if (d_parent)
01123 {
01124 if (d_zOrderingEnabled)
01125 {
01126
01127 d_parent->removeWindowFromDrawList(*this);
01128
01129
01130 d_parent->addWindowToDrawList(*this, true);
01131
01132 onZChange_impl();
01133 }
01134
01135 d_parent->moveToBack();
01136 }
01137 }
01138
01139
01140
01141
01142
01143 bool Window::captureInput(void)
01144 {
01145
01146 if (!isActive()) {
01147 return false;
01148 }
01149
01150 Window* current_capture = d_captureWindow;
01151 d_captureWindow = this;
01152 WindowEventArgs args(this);
01153
01154
01155 if ((current_capture != NULL) && (current_capture != this) && (!d_restoreOldCapture)) {
01156 current_capture->onCaptureLost(args);
01157 }
01158
01159 if (d_restoreOldCapture) {
01160 d_oldCapture = current_capture;
01161 }
01162
01163 onCaptureGained(args);
01164
01165 return true;
01166 }
01167
01168
01169
01170
01171
01172
01173 void Window::releaseInput(void)
01174 {
01175
01176 if (!isCapturedByThis()) {
01177 return;
01178 }
01179
01180
01181 if (d_restoreOldCapture) {
01182 d_captureWindow = d_oldCapture;
01183
01184
01185 if (d_oldCapture != NULL) {
01186 d_oldCapture = NULL;
01187 d_captureWindow->moveToFront();
01188 }
01189
01190 }
01191 else {
01192 d_captureWindow = NULL;
01193 }
01194
01195 WindowEventArgs args(this);
01196 onCaptureLost(args);
01197 }
01198
01199
01200
01201
01202
01203
01204 void Window::setRestoreCapture(bool setting)
01205 {
01206 d_restoreOldCapture = setting;
01207
01208 uint child_count = getChildCount();
01209
01210 for (uint i = 0; i < child_count; ++i)
01211 {
01212 d_children[i]->setRestoreCapture(setting);
01213 }
01214
01215 }
01216
01217
01218
01219
01220
01221 void Window::setAlpha(float alpha)
01222 {
01223 d_alpha = alpha;
01224 WindowEventArgs args(this);
01225 onAlphaChanged(args);
01226 }
01227
01228
01229
01230
01231
01232 void Window::setInheritsAlpha(bool setting)
01233 {
01234 if (d_inheritsAlpha != setting)
01235 {
01236
01237 float oldAlpha = getEffectiveAlpha();
01238
01239
01240 d_inheritsAlpha = setting;
01241
01242 WindowEventArgs args(this);
01243 onInheritsAlphaChanged(args);
01244
01245
01246 if (oldAlpha != getEffectiveAlpha())
01247 {
01248 args.handled = false;
01249 onAlphaChanged(args);
01250 }
01251
01252 }
01253
01254 }
01255
01256
01257
01258
01259
01260
01261 void Window::requestRedraw(void) const
01262 {
01263 d_needsRedraw = true;
01264 System::getSingleton().signalRedraw();
01265 }
01266
01267
01268
01269
01270
01271 float Window::absoluteToRelativeX(float val) const
01272 {
01273 return absoluteToRelativeX_impl(this, val);
01274 }
01275
01276
01277
01278
01279
01280 float Window::absoluteToRelativeY(float val) const
01281 {
01282 return absoluteToRelativeY_impl(this, val);
01283 }
01284
01285
01286
01287
01288
01289 Point Window::absoluteToRelative(const Point& pt) const
01290 {
01291 return absoluteToRelative_impl(this, pt);
01292 }
01293
01294
01295
01296
01297
01298 Size Window::absoluteToRelative(const Size& sze) const
01299 {
01300 return absoluteToRelative_impl(this, sze);
01301 }
01302
01303
01304
01305
01306
01307 Rect Window::absoluteToRelative(const Rect& rect) const
01308 {
01309 return absoluteToRelative_impl(this, rect);
01310 }
01311
01312
01313
01314
01315
01316 float Window::relativeToAbsoluteX(float val) const
01317 {
01318 return relativeToAbsoluteX_impl(this, val);
01319 }
01320
01321
01322
01323
01324
01325 float Window::relativeToAbsoluteY(float val) const
01326 {
01327 return relativeToAbsoluteY_impl(this, val);
01328 }
01329
01330
01331
01332
01333
01334 Point Window::relativeToAbsolute(const Point& pt) const
01335 {
01336 return relativeToAbsolute_impl(this, pt);
01337 }
01338
01339
01340
01341
01342
01343 Size Window::relativeToAbsolute(const Size& sze) const
01344 {
01345 return relativeToAbsolute_impl(this, sze);
01346 }
01347
01348
01349
01350
01351
01352 Rect Window::relativeToAbsolute(const Rect& rect) const
01353 {
01354 return relativeToAbsolute_impl(this, rect);
01355 }
01356
01357
01358
01359
01360
01361
01362 float Window::windowToScreenX(float x) const
01363 {
01364 float baseX = 0;
01365
01366 if (d_parent)
01367 {
01368 baseX = d_parent->windowToScreenX(baseX);
01369 }
01370
01371 switch(d_horzAlign)
01372 {
01373 case HA_CENTRE:
01374 baseX += getAbsoluteXPosition() + ((getParentWidth() - getAbsoluteWidth()) * 0.5f);
01375 break;
01376 case HA_RIGHT:
01377 baseX += getAbsoluteXPosition() + (getParentWidth() - getAbsoluteWidth());
01378 break;
01379 default:
01380 baseX += getAbsoluteXPosition();
01381 break;
01382 }
01383
01384 if (getMetricsMode() == Relative)
01385 {
01386 return baseX + relativeToAbsoluteX(x);
01387 }
01388 else
01389 {
01390 return baseX + x;
01391 }
01392
01393 }
01394
01395
01396
01397
01398
01399
01400 float Window::windowToScreenY(float y) const
01401 {
01402 float baseY = 0;
01403
01404 if (d_parent)
01405 {
01406 baseY = d_parent->windowToScreenY(baseY);
01407 }
01408
01409 switch(d_vertAlign)
01410 {
01411 case VA_CENTRE:
01412 baseY += getAbsoluteYPosition() + ((getParentHeight() - getAbsoluteHeight()) * 0.5f);
01413 break;
01414 case VA_BOTTOM:
01415 baseY += getAbsoluteYPosition() + (getParentHeight() - getAbsoluteHeight());
01416 break;
01417 default:
01418 baseY += getAbsoluteYPosition();
01419 break;
01420 }
01421
01422 if (getMetricsMode() == Relative)
01423 {
01424 return baseY + relativeToAbsoluteY(y);
01425 }
01426 else
01427 {
01428 return baseY + y;
01429 }
01430
01431 }
01432
01433
01434
01435
01436
01437
01438 Point Window::windowToScreen(const Point& pt) const
01439 {
01440 Point base(0, 0);
01441
01442 if (d_parent)
01443 {
01444 base = d_parent->windowToScreen(base);
01445 }
01446
01447 switch(d_horzAlign)
01448 {
01449 case HA_CENTRE:
01450 base.d_x += getAbsoluteXPosition() + ((getParentWidth() - getAbsoluteWidth()) * 0.5f);
01451 break;
01452 case HA_RIGHT:
01453 base.d_x += getAbsoluteXPosition() + (getParentWidth() - getAbsoluteWidth());
01454 break;
01455 default:
01456 base.d_x += getAbsoluteXPosition();
01457 break;
01458 }
01459
01460 switch(d_vertAlign)
01461 {
01462 case VA_CENTRE:
01463 base.d_y += getAbsoluteYPosition() + ((getParentHeight() - getAbsoluteHeight()) * 0.5f);
01464 break;
01465 case VA_BOTTOM:
01466 base.d_y += getAbsoluteYPosition() + (getParentHeight() - getAbsoluteHeight());
01467 break;
01468 default:
01469 base.d_y += getAbsoluteYPosition();
01470 break;
01471 }
01472
01473 if (getMetricsMode() == Relative)
01474 {
01475 return base + relativeToAbsolute(pt);
01476 }
01477 else
01478 {
01479 return base + pt;
01480 }
01481
01482 }
01483
01484
01485
01486
01487
01488
01489 Size Window::windowToScreen(const Size& sze) const
01490 {
01491 if (getMetricsMode() == Relative)
01492 {
01493 return Size(sze.d_width * getAbsoluteWidth(), sze.d_height * getAbsoluteHeight());
01494 }
01495 else
01496 {
01497 return sze;
01498 }
01499
01500 }
01501
01502
01503
01504
01505
01506
01507 Rect Window::windowToScreen(const Rect& rect) const
01508 {
01509 Point base(0, 0);
01510
01511 if (d_parent)
01512 {
01513 base = d_parent->windowToScreen(base);
01514 }
01515
01516 switch(d_horzAlign)
01517 {
01518 case HA_CENTRE:
01519 base.d_x += getAbsoluteXPosition() + ((getParentWidth() - getAbsoluteWidth()) * 0.5f);
01520 break;
01521 case HA_RIGHT:
01522 base.d_x += getAbsoluteXPosition() + (getParentWidth() - getAbsoluteWidth());
01523 break;
01524 default:
01525 base.d_x += getAbsoluteXPosition();
01526 break;
01527 }
01528
01529 switch(d_vertAlign)
01530 {
01531 case VA_CENTRE:
01532 base.d_y += getAbsoluteYPosition() + ((getParentHeight() - getAbsoluteHeight()) * 0.5f);
01533 break;
01534 case VA_BOTTOM:
01535 base.d_y += getAbsoluteYPosition() + (getParentHeight() - getAbsoluteHeight());
01536 break;
01537 default:
01538 base.d_y += getAbsoluteYPosition();
01539 break;
01540 }
01541
01542 if (getMetricsMode() == Relative)
01543 {
01544 return relativeToAbsolute(rect).offset(base);
01545 }
01546 else
01547 {
01548 Rect tmp(rect);
01549 return tmp.offset(base);
01550 }
01551
01552 }
01553
01554
01555
01556
01557
01558
01559 float Window::screenToWindowX(float x) const
01560 {
01561 x -= windowToScreenX(0);
01562
01563 if (getMetricsMode() == Relative)
01564 {
01565 x /= getAbsoluteWidth();
01566 }
01567
01568 return x;
01569 }
01570
01571
01572
01573
01574
01575
01576 float Window::screenToWindowY(float y) const
01577 {
01578 y -= windowToScreenY(0);
01579
01580 if (getMetricsMode() == Relative)
01581 {
01582 y /= getAbsoluteHeight();
01583 }
01584
01585 return y;
01586 }
01587
01588
01589
01590
01591
01592
01593 Point Window::screenToWindow(const Point& pt) const
01594 {
01595 Point tmp(pt);
01596
01597 tmp.d_x -= windowToScreenX(0);
01598 tmp.d_y -= windowToScreenY(0);
01599
01600 if (getMetricsMode() == Relative)
01601 {
01602 tmp.d_x /= getAbsoluteWidth();
01603 tmp.d_y /= getAbsoluteHeight();
01604 }
01605
01606 return tmp;
01607 }
01608
01609
01610
01611
01612
01613 Size Window::screenToWindow(const Size& sze) const
01614 {
01615 Size tmp(sze);
01616
01617 if (getMetricsMode() == Relative)
01618 {
01619 tmp.d_width /= getAbsoluteWidth();
01620 tmp.d_height /= getAbsoluteHeight();
01621 }
01622
01623 return tmp;
01624 }
01625
01626
01627
01628
01629
01630
01631 Rect Window::screenToWindow(const Rect& rect) const
01632 {
01633 Rect tmp(rect);
01634
01635 tmp.d_left -= windowToScreenX(0);
01636 tmp.d_top -= windowToScreenY(0);
01637 tmp.d_right -= windowToScreenX(0);
01638 tmp.d_bottom -= windowToScreenY(0);
01639
01640 if (getMetricsMode() == Relative)
01641 {
01642 tmp.d_left /= getAbsoluteWidth();
01643 tmp.d_top /= getAbsoluteHeight();
01644 tmp.d_right /= getAbsoluteWidth();
01645 tmp.d_bottom /= getAbsoluteHeight();
01646 }
01647
01648 return tmp;
01649 }
01650
01651
01652
01653
01654
01655 float Window::unifiedToRelativeX(const UDim& val) const
01656 {
01657 return val.asRelative(d_pixelSize.d_width);
01658 }
01659
01660
01661
01662
01663 float Window::unifiedToRelativeY(const UDim& val) const
01664 {
01665 return val.asRelative(d_pixelSize.d_height);
01666 }
01667
01668
01669
01670
01671 Vector2 Window::unifiedToRelative(const UVector2& val) const
01672 {
01673 return val.asRelative(d_pixelSize);
01674 }
01675
01676
01677
01678
01679 Rect Window::unifiedToRelative(const URect& val) const
01680 {
01681 return val.asRelative(d_pixelSize);
01682 }
01683
01684
01685
01686
01687 float Window::unifiedToAbsoluteX(const UDim& val) const
01688 {
01689 return val.asAbsolute(d_pixelSize.d_width);
01690 }
01691
01692
01693
01694
01695 float Window::unifiedToAbsoluteY(const UDim& val) const
01696 {
01697 return val.asAbsolute(d_pixelSize.d_height);
01698 }
01699
01700
01701
01702
01703 Vector2 Window::unifiedToAbsolute(const UVector2& val) const
01704 {
01705 return val.asAbsolute(d_pixelSize);
01706 }
01707
01708
01709
01710
01711 Rect Window::unifiedToAbsolute(const URect& val) const
01712 {
01713 return val.asAbsolute(d_pixelSize);
01714 }
01715
01716
01717
01718
01719
01720 float Window::windowToScreenX(const UDim& x) const
01721 {
01722 float baseX = d_parent ? d_parent->windowToScreenX(0) + getAbsoluteXPosition() : getAbsoluteXPosition();
01723
01724 switch(d_horzAlign)
01725 {
01726 case HA_CENTRE:
01727 baseX += (getParentWidth() - d_pixelSize.d_width) * 0.5f;
01728 break;
01729 case HA_RIGHT:
01730 baseX += getParentWidth() - d_pixelSize.d_width;
01731 break;
01732 default:
01733 break;
01734 }
01735
01736 return baseX + x.asAbsolute(d_pixelSize.d_width);
01737 }
01738
01739
01740
01741
01742
01743 float Window::windowToScreenY(const UDim& y) const
01744 {
01745 float baseY = d_parent ? d_parent->windowToScreenY(0) + getAbsoluteYPosition() : getAbsoluteYPosition();
01746
01747 switch(d_vertAlign)
01748 {
01749 case VA_CENTRE:
01750 baseY += (getParentHeight() - d_pixelSize.d_height) * 0.5f;
01751 break;
01752 case VA_BOTTOM:
01753 baseY += getParentHeight() - d_pixelSize.d_height;
01754 break;
01755 default:
01756 break;
01757 }
01758
01759 return baseY + y.asAbsolute(d_pixelSize.d_height);
01760 }
01761
01762
01763
01764
01765
01766 Vector2 Window::windowToScreen(const UVector2& vec) const
01767 {
01768 Vector2 base = d_parent ? d_parent->windowToScreen(base) + getAbsolutePosition() : getAbsolutePosition();
01769
01770 switch(d_horzAlign)
01771 {
01772 case HA_CENTRE:
01773 base.d_x += (getParentWidth() - d_pixelSize.d_width) * 0.5f;
01774 break;
01775 case HA_RIGHT:
01776 base.d_x += getParentWidth() - d_pixelSize.d_width;
01777 break;
01778 default:
01779 break;
01780 }
01781
01782 switch(d_vertAlign)
01783 {
01784 case VA_CENTRE:
01785 base.d_y += (getParentHeight() - d_pixelSize.d_height) * 0.5f;
01786 break;
01787 case VA_BOTTOM:
01788 base.d_y += getParentHeight() - d_pixelSize.d_height;
01789 break;
01790 default:
01791 break;
01792 }
01793
01794 return base + vec.asAbsolute(d_pixelSize);
01795 }
01796
01797
01798
01799
01800 Rect Window::windowToScreen(const URect& rect) const
01801 {
01802 Vector2 base = d_parent ? d_parent->windowToScreen(base) + getAbsolutePosition() : getAbsolutePosition();
01803
01804 switch(d_horzAlign)
01805 {
01806 case HA_CENTRE:
01807 base.d_x += (getParentWidth() - d_pixelSize.d_width) * 0.5f;
01808 break;
01809 case HA_RIGHT:
01810 base.d_x += getParentWidth() - d_pixelSize.d_width;
01811 break;
01812 default:
01813 break;
01814 }
01815
01816 switch(d_vertAlign)
01817 {
01818 case VA_CENTRE:
01819 base.d_y += (getParentHeight() - d_pixelSize.d_height) * 0.5f;
01820 break;
01821 case VA_BOTTOM:
01822 base.d_y += getParentHeight() - d_pixelSize.d_height;
01823 break;
01824 default:
01825 break;
01826 }
01827
01828 Rect tmp(rect.asAbsolute(d_pixelSize));
01829 return tmp.offset(base);
01830 }
01831
01832
01833
01834
01835
01836 float Window::screenToWindowX(const UDim& x) const
01837 {
01838 return screenToWindowX(x.asAbsolute(System::getSingleton().getRenderer()->getWidth()));
01839 }
01840
01841
01842
01843
01844
01845 float Window::screenToWindowY(const UDim& y) const
01846 {
01847 return screenToWindowY(y.asAbsolute(System::getSingleton().getRenderer()->getHeight()));
01848 }
01849
01850
01851
01852
01853
01854 Vector2 Window::screenToWindow(const UVector2& vec) const
01855 {
01856 return screenToWindow(vec.asAbsolute(System::getSingleton().getRenderer()->getSize()));
01857 }
01858
01859
01860
01861
01862
01863 Rect Window::screenToWindow(const URect& rect) const
01864 {
01865 return screenToWindow(rect.asAbsolute(System::getSingleton().getRenderer()->getSize()));
01866 }
01867
01868
01869
01870
01871 void Window::render(void)
01872 {
01873
01874 if (!isVisible()) {
01875 return;
01876 }
01877
01878
01879 WindowEventArgs args(this);
01880 onRenderingStarted(args);
01881
01882
01883 Renderer* renderer = System::getSingleton().getRenderer();
01884 drawSelf(renderer->getCurrentZ());
01885 renderer->advanceZValue();
01886
01887
01888 uint child_count = getChildCount();
01889
01890 for (uint i = 0; i < child_count; ++i)
01891 {
01892 d_drawList[i]->render();
01893 }
01894
01895
01896 onRenderingEnded(args);
01897 }
01898
01899
01900
01901
01902
01903 void Window::drawSelf(float z)
01904 {
01905 if (d_needsRedraw)
01906 {
01907
01908 d_renderCache.clearCachedImagery();
01909
01910 populateRenderCache();
01911
01912 d_needsRedraw = false;
01913 }
01914
01915
01916 if (d_renderCache.hasCachedImagery())
01917 {
01918 Point absPos(getUnclippedPixelRect().getPosition());
01919
01920 Rect clipper(getPixelRect());
01921
01922 if (clipper.getWidth())
01923 {
01924
01925 d_renderCache.render(absPos, z, clipper);
01926 }
01927 }
01928 }
01929
01930
01931
01932
01933
01934 void Window::setParent(Window* parent)
01935 {
01936 d_parent = parent;
01937 }
01938
01939
01940
01941
01942
01943
01944 float Window::getParentWidth(void) const
01945 {
01946 if (d_parent == NULL)
01947 {
01948 return System::getSingleton().getRenderer()->getWidth();
01949 }
01950
01951 return d_parent->getAbsoluteWidth();
01952 }
01953
01954
01955
01956
01957
01958
01959 float Window::getParentHeight(void) const
01960 {
01961 if (d_parent == NULL)
01962 {
01963 return System::getSingleton().getRenderer()->getHeight();
01964 }
01965
01966 return d_parent->getAbsoluteHeight();
01967 }
01968
01969
01970
01971
01972
01973
01974 Size Window::getParentSize(void) const
01975 {
01976 return getWindowSize_impl(d_parent);
01977 }
01978
01979
01980
01981
01982
01983 void Window::addStandardEvents(void)
01984 {
01985
01986 addEvent(EventSized); addEvent(EventMoved); addEvent(EventTextChanged);
01987 addEvent(EventFontChanged); addEvent(EventAlphaChanged); addEvent(EventIDChanged);
01988 addEvent(EventActivated); addEvent(EventDeactivated); addEvent(EventShown);
01989 addEvent(EventHidden); addEvent(EventEnabled); addEvent(EventDisabled);
01990 addEvent(EventMetricsModeChanged); addEvent(EventClippedByParentChanged); addEvent(EventDestroyedByParentChanged);
01991 addEvent(EventInheritsAlphaChanged); addEvent(EventAlwaysOnTopChanged); addEvent(EventInputCaptureGained);
01992 addEvent(EventInputCaptureLost); addEvent(EventRenderingStarted); addEvent(EventRenderingEnded);
01993 addEvent(EventChildAdded); addEvent(EventChildRemoved); addEvent(EventDestructionStarted);
01994 addEvent(EventZOrderChanged); addEvent(EventParentSized); addEvent(EventDragDropItemEnters);
01995 addEvent(EventDragDropItemLeaves); addEvent(EventDragDropItemDropped); addEvent(EventVerticalAlignmentChanged);
01996 addEvent(EventHorizontalAlignmentChanged);
01997
01998
01999 addEvent(EventMouseEnters); addEvent(EventMouseLeaves); addEvent(EventMouseMove);
02000 addEvent(EventMouseWheel); addEvent(EventMouseButtonDown); addEvent(EventMouseButtonUp);
02001 addEvent(EventMouseClick); addEvent(EventMouseDoubleClick); addEvent(EventMouseTripleClick);
02002 addEvent(EventKeyDown); addEvent(EventKeyUp); addEvent(EventCharacterKey);
02003 }
02004
02005
02006
02007
02008
02009 void Window::cleanupChildren(void)
02010 {
02011 while(getChildCount() != 0)
02012 {
02013 Window* wnd = d_children[0];
02014
02015
02016 removeChildWindow(wnd);
02017
02018
02019 if (wnd->isDestroyedByParent())
02020 {
02021 WindowManager::getSingleton().destroyWindow(wnd);
02022 }
02023
02024 }
02025
02026 }
02027
02028
02029
02030
02031
02032 void Window::addChild_impl(Window* wnd)
02033 {
02034
02035 if (wnd->getParent() != NULL)
02036 wnd->getParent()->removeChildWindow(wnd);
02037
02038 addWindowToDrawList(*wnd);
02039
02040
02041 d_children.push_back(wnd);
02042
02043
02044 wnd->setParent(this);
02045
02046
02047 WindowEventArgs args(this);
02048 wnd->onParentSized(args);
02049 }
02050
02051
02052
02053
02054
02055 void Window::removeChild_impl(Window* wnd)
02056 {
02057
02058 removeWindowFromDrawList(*wnd);
02059
02060
02061 if (!d_children.empty())
02062 {
02063
02064 ChildList::iterator position = std::find(d_children.begin(), d_children.end(), wnd);
02065
02066
02067 if (position != d_children.end())
02068 {
02069
02070 d_children.erase(position);
02071
02072 wnd->setParent(0);
02073 }
02074 }
02075 }
02076
02077
02078
02079
02080
02081 void Window::onZChange_impl(void)
02082 {
02083 if (d_parent == NULL)
02084 {
02085 WindowEventArgs args(this);
02086 onZChanged(args);
02087 }
02088 else
02089 {
02090 uint child_count = d_parent->getChildCount();
02091
02092 for (uint i = 0; i < child_count; ++i)
02093 {
02094 WindowEventArgs args(d_parent->d_children[i]);
02095 d_parent->d_children[i]->onZChanged(args);
02096 }
02097
02098 }
02099
02100 }
02101
02102
02103
02104
02105
02106 Rect Window::absoluteToRelative_impl(const Window* window, const Rect& rect) const
02107 {
02108
02109 Size sz = getWindowSize_impl(window);
02110
02111 Rect tmp;
02112
02113 if (sz.d_width)
02114 {
02115 tmp.d_left = PixelAligned(rect.d_left) / sz.d_width;
02116 tmp.d_right = PixelAligned(rect.d_right) / sz.d_width;
02117 }
02118 else
02119 {
02120 tmp.d_left = tmp.d_right = 0;
02121 }
02122
02123 if (sz.d_height)
02124 {
02125 tmp.d_top = PixelAligned(rect.d_top) / sz.d_height;
02126 tmp.d_bottom = PixelAligned(rect.d_bottom) / sz.d_height;
02127 }
02128 else
02129 {
02130 tmp.d_top = tmp.d_bottom= 0;
02131 }
02132
02133 return tmp;
02134 }
02135
02136
02137
02138
02139
02140 Size Window::absoluteToRelative_impl(const Window* window, const Size& sz) const
02141 {
02142
02143 Size wndsz = getWindowSize_impl(window);
02144
02145 Size tmp;
02146
02147 if (wndsz.d_width)
02148 {
02149 tmp.d_width = PixelAligned(sz.d_width) / wndsz.d_width;
02150 }
02151 else
02152 {
02153 tmp.d_width = 0;
02154 }
02155
02156 if (wndsz.d_height)
02157 {
02158 tmp.d_height = PixelAligned(sz.d_height) / wndsz.d_height;
02159 }
02160 else
02161 {
02162 tmp.d_height = 0;
02163 }
02164
02165 return tmp;
02166 }
02167
02168
02169
02170
02171
02172 Point Window::absoluteToRelative_impl(const Window* window, const Point& pt) const
02173 {
02174
02175 Size sz = getWindowSize_impl(window);
02176
02177 Point tmp;
02178
02179 if (sz.d_width)
02180 {
02181 tmp.d_x = PixelAligned(pt.d_x) / sz.d_width;
02182 }
02183 else
02184 {
02185 tmp.d_x = 0;
02186 }
02187
02188 if (sz.d_height)
02189 {
02190 tmp.d_y = PixelAligned(pt.d_y) / sz.d_height;
02191 }
02192 else
02193 {
02194 tmp.d_y = 0;
02195 }
02196
02197 return tmp;
02198 }
02199
02200
02201
02202
02203
02204 float Window::absoluteToRelativeX_impl(const Window* window, float x) const
02205 {
02206
02207 Size sz = getWindowSize_impl(window);
02208
02209 if (sz.d_width)
02210 {
02211 return PixelAligned(x) / sz.d_width;
02212 }
02213 else
02214 {
02215 return 0;
02216 }
02217 }
02218
02219
02220
02221
02222
02223 float Window::absoluteToRelativeY_impl(const Window* window, float y) const
02224 {
02225
02226 Size sz = getWindowSize_impl(window);
02227
02228 if (sz.d_height)
02229 {
02230 return PixelAligned(y) / sz.d_height;
02231 }
02232 else
02233 {
02234 return 0;
02235 }
02236 }
02237
02238
02239
02240
02241
02242 Rect Window::relativeToAbsolute_impl(const Window* window, const Rect& rect) const
02243 {
02244
02245 Size sz = getWindowSize_impl(window);
02246
02247 return Rect(
02248 PixelAligned(rect.d_left * sz.d_width),
02249 PixelAligned(rect.d_top * sz.d_height),
02250 PixelAligned(rect.d_right * sz.d_width),
02251 PixelAligned(rect.d_bottom * sz.d_height)
02252 );
02253 }
02254
02255
02256
02257
02258
02259 Size Window::relativeToAbsolute_impl(const Window* window, const Size& sz) const
02260 {
02261
02262 Size wndsz = getWindowSize_impl(window);
02263
02264 return Size(
02265 PixelAligned(sz.d_width * wndsz.d_width),
02266 PixelAligned(sz.d_height * wndsz.d_height)
02267 );
02268 }
02269
02270
02271
02272
02273
02274 Point Window::relativeToAbsolute_impl(const Window* window, const Point& pt) const
02275 {
02276
02277 Size sz = getWindowSize_impl(window);
02278
02279 return Point(
02280 PixelAligned(pt.d_x * sz.d_width),
02281 PixelAligned(pt.d_y * sz.d_height)
02282 );
02283 }
02284
02285
02286
02287
02288
02289 float Window::relativeToAbsoluteX_impl(const Window* window, float x) const
02290 {
02291
02292 Size sz = getWindowSize_impl(window);
02293
02294 return PixelAligned(x * sz.d_width);
02295 }
02296
02297
02298
02299
02300
02301 float Window::relativeToAbsoluteY_impl(const Window* window, float y) const
02302 {
02303
02304 Size sz = getWindowSize_impl(window);
02305
02306 return PixelAligned(y * sz.d_height);
02307 }
02308
02309
02310
02311
02312
02313 Size Window::getWindowSize_impl(const Window* window) const
02314 {
02315 if (window == NULL)
02316 {
02317 return System::getSingleton().getRenderer()->getSize();
02318 }
02319 else
02320 {
02321 return window->getAbsoluteSize();
02322 }
02323
02324 }
02325
02326
02327
02328
02329
02330 Size Window::getMaximumSize(void) const
02331 {
02332 if (getMetricsMode() == Absolute)
02333 {
02334 return d_maxSize.asAbsolute(System::getSingleton().getRenderer()->getSize()).asSize();
02335 }
02336 else
02337 {
02338 return d_maxSize.asRelative(System::getSingleton().getRenderer()->getSize()).asSize();
02339 }
02340
02341 }
02342
02343
02344
02345
02346
02347 Size Window::getMinimumSize(void) const
02348 {
02349 if (getMetricsMode() == Absolute)
02350 {
02351 return d_minSize.asAbsolute(System::getSingleton().getRenderer()->getSize()).asSize();
02352 }
02353 else
02354 {
02355 return d_minSize.asRelative(System::getSingleton().getRenderer()->getSize()).asSize();
02356 }
02357
02358 }
02359
02360
02361
02362
02363
02364 void Window::setMinimumSize(const Size& sz)
02365 {
02366 UVector2 usz;
02367
02368 if (getMetricsMode() == Absolute)
02369 {
02370 usz.d_x = cegui_absdim(PixelAligned(sz.d_width));
02371 usz.d_y = cegui_absdim(PixelAligned(sz.d_height));
02372 }
02373 else
02374 {
02375 usz.d_x = cegui_reldim(sz.d_width);
02376 usz.d_y = cegui_reldim(sz.d_height);
02377 }
02378
02379 setWindowMinSize(usz);
02380 }
02381
02382
02383
02384
02385
02386 void Window::setMaximumSize(const Size& sz)
02387 {
02388 UVector2 usz;
02389
02390 if (getMetricsMode() == Absolute)
02391 {
02392 usz.d_x = cegui_absdim(PixelAligned(sz.d_width));
02393 usz.d_y = cegui_absdim(PixelAligned(sz.d_height));
02394 }
02395 else
02396 {
02397 usz.d_x = cegui_reldim(sz.d_width);
02398 usz.d_y = cegui_reldim(sz.d_height);
02399 }
02400
02401 setWindowMaxSize(usz);
02402 }
02403
02404
02405
02406
02407
02408
02409 const Image* Window::getMouseCursor(bool useDefault) const
02410 {
02411 if (d_mouseCursor != (const Image*)DefaultMouseCursor)
02412 {
02413 return d_mouseCursor;
02414 }
02415 else
02416 {
02417 return useDefault ? System::getSingleton().getDefaultMouseCursor() : 0;
02418 }
02419
02420 }
02421
02422
02423
02424
02425
02426
02427 void Window::setMouseCursor(const String& imageset, const String& image_name)
02428 {
02429 d_mouseCursor = &ImagesetManager::getSingleton().getImageset(imageset)->getImage(image_name);
02430 }
02431
02432
02433
02434
02435
02436 void Window::setID(uint ID)
02437 {
02438 if (d_ID != ID)
02439 {
02440 d_ID = ID;
02441
02442 WindowEventArgs args(this);
02443 onIDChanged(args);
02444 }
02445
02446 }
02447
02448
02449
02450
02451
02452 void Window::setMetricsMode(MetricsMode mode)
02453 {
02454 if (d_metricsMode != mode)
02455 {
02456 MetricsMode oldMode = d_metricsMode;
02457 d_metricsMode = mode;
02458
02459
02460 if ((d_metricsMode != Inherited) || (oldMode != getMetricsMode()))
02461 {
02462 WindowEventArgs args(this);
02463 onMetricsChanged(args);
02464 }
02465
02466 }
02467
02468 }
02469
02470
02471
02472
02473
02474
02475 void Window::setDestroyedByParent(bool setting)
02476 {
02477 if (d_destroyedByParent != setting)
02478 {
02479 d_destroyedByParent = setting;
02480
02481 WindowEventArgs args(this);
02482 onParentDestroyChanged(args);
02483 }
02484
02485 }
02486
02487
02488
02489
02490
02491
02492 MetricsMode Window::getInheritedMetricsMode(void) const
02493 {
02494 return (d_parent == NULL) ? Relative : d_parent->getMetricsMode();
02495 }
02496
02497
02498
02499
02500
02501 float Window::getXPosition(MetricsMode mode) const
02502 {
02503
02504 if (mode == Inherited)
02505 {
02506 mode = getInheritedMetricsMode();
02507 }
02508
02509 return (mode == Relative) ? getRelativeXPosition() : getAbsoluteXPosition();
02510 }
02511
02512
02513
02514
02515
02516 float Window::getYPosition(MetricsMode mode) const
02517 {
02518
02519 if (mode == Inherited)
02520 {
02521 mode = getInheritedMetricsMode();
02522 }
02523
02524 return (mode == Relative) ? getRelativeYPosition() : getAbsoluteYPosition();
02525 }
02526
02527
02528
02529
02530
02531 Point Window::getPosition(MetricsMode mode) const
02532 {
02533
02534 if (mode == Inherited)
02535 {
02536 mode = getInheritedMetricsMode();
02537 }
02538
02539 return (mode == Relative) ? getRelativePosition() : getAbsolutePosition();
02540 }
02541
02542
02543
02544
02545
02546 float Window::getWidth(MetricsMode mode) const
02547 {
02548
02549 if (mode == Inherited)
02550 {
02551 mode = getInheritedMetricsMode();
02552 }
02553
02554 return (mode == Relative) ? getRelativeWidth() : getAbsoluteWidth();
02555 }
02556
02557
02558
02559
02560
02561 float Window::getHeight(MetricsMode mode) const
02562 {
02563
02564 if (mode == Inherited)
02565 {
02566 mode = getInheritedMetricsMode();
02567 }
02568
02569 return (mode == Relative) ? getRelativeHeight() : getAbsoluteHeight();
02570 }
02571
02572
02573
02574
02575
02576 Size Window::getSize(MetricsMode mode) const
02577 {
02578
02579 if (mode == Inherited)
02580 {
02581 mode = getInheritedMetricsMode();
02582 }
02583
02584 return (mode == Relative) ? getRelativeSize() : getAbsoluteSize();
02585 }
02586
02587
02588
02589
02590
02591
02592 Rect Window::getRect(MetricsMode mode) const
02593 {
02594
02595 if (mode == Inherited)
02596 {
02597 mode = getInheritedMetricsMode();
02598 }
02599
02600 return (mode == Relative) ? getRelativeRect() : getAbsoluteRect();
02601 }
02602
02603
02604
02605
02606
02607 void Window::setXPosition(MetricsMode mode, float x)
02608 {
02609 setPosition(mode, Point(x, getYPosition(mode)));
02610 }
02611
02612
02613
02614
02615
02616 void Window::setYPosition(MetricsMode mode, float y)
02617 {
02618 setPosition(mode, Point(getXPosition(mode), y));
02619 }
02620
02621
02622
02623
02624
02625 void Window::setPosition(MetricsMode mode, const Point& position)
02626 {
02627 if (mode == Inherited)
02628 {
02629 mode = getInheritedMetricsMode();
02630 }
02631
02632 if (mode == Relative)
02633 {
02634 setWindowPosition(UVector2(cegui_reldim(position.d_x), cegui_reldim(position.d_y)));
02635 }
02636 else
02637 {
02638 setWindowPosition(UVector2(cegui_absdim(PixelAligned(position.d_x)), cegui_absdim(PixelAligned(position.d_y))));
02639 }
02640 }
02641
02642
02643
02644
02645
02646 void Window::setWidth(MetricsMode mode, float width)
02647 {
02648 setSize(mode, Size(width, getHeight(mode)));
02649 }
02650
02651
02652
02653
02654
02655 void Window::setHeight(MetricsMode mode, float height)
02656 {
02657 setSize(mode, Size(getWidth(mode), height));
02658 }
02659
02660
02661
02662
02663
02664 void Window::setSize(MetricsMode mode, const Size& size)
02665 {
02666 if (mode == Inherited)
02667 {
02668 mode = getInheritedMetricsMode();
02669 }
02670
02671 UVector2 usz(((mode == Relative) ? UVector2(cegui_reldim(size.d_width), cegui_reldim(size.d_height)) : UVector2(cegui_absdim(PixelAligned(size.d_width)), cegui_absdim(PixelAligned(size.d_height)))));
02672
02673 setWindowSize(usz);
02674 }
02675
02676
02677
02678
02679
02680
02681 void Window::setRect(MetricsMode mode, const Rect& area)
02682 {
02683 if (mode == Inherited)
02684 {
02685 mode = getInheritedMetricsMode();
02686 }
02687
02688 URect uarea;
02689
02690 if (mode == Relative)
02691 {
02692 uarea = URect(
02693 cegui_reldim(area.d_left),
02694 cegui_reldim(area.d_top),
02695 cegui_reldim(area.d_right),
02696 cegui_reldim(area.d_bottom)
02697 );
02698 }
02699 else
02700 {
02701 uarea = URect(
02702 cegui_absdim(PixelAligned(area.d_left)),
02703 cegui_absdim(PixelAligned(area.d_top)),
02704 cegui_absdim(PixelAligned(area.d_right)),
02705 cegui_absdim(PixelAligned(area.d_bottom))
02706 );
02707 }
02708
02709 setWindowArea(uarea);
02710 }
02711
02712
02713
02714
02715
02716 void Window::generateAutoRepeatEvent(MouseButton button)
02717 {
02718 MouseEventArgs ma(this);
02719 ma.position = MouseCursor::getSingleton().getPosition();
02720 ma.moveDelta = Vector2(0.0f, 0.0f);
02721 ma.button = button;
02722 ma.sysKeys = System::getSingleton().getSystemKeys();
02723 ma.wheelChange = 0;
02724 onMouseButtonDown(ma);
02725 }
02726
02727
02728
02729
02730
02731 void Window::addStandardProperties(void)
02732 {
02733 addProperty(&d_absHeightProperty);
02734 addProperty(&d_absMaxSizeProperty);
02735 addProperty(&d_absMinSizeProperty);
02736 addProperty(&d_absPositionProperty);
02737 addProperty(&d_absRectProperty);
02738 addProperty(&d_absSizeProperty);
02739 addProperty(&d_absWidthProperty);
02740 addProperty(&d_absXPosProperty);
02741 addProperty(&d_absYPosProperty);
02742 addProperty(&d_alphaProperty);
02743 addProperty(&d_alwaysOnTopProperty);
02744 addProperty(&d_clippedByParentProperty);
02745 addProperty(&d_destroyedByParentProperty);
02746 addProperty(&d_disabledProperty);
02747 addProperty(&d_fontProperty);
02748 addProperty(&d_heightProperty);
02749 addProperty(&d_IDProperty);
02750 addProperty(&d_inheritsAlphaProperty);
02751 addProperty(&d_metricsModeProperty);
02752 addProperty(&d_mouseCursorProperty);
02753 addProperty(&d_positionProperty);
02754 addProperty(&d_rectProperty);
02755 addProperty(&d_relHeightProperty);
02756 addProperty(&d_relMaxSizeProperty);
02757 addProperty(&d_relMinSizeProperty);
02758 addProperty(&d_relPositionProperty);
02759 addProperty(&d_relRectProperty);
02760 addProperty(&d_relSizeProperty);
02761 addProperty(&d_relWidthProperty);
02762 addProperty(&d_relXPosProperty);
02763 addProperty(&d_relYPosProperty);
02764 addProperty(&d_restoreOldCaptureProperty);
02765 addProperty(&d_sizeProperty);
02766 addProperty(&d_textProperty);
02767 addProperty(&d_visibleProperty);
02768 addProperty(&d_widthProperty);
02769 addProperty(&d_xPosProperty);
02770 addProperty(&d_yPosProperty);
02771 addProperty(&d_zOrderChangeProperty);
02772 addProperty(&d_wantsMultiClicksProperty);
02773 addProperty(&d_autoRepeatProperty);
02774 addProperty(&d_autoRepeatDelayProperty);
02775 addProperty(&d_autoRepeatRateProperty);
02776 addProperty(&d_distInputsProperty);
02777 addProperty(&d_tooltipTypeProperty);
02778 addProperty(&d_tooltipProperty);
02779 addProperty(&d_inheritsTooltipProperty);
02780 addProperty(&d_riseOnClickProperty);
02781 addProperty(&d_vertAlignProperty);
02782 addProperty(&d_horzAlignProperty);
02783 addProperty(&d_unifiedAreaRectProperty);
02784 addProperty(&d_unifiedPositionProperty);
02785 addProperty(&d_unifiedXPositionProperty);
02786 addProperty(&d_unifiedYPositionProperty);
02787 addProperty(&d_unifiedSizeProperty);
02788 addProperty(&d_unifiedWidthProperty);
02789 addProperty(&d_unifiedHeightProperty);
02790 addProperty(&d_unifiedMinSizeProperty);
02791 addProperty(&d_unifiedMaxSizeProperty);
02792 }
02793
02794
02795
02796
02797
02798 bool Window::isZOrderingEnabled(void) const
02799 {
02800 return d_zOrderingEnabled;
02801 }
02802
02803
02804
02805
02806
02807 void Window::setZOrderingEnabled(bool setting)
02808 {
02809 if (d_zOrderingEnabled != setting)
02810 {
02811 d_zOrderingEnabled = setting;
02812 }
02813
02814 }
02815
02816
02817
02818
02819
02820
02821 bool Window::wantsMultiClickEvents(void) const
02822 {
02823 return d_wantsMultiClicks;
02824 }
02825
02826
02827
02828
02829
02830
02831 void Window::setWantsMultiClickEvents(bool setting)
02832 {
02833 if (d_wantsMultiClicks != setting)
02834 {
02835 d_wantsMultiClicks = setting;
02836
02837
02838 }
02839
02840 }
02841
02842
02843
02844
02845
02846
02847 bool Window::isMouseAutoRepeatEnabled(void) const
02848 {
02849 return d_autoRepeat;
02850 }
02851
02852
02853
02854
02855
02856 float Window::getAutoRepeatDelay(void) const
02857 {
02858 return d_repeatDelay;
02859 }
02860
02861
02862
02863
02864
02865 float Window::getAutoRepeatRate(void) const
02866 {
02867 return d_repeatRate;
02868 }
02869
02870
02871
02872
02873
02874
02875 void Window::setMouseAutoRepeatEnabled(bool setting)
02876 {
02877 if (d_autoRepeat != setting)
02878 {
02879 d_autoRepeat = setting;
02880 d_repeatButton = NoButton;
02881
02882
02883 }
02884
02885 }
02886
02887
02888
02889
02890
02891 void Window::setAutoRepeatDelay(float delay)
02892 {
02893 if (d_repeatDelay != delay)
02894 {
02895 d_repeatDelay = delay;
02896
02897
02898 }
02899
02900 }
02901
02902
02903
02904
02905
02906 void Window::setAutoRepeatRate(float rate)
02907 {
02908 if (d_repeatRate != rate)
02909 {
02910 d_repeatRate = rate;
02911
02912
02913 }
02914
02915 }
02916
02917
02918
02919
02920
02921 void Window::update(float elapsed)
02922 {
02923
02924 updateSelf(elapsed);
02925
02926
02927 uint child_count = getChildCount();
02928
02929 for (uint i = 0; i < child_count; ++i)
02930 {
02931 d_children[i]->update(elapsed);
02932 }
02933
02934 }
02935
02936
02937
02938
02939
02940 void Window::updateSelf(float elapsed)
02941 {
02942
02943 if (d_autoRepeat && d_repeatButton != NoButton)
02944 {
02945 d_repeatElapsed += elapsed;
02946
02947 if (d_repeating)
02948 {
02949 if (d_repeatElapsed > d_repeatRate)
02950 {
02951 d_repeatElapsed -= d_repeatRate;
02952
02953 generateAutoRepeatEvent(d_repeatButton);
02954 }
02955 }
02956 else
02957 {
02958 if (d_repeatElapsed > d_repeatDelay)
02959 {
02960 d_repeatElapsed = 0;
02961 d_repeating = true;
02962
02963 generateAutoRepeatEvent(d_repeatButton);
02964 }
02965 }
02966 }
02967 }
02968
02969 bool Window::distributesCapturedInputs(void) const
02970 {
02971 return d_distCapturedInputs;
02972 }
02973
02974 void Window::setDistributesCapturedInputs(bool setting)
02975 {
02976 if (d_distCapturedInputs != setting)
02977 {
02978 d_distCapturedInputs = setting;
02979
02980
02981 }
02982 }
02983
02984 void Window::notifyDragDropItemEnters(DragContainer* item)
02985 {
02986 if (item)
02987 {
02988 DragDropEventArgs args(this);
02989 args.dragDropItem = item;
02990 onDragDropItemEnters(args);
02991 }
02992 }
02993
02994 void Window::notifyDragDropItemLeaves(DragContainer* item)
02995 {
02996 if (item)
02997 {
02998 DragDropEventArgs args(this);
02999 args.dragDropItem = item;
03000 onDragDropItemLeaves(args);
03001 }
03002 }
03003
03004 void Window::notifyDragDropItemDropped(DragContainer* item)
03005 {
03006 if (item)
03007 {
03008 DragDropEventArgs args(this);
03009 args.dragDropItem = item;
03010 onDragDropItemDropped(args);
03011 }
03012 }
03013
03014 void Window::destroy(void)
03015 {
03016
03017
03018
03019 WindowManager& wmgr = WindowManager::getSingleton();
03020
03021 if (wmgr.isWindowPresent(this->getName()))
03022 {
03023 wmgr.destroyWindow(this);
03024
03025
03026
03027 return;
03028 }
03029
03030 releaseInput();
03031
03032
03033 WindowEventArgs args(this);
03034 onDestructionStarted(args);
03035
03036
03037 if (d_parent != NULL)
03038 {
03039 d_parent->removeChildWindow(this);
03040 }
03041
03042 cleanupChildren();
03043 }
03044
03045 bool Window::isUsingDefaultTooltip(void) const
03046 {
03047 return d_customTip == 0;
03048 }
03049
03050 Tooltip* Window::getTooltip(void) const
03051 {
03052 return isUsingDefaultTooltip() ? System::getSingleton().getDefaultTooltip() : d_customTip;
03053 }
03054
03055 void Window::setTooltip(Tooltip* tooltip)
03056 {
03057
03058 if (d_customTip && d_weOwnTip)
03059 WindowManager::getSingleton().destroyWindow(d_customTip);
03060
03061
03062 d_weOwnTip = false;
03063 d_customTip = tooltip;
03064 }
03065
03066 void Window::setTooltipType(const String& tooltipType)
03067 {
03068
03069 if (d_customTip && d_weOwnTip)
03070 WindowManager::getSingleton().destroyWindow(d_customTip);
03071
03072 if (tooltipType.empty())
03073 {
03074 d_customTip = 0;
03075 d_weOwnTip = false;
03076 }
03077 else
03078 {
03079 try
03080 {
03081 d_customTip = static_cast<Tooltip*>(WindowManager::getSingleton().createWindow(tooltipType, getName() + "__auto_tooltip__"));
03082 d_weOwnTip = true;
03083 }
03084 catch (UnknownObjectException x)
03085 {
03086 d_customTip = 0;
03087 d_weOwnTip = false;
03088 }
03089 }
03090 }
03091
03092 String Window::getTooltipType(void) const
03093 {
03094 return isUsingDefaultTooltip() ? String("") : d_customTip->getType();
03095 }
03096
03097 void Window::setTooltipText(const String& tip)
03098 {
03099 d_tooltipText = tip;
03100
03101 Tooltip* tooltip = getTooltip();
03102
03103 if (tooltip && tooltip->getTargetWindow() == this)
03104 {
03105 tooltip->setText(tip);
03106 }
03107 }
03108
03109 const String& Window::getTooltipText(void) const
03110 {
03111 if (d_inheritsTipText && d_parent && d_tooltipText.empty())
03112 {
03113 return d_parent->getTooltipText();
03114 }
03115 else
03116 {
03117 return d_tooltipText;
03118 }
03119 }
03120
03121 bool Window::inheritsTooltipText(void) const
03122 {
03123 return d_inheritsTipText;
03124 }
03125
03126 void Window::setInheritsTooltipText(bool setting)
03127 {
03128 if (d_inheritsTipText != setting)
03129 {
03130 d_inheritsTipText = setting;
03131
03132
03133 }
03134 }
03135
03136 void Window::doRiseOnClick(void)
03137 {
03138
03139 if (d_riseOnClick)
03140 {
03141 moveToFront_impl(true);
03142 }
03143 else if (d_parent)
03144 {
03145 d_parent->doRiseOnClick();
03146 }
03147 }
03148
03149 void Window::setWindowArea_impl(const UVector2& pos, const UVector2& size, bool topLeftSizing, bool fireEvents)
03150 {
03151
03152 bool moved = false, sized;
03153
03154
03155 Size oldSize(d_pixelSize);
03156
03157
03158 Vector2 absMax(d_maxSize.asAbsolute(System::getSingleton().getRenderer()->getSize()));
03159 Vector2 absMin(d_minSize.asAbsolute(System::getSingleton().getRenderer()->getSize()));
03160 d_pixelSize = size.asAbsolute(getParentSize()).asSize();
03161
03162
03163 if (d_pixelSize.d_width < absMin.d_x)
03164 d_pixelSize.d_width = absMin.d_x;
03165 else if (d_pixelSize.d_width > absMax.d_x)
03166 d_pixelSize.d_width = absMax.d_x;
03167 if (d_pixelSize.d_height < absMin.d_y)
03168 d_pixelSize.d_height = absMin.d_y;
03169 else if (d_pixelSize.d_height > absMax.d_y)
03170 d_pixelSize.d_height = absMax.d_y;
03171
03172 d_area.setSize(size);
03173 sized = (d_pixelSize != oldSize);
03174
03175
03176
03177 if (!topLeftSizing || sized)
03178 {
03179
03180 if (pos != d_area.d_min)
03181 {
03182 d_area.setPosition(pos);
03183 moved = true;
03184 }
03185 }
03186
03187
03188 if (fireEvents)
03189 {
03190 WindowEventArgs args(this);
03191
03192 if (moved)
03193 {
03194 onMoved(args);
03195
03196 args.handled = false;
03197 }
03198
03199 if (sized)
03200 {
03201 onSized(args);
03202 }
03203 }
03204 }
03205
03206 void Window::setWindowArea(const UDim& xpos, const UDim& ypos, const UDim& width, const UDim& height)
03207 {
03208 setWindowArea(UVector2(xpos, ypos), UVector2(width, height));
03209 }
03210
03211 void Window::setWindowArea(const UVector2& pos, const UVector2& size)
03212 {
03213 setWindowArea_impl(pos, size);
03214 }
03215
03216 void Window::setWindowArea(const URect& area)
03217 {
03218 setWindowArea(area.d_min, area.getSize());
03219 }
03220
03221 void Window::setWindowPosition(const UVector2& pos)
03222 {
03223 setWindowArea_impl(pos, d_area.getSize());
03224 }
03225
03226 void Window::setWindowXPosition(const UDim& x)
03227 {
03228 setWindowArea_impl(UVector2(x, d_area.d_min.d_y), d_area.getSize());
03229 }
03230
03231 void Window::setWindowYPosition(const UDim& y)
03232 {
03233 setWindowArea_impl(UVector2(d_area.d_min.d_x, y), d_area.getSize());
03234 }
03235
03236 void Window::setWindowSize(const UVector2& size)
03237 {
03238 setWindowArea_impl(d_area.getPosition(), size);
03239 }
03240
03241 void Window::setWindowWidth(const UDim& width)
03242 {
03243 setWindowArea_impl(d_area.getPosition(), UVector2(width, d_area.getSize().d_y));
03244 }
03245
03246 void Window::setWindowHeight(const UDim& height)
03247 {
03248 setWindowArea_impl(d_area.getPosition(), UVector2(d_area.getSize().d_x, height));
03249 }
03250
03251 void Window::setWindowMaxSize(const UVector2& size)
03252 {
03253 d_maxSize = size;
03254
03255
03256 setWindowArea(d_area);
03257 }
03258
03259 void Window::setWindowMinSize(const UVector2& size)
03260 {
03261 d_minSize = size;
03262
03263
03264 setWindowArea(d_area);
03265 }
03266
03267 const URect& Window::getWindowArea() const
03268 {
03269 return d_area;
03270 }
03271
03272 const UVector2& Window::getWindowPosition() const
03273 {
03274 return d_area.d_min;
03275 }
03276
03277 const UDim& Window::getWindowXPosition() const
03278 {
03279 return d_area.d_min.d_x;
03280 }
03281
03282 const UDim& Window::getWindowYPosition() const
03283 {
03284 return d_area.d_min.d_y;
03285 }
03286
03287 UVector2 Window::getWindowSize() const
03288 {
03289 return d_area.getSize();
03290 }
03291
03292 UDim Window::getWindowWidth() const
03293 {
03294 return d_area.getSize().d_x;
03295 }
03296
03297 UDim Window::getWindowHeight() const
03298 {
03299 return d_area.getSize().d_y;
03300 }
03301
03302 const UVector2& Window::getWindowMaxSize() const
03303 {
03304 return d_maxSize;
03305 }
03306
03307 const UVector2& Window::getWindowMinSize() const
03308 {
03309 return d_minSize;
03310 }
03311
03312 void Window::setVerticalAlignment(const VerticalAlignment alignment)
03313 {
03314 if (d_vertAlign != alignment)
03315 {
03316 d_vertAlign = alignment;
03317
03318 WindowEventArgs args(this);
03319 onVerticalAlignmentChanged(args);
03320 }
03321 }
03322
03323 void Window::setHorizontalAlignment(const HorizontalAlignment alignment)
03324 {
03325 if (d_horzAlign != alignment)
03326 {
03327 d_horzAlign = alignment;
03328
03329 WindowEventArgs args(this);
03330 onHorizontalAlignmentChanged(args);
03331 }
03332 }
03333
03334 const String& Window::getLookNFeel()
03335 {
03336 return d_lookName;
03337 }
03338
03339 void Window::setLookNFeel(const String& falagardType, const String& look)
03340 {
03341 if (d_lookName.empty())
03342 {
03343 d_falagardType = falagardType;
03344 d_lookName = look;
03345 Logger::getSingleton().logEvent("Assigning LookNFeel '" + look +"' to window '" + d_name + "'.", Informative);
03346
03347
03348 const WidgetLookFeel& wlf = WidgetLookManager::getSingleton().getWidgetLook(look);
03349
03350 wlf.initialiseWidget(*this);
03351 }
03352 else
03353 {
03354 throw InvalidRequestException("Window::setLookNFeel - The window '" + d_name + "' already has a look assigned (" + d_lookName + ").");
03355 }
03356 }
03357
03358 void Window::setModalState(bool state)
03359 {
03360 bool already_modal = getModalState();
03361
03362
03363 if (state == true && !already_modal)
03364 {
03365 activate();
03366 System::getSingleton().setModalTarget(this);
03367 }
03368
03369 else if (already_modal)
03370 {
03371 System::getSingleton().setModalTarget(NULL);
03372 }
03373 }
03374
03375 void Window::performChildWindowLayout()
03376 {
03377 if (!d_lookName.empty())
03378 {
03379
03380 try
03381 {
03382 const WidgetLookFeel& wlf = WidgetLookManager::getSingleton().getWidgetLook(d_lookName);
03383
03384 wlf.layoutChildWidgets(*this);
03385 }
03386 catch (UnknownObjectException)
03387 {
03388 Logger::getSingleton().logEvent("Window::performChildWindowLayout - assigned widget look was not found.", Errors);
03389 }
03390 }
03391 }
03392
03393 const String& Window::getUserString(const String& name) const
03394 {
03395 UserStringMap::const_iterator iter = d_userStrings.find(name);
03396
03397 if (iter != d_userStrings.end())
03398 {
03399 return (*iter).second;
03400 }
03401 else
03402 {
03403 throw UnknownObjectException("Window::getUserString - a user string named '" + name + "' has not been set for this Window.");
03404 }
03405 }
03406
03407 bool Window::isUserStringDefined(const String& name) const
03408 {
03409 return d_userStrings.find(name) != d_userStrings.end();
03410 }
03411
03412 void Window::setUserString(const String& name, const String& value)
03413 {
03414 d_userStrings[name] = value;
03415 }
03416
03417 void Window::writeXMLToStream(OutStream& out_stream) const
03418 {
03419
03420 out_stream << "<Window Type=\"" << getType() << "\" ";
03421
03422 if (getName().compare(0, WindowManager::GeneratedWindowNameBase.length(), WindowManager::GeneratedWindowNameBase) != 0)
03423 {
03424 out_stream << "Name=\"" << getName() << "\" ";
03425 }
03426
03427 out_stream << ">" << std::endl;
03428
03429
03430 writePropertiesXML(out_stream);
03431
03432 writeChildWindowsXML(out_stream);
03433
03434 out_stream << "</Window>" << std::endl;
03435 }
03436
03437 int Window::writePropertiesXML(OutStream& out_stream) const
03438 {
03439 int propertiesWritten = 0;
03440 PropertyIterator iter = PropertySet::getIterator();
03441
03442 while(!iter.isAtEnd())
03443 {
03444
03445 if (!iter.getCurrentValue()->isDefault(this))
03446 {
03447 iter.getCurrentValue()->writeXMLToStream(this, out_stream);
03448 ++propertiesWritten;
03449 }
03450
03451 ++iter;
03452 }
03453
03454 return propertiesWritten;
03455 }
03456
03457 int Window::writeChildWindowsXML(OutStream& out_stream) const
03458 {
03459 int windowsWritten = 0;
03460
03461 for (uint i = 0; i < getChildCount(); ++i)
03462 {
03463 Window* child = d_children[i];
03464
03465
03466 if (child->getName().find("__auto_") == String::npos)
03467 {
03468 child->writeXMLToStream(out_stream);
03469 ++windowsWritten;
03470 }
03471 }
03472
03473 return windowsWritten;
03474 }
03475
03476 void Window::addWindowToDrawList(Window& wnd, bool at_back)
03477 {
03478
03479 if (at_back)
03480 {
03481
03482 ChildList::iterator pos = d_drawList.begin();
03483 if (wnd.isAlwaysOnTop())
03484 {
03485
03486 while ((pos != d_drawList.end()) && (!(*pos)->isAlwaysOnTop()))
03487 ++pos;
03488 }
03489
03490 d_drawList.insert(pos, &wnd);
03491 }
03492
03493 else
03494 {
03495
03496 ChildList::reverse_iterator position = d_drawList.rbegin();
03497 if (!wnd.isAlwaysOnTop())
03498 {
03499
03500 while ((position != d_drawList.rend()) && ((*position)->isAlwaysOnTop()))
03501 ++position;
03502 }
03503
03504 d_drawList.insert(position.base(), &wnd);
03505 }
03506 }
03507
03508 void Window::removeWindowFromDrawList(const Window& wnd)
03509 {
03510
03511 if (!d_drawList.empty())
03512 {
03513
03514 ChildList::iterator position = std::find(d_drawList.begin(), d_drawList.end(), &wnd);
03515
03516
03517 if (position != d_drawList.end())
03518 d_drawList.erase(position);
03519 }
03520 }
03521
03522 Window* Window::getActiveSibling()
03523 {
03524
03525 Window* activeWnd = isActive() ? this : 0;
03526
03527
03528 if (!activeWnd && d_parent)
03529 {
03530
03531
03532 uint idx = d_parent->getChildCount();
03533 while (idx-- > 0)
03534 {
03535
03536 if (d_parent->d_drawList[idx]->isActive())
03537 {
03538
03539 activeWnd = d_parent->d_drawList[idx];
03540
03541 break;
03542 }
03543 }
03544 }
03545
03546
03547 return activeWnd;
03548 }
03549
03550
03552
03553
03554
03555
03556
03558
03559 void Window::onSized(WindowEventArgs& e)
03560 {
03561
03562 uint child_count = getChildCount();
03563 for (uint i = 0; i < child_count; ++i)
03564 {
03565 WindowEventArgs args(this);
03566 d_children[i]->onParentSized(args);
03567 }
03568
03569 performChildWindowLayout();
03570
03571 requestRedraw();
03572
03573 fireEvent(EventSized, e, EventNamespace);
03574 }
03575
03576
03577 void Window::onMoved(WindowEventArgs& e)
03578 {
03579
03580
03581 System::getSingleton().signalRedraw();
03582 fireEvent(EventMoved, e, EventNamespace);
03583 }
03584
03585
03586 void Window::onTextChanged(WindowEventArgs& e)
03587 {
03588 requestRedraw();
03589 fireEvent(EventTextChanged, e, EventNamespace);
03590 }
03591
03592
03593 void Window::onFontChanged(WindowEventArgs& e)
03594 {
03595 requestRedraw();
03596 fireEvent(EventFontChanged, e, EventNamespace);
03597 }
03598
03599
03600 void Window::onAlphaChanged(WindowEventArgs& e)
03601 {
03602
03603 int child_count = getChildCount();
03604
03605 for (int i = 0; i < child_count; ++i)
03606 {
03607 if (d_children[i]->inheritsAlpha())
03608 {
03609 WindowEventArgs args(d_children[i]);
03610 d_children[i]->onAlphaChanged(args);
03611 }
03612
03613 }
03614
03615 requestRedraw();
03616 fireEvent(EventAlphaChanged, e, EventNamespace);
03617 }
03618
03619
03620 void Window::onIDChanged(WindowEventArgs& e)
03621 {
03622 fireEvent(EventIDChanged, e, EventNamespace);
03623 }
03624
03625
03626 void Window::onShown(WindowEventArgs& e)
03627 {
03628 requestRedraw();
03629 fireEvent(EventShown, e, EventNamespace);
03630 }
03631
03632
03633 void Window::onHidden(WindowEventArgs& e)
03634 {
03635 requestRedraw();
03636 fireEvent(EventHidden, e, EventNamespace);
03637 }
03638
03639
03640 void Window::onEnabled(WindowEventArgs& e)
03641 {
03642
03643 uint child_count = getChildCount();
03644 for (uint i = 0; i < child_count; ++i)
03645 {
03646 if (d_children[i]->d_enabled)
03647 {
03648 WindowEventArgs args(d_children[i]);
03649 d_children[i]->onEnabled(args);
03650 }
03651 }
03652
03653 requestRedraw();
03654 fireEvent(EventEnabled, e, EventNamespace);
03655 }
03656
03657
03658 void Window::onDisabled(WindowEventArgs& e)
03659 {
03660
03661 uint child_count = getChildCount();
03662 for (uint i = 0; i < child_count; ++i)
03663 {
03664 if (d_children[i]->d_enabled)
03665 {
03666 WindowEventArgs args(d_children[i]);
03667 d_children[i]->onDisabled(args);
03668 }
03669 }
03670
03671 requestRedraw();
03672 fireEvent(EventDisabled, e, EventNamespace);
03673 }
03674
03675
03676 void Window::onMetricsChanged(WindowEventArgs& e)
03677 {
03678 fireEvent(EventMetricsModeChanged, e, EventNamespace);
03679 }
03680
03681
03682 void Window::onClippingChanged(WindowEventArgs& e)
03683 {
03684 requestRedraw();
03685 fireEvent(EventClippedByParentChanged, e, EventNamespace);
03686 }
03687
03688
03689 void Window::onParentDestroyChanged(WindowEventArgs& e)
03690 {
03691 fireEvent(EventDestroyedByParentChanged, e, EventNamespace);
03692 }
03693
03694
03695 void Window::onInheritsAlphaChanged(WindowEventArgs& e)
03696 {
03697 requestRedraw();
03698 fireEvent(EventInheritsAlphaChanged, e, EventNamespace);
03699 }
03700
03701
03702 void Window::onAlwaysOnTopChanged(WindowEventArgs& e)
03703 {
03704
03705
03706 System::getSingleton().signalRedraw();
03707 fireEvent(EventAlwaysOnTopChanged, e, EventNamespace);
03708 }
03709
03710
03711 void Window::onCaptureGained(WindowEventArgs& e)
03712 {
03713 fireEvent(EventInputCaptureGained, e, EventNamespace);
03714 }
03715
03716
03717 void Window::onCaptureLost(WindowEventArgs& e)
03718 {
03719
03720 d_repeatButton = NoButton;
03721
03722
03723 if (d_restoreOldCapture && (d_oldCapture != NULL)) {
03724 d_oldCapture->onCaptureLost(e);
03725 d_oldCapture = NULL;
03726 }
03727
03728
03729
03730 System::getSingleton().injectMouseMove(0, 0);
03731
03732 fireEvent(EventInputCaptureLost, e, EventNamespace);
03733 }
03734
03735
03736 void Window::onRenderingStarted(WindowEventArgs& e)
03737 {
03738 fireEvent(EventRenderingStarted, e, EventNamespace);
03739 }
03740
03741
03742 void Window::onRenderingEnded(WindowEventArgs& e)
03743 {
03744 fireEvent(EventRenderingEnded, e, EventNamespace);
03745 }
03746
03747
03748 void Window::onZChanged(WindowEventArgs& e)
03749 {
03750
03751
03752 System::getSingleton().signalRedraw();
03753 fireEvent(EventZOrderChanged, e, EventNamespace);
03754 }
03755
03756
03757 void Window::onDestructionStarted(WindowEventArgs& e)
03758 {
03759 fireEvent(EventDestructionStarted, e, EventNamespace);
03760 }
03761
03762
03763 void Window::onActivated(ActivationEventArgs& e)
03764 {
03765 d_active = true;
03766 requestRedraw();
03767 fireEvent(EventActivated, e, EventNamespace);
03768 }
03769
03770
03771 void Window::onDeactivated(ActivationEventArgs& e)
03772 {
03773
03774 uint child_count = getChildCount();
03775 for (uint i = 0; i < child_count; ++i)
03776 {
03777 if (d_children[i]->isActive())
03778 {
03779 d_children[i]->onDeactivated(e);
03780 }
03781
03782 }
03783
03784 d_active = false;
03785 requestRedraw();
03786 fireEvent(EventDeactivated, e, EventNamespace);
03787 }
03788
03789
03790 void Window::onParentSized(WindowEventArgs& e)
03791 {
03792
03793
03794 setWindowArea_impl(d_area.getPosition(), d_area.getSize(), false, false);
03795
03796
03797 if ((d_area.d_min.d_x.d_scale != 0) || (d_area.d_min.d_y.d_scale != 0))
03798 {
03799 WindowEventArgs args(this);
03800 onMoved(args);
03801 }
03802
03803 if ((d_area.d_max.d_x.d_scale != 0) || (d_area.d_max.d_y.d_scale != 0))
03804 {
03805 WindowEventArgs args(this);
03806 onSized(args);
03807 }
03808
03809 fireEvent(EventParentSized, e, EventNamespace);
03810 }
03811
03812
03813 void Window::onChildAdded(WindowEventArgs& e)
03814 {
03815
03816
03817 System::getSingleton().signalRedraw();
03818 fireEvent(EventChildAdded, e, EventNamespace);
03819 }
03820
03821
03822 void Window::onChildRemoved(WindowEventArgs& e)
03823 {
03824
03825
03826 System::getSingleton().signalRedraw();
03827 fireEvent(EventChildRemoved, e, EventNamespace);
03828 }
03829
03830
03831 void Window::onMouseEnters(MouseEventArgs& e)
03832 {
03833
03834 MouseCursor::getSingleton().setImage(getMouseCursor());
03835
03836
03837 Tooltip* tip = getTooltip();
03838 if (tip)
03839 {
03840 tip->setTargetWindow(this);
03841 }
03842
03843 fireEvent(EventMouseEnters, e, EventNamespace);
03844 }
03845
03846
03847 void Window::onMouseLeaves(MouseEventArgs& e)
03848 {
03849
03850 Tooltip* tip = getTooltip();
03851 if (tip)
03852 {
03853 tip->setTargetWindow(0);
03854 }
03855
03856 fireEvent(EventMouseLeaves, e, EventNamespace);
03857 }
03858
03859
03860 void Window::onMouseMove(MouseEventArgs& e)
03861 {
03862
03863 Tooltip* tip = getTooltip();
03864 if (tip)
03865 {
03866 tip->resetTimer();
03867 }
03868
03869 fireEvent(EventMouseMove, e, EventNamespace);
03870 }
03871
03872
03873 void Window::onMouseWheel(MouseEventArgs& e)
03874 {
03875 fireEvent(EventMouseWheel, e, EventNamespace);
03876 }
03877
03878
03879 void Window::onMouseButtonDown(MouseEventArgs& e)
03880 {
03881
03882 Tooltip* tip = getTooltip();
03883 if (tip)
03884 {
03885 tip->setTargetWindow(0);
03886 }
03887
03888 if (e.button == LeftButton)
03889 {
03890 doRiseOnClick();
03891 }
03892
03893
03894
03895
03896 if (d_autoRepeat && d_repeatButton != e.button)
03897 {
03898 d_repeatButton = e.button;
03899 d_repeatElapsed = 0;
03900 d_repeating = false;
03901 }
03902
03903 fireEvent(EventMouseButtonDown, e, EventNamespace);
03904 }
03905
03906
03907 void Window::onMouseButtonUp(MouseEventArgs& e)
03908 {
03909
03910 d_repeatButton = NoButton;
03911
03912 fireEvent(EventMouseButtonUp, e, EventNamespace);
03913 }
03914
03915
03916 void Window::onMouseClicked(MouseEventArgs& e)
03917 {
03918 fireEvent(EventMouseClick, e, EventNamespace);
03919 }
03920
03921
03922 void Window::onMouseDoubleClicked(MouseEventArgs& e)
03923 {
03924 fireEvent(EventMouseDoubleClick, e, EventNamespace);
03925 }
03926
03927
03928 void Window::onMouseTripleClicked(MouseEventArgs& e)
03929 {
03930 fireEvent(EventMouseTripleClick, e, EventNamespace);
03931 }
03932
03933
03934 void Window::onKeyDown(KeyEventArgs& e)
03935 {
03936 fireEvent(EventKeyDown, e, EventNamespace);
03937 }
03938
03939
03940 void Window::onKeyUp(KeyEventArgs& e)
03941 {
03942 fireEvent(EventKeyUp, e, EventNamespace);
03943 }
03944
03945
03946 void Window::onCharacter(KeyEventArgs& e)
03947 {
03948 fireEvent(EventCharacterKey, e, EventNamespace);
03949 }
03950
03951 void Window::onDragDropItemEnters(DragDropEventArgs& e)
03952 {
03953 fireEvent(EventDragDropItemEnters, e, EventNamespace);
03954 }
03955
03956 void Window::onDragDropItemLeaves(DragDropEventArgs& e)
03957 {
03958 fireEvent(EventDragDropItemLeaves, e, EventNamespace);
03959 }
03960
03961 void Window::onDragDropItemDropped(DragDropEventArgs& e)
03962 {
03963 fireEvent(EventDragDropItemDropped, e, EventNamespace);
03964 }
03965
03966 void Window::onVerticalAlignmentChanged(WindowEventArgs& e)
03967 {
03968 fireEvent(EventVerticalAlignmentChanged, e, EventNamespace);
03969 }
03970
03971 void Window::onHorizontalAlignmentChanged(WindowEventArgs& e)
03972 {
03973 fireEvent(EventHorizontalAlignmentChanged, e, EventNamespace);
03974 }
03975
03976 }