/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
struct ImplSVEvent; struct ImplWinData; struct ImplFrameData; struct ImplCalcToTopData; struct SystemEnvData; struct SystemParentData; class ImplBorderWindow; class Timer; class DockingManager; class Scrollable; class FixedText; class MouseEvent; class KeyEvent; class CommandEvent; class TrackingEvent; class HelpEvent; class DataChangedEvent; class NotifyEvent; class SystemWindow; class SalFrame; class MenuFloatingWindow; class VCLXWindow; class VclWindowEvent; class AllSettings; class InputContext; class VclEventListeners; class EditView; enumclass ImplPaintFlags; enumclass VclEventId; enumclass PointerStyle;
namespace com::sun::star { namespace accessibility { class XAccessible;
} namespace awt { class XVclWindowPeer;
} namespace datatransfer::clipboard { class XClipboard;
} namespace datatransfer::dnd { class XDragGestureRecognizer; class XDragSource; class XDropTarget;
}
}
namespace vcl { struct ControlLayoutData;
}
namespace svt { class PopupWindowControllerImpl; }
namespace weld { class Window; }
template<class T> class VclPtr; namespace tools { class JsonWriter; }
// Flags for setPosSizePixel() // These must match the definitions in css::awt::PosSize enumclass PosSizeFlags
{
NONE = 0x0000,
X = 0x0001,
Y = 0x0002,
Width = 0x0004,
Height = 0x0008,
Pos = X | Y,
Size = Width | Height,
PosSize = Pos | Size,
All = PosSize,
};
// Flags for Invalidate // must match css::awt::InvalidateStyle enumclass InvalidateFlags
{
NONE = 0x0000, /** The child windows are invalidated, too. */
Children = 0x0001, /** The child windows are not invalidated. */
NoChildren = 0x0002, /** The invalidated area is painted with the background color/pattern. */
NoErase = 0x0004, /** The invalidated area is updated immediately. */
Update = 0x0008, /** The parent window is invalidated, too. */
Transparent = 0x0010, /** The parent window is not invalidated. */
NoTransparent = 0x0020, /** The area is invalidated regardless of overlapping child windows. */
NoClipChildren = 0x4000,
}; namespace o3tl
{ template<> struct typed_flags<InvalidateFlags> : is_typed_flags<InvalidateFlags, 0x403f> {};
}
namespace vcl { class Window; } namespace vcl { class Cursor; } namespace vcl { class WindowOutputDevice; } class Dialog; class Edit; class WindowImpl; class PaintHelper; class VclSizeGroup; class Application; class WorkWindow; class MessBox; class MessageDialog; class DockingWindow; class FloatingWindow; class GroupBox; class PushButton; class RadioButton; class SalInstanceWidget; class SystemChildWindow; class ImplDockingWindowWrapper; class ImplPopupFloatWin; class LifecycleTest;
// TODO: improve missing functionality // only required because of SetFloatingMode() friendclass ::ImplDockingWindowWrapper; friendclass ::ImplPopupFloatWin; friendclass ::MenuFloatingWindow;
friendclass ::svt::PopupWindowControllerImpl;
private: // NOTE: to remove many dependencies of other modules // to this central file, all members are now hidden // in the WindowImpl class and all inline functions // were removed. // (WindowImpl is a pImpl pattern)
// Please do *not* add new members or inline functions to class Window, // but use class WindowImpl instead
This function is kind of recursive - it may be called from the PaintHelper destructor; and on the other hand it creates PaintHelper that (when destructed) calls other ImplCallPaint()'s.
*/
SAL_DLLPRIVATE void ImplCallPaint(const vcl::Region* pRegion, ImplPaintFlags nPaintFlags);
// retrieves the list of owner draw decorated windows for this window hierarchy
SAL_DLLPRIVATE ::std::vector<VclPtr<vcl::Window> >& ImplGetOwnerDrawList();
// returns the input language used for the last key stroke // may be LANGUAGE_DONTKNOW if not supported by the OS
LanguageType GetInputLanguage() const;
/// Can the widget derived from this Window do the double-buffering via RenderContext properly? bool SupportsDoubleBuffering() const; /// Enable/disable double-buffering of the frame window and all its children. void RequestDoubleBuffering(bool bRequest);
void EnableAllResize();
void SetBorderStyle( WindowBorderStyle nBorderStyle );
WindowBorderStyle GetBorderStyle() const; /// Get the left, top, right and bottom widths of the window border void GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder,
sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const;
Size CalcWindowSize( const Size& rOutSz ) const;
SAL_DLLPRIVATE Size CalcOutputSize( const Size& rWinSz ) const;
tools::Long CalcTitleWidth() const;
struct PointerState
{
sal_Int32 mnState; // the button state
Point maPos; // mouse position in output coordinates
};
PointerState GetPointerState(); bool IsMouseOver() const;
SAL_DLLPRIVATE void SetWindowRegionPixel();
SAL_DLLPRIVATE void SetWindowRegionPixel( const vcl::Region& rRegion );
vcl::Region GetWindowClipRegionPixel() const;
vcl::Region GetPaintRegion() const; bool IsInPaint() const; // while IsInPaint returns true ExpandPaintClipRegion adds the // submitted region to the paint clip region so you can // paint additional parts of your window if necessary void ExpandPaintClipRegion( const vcl::Region& rRegion );
void SetParent( vcl::Window* pNewParent );
vcl::Window* GetParent() const; // return the dialog we are contained in or NULL if un-contained
SAL_DLLPRIVATE Dialog* GetParentDialog() const; bool IsAncestorOf( const vcl::Window& rWindow ) const;
/** Override <code>EnableInput</code>. This can be necessary due to other people using EnableInput for whole window hierarchies.
@param bAlways sets always enabled flag
@param bChild if true children are recursively set to AlwaysEnableInput
*/ void AlwaysEnableInput( bool bAlways, bool bChild = true );
/** returns the current AlwaysEnableInput state @return true if window is in AlwaysEnableInput state
*/
SAL_DLLPRIVATE bool IsAlwaysEnableInput() const;
/** A window is in modal mode if one of its children or subchildren is a running modal window (a modal dialog)
@returns sal_True if a child or subchild is a running modal window
*/ bool IsInModalMode() const;
// those conversion routines might deliver different results during UI mirroring
Point OutputToScreenPixel( const Point& rPos ) const;
Point ScreenToOutputPixel( const Point& rPos ) const; // the normalized screen methods work independent from UI mirroring
Point OutputToNormalizedScreenPixel( const Point& rPos ) const;
SAL_DLLPRIVATE Point NormalizedScreenToOutputPixel( const Point& rPos ) const;
AbsoluteScreenPixelPoint OutputToAbsoluteScreenPixel( const Point& rPos ) const;
Point AbsoluteScreenToOutputPixel( const AbsoluteScreenPixelPoint& rPos ) const;
AbsoluteScreenPixelRectangle GetDesktopRectPixel() const; // window extents including border and decoration, relative to passed in window
tools::Rectangle GetWindowExtentsRelative(const vcl::Window& rRelativeWindow) const; // window extents including border and decoration, in absolute screen coordinates
AbsoluteScreenPixelRectangle GetWindowExtentsAbsolute() const;
SAL_DLLPRIVATE bool IsScrollable() const; virtualvoid Scroll( tools::Long nHorzScroll, tools::Long nVertScroll,
ScrollFlags nFlags = ScrollFlags::NONE ); void Scroll( tools::Long nHorzScroll, tools::Long nVertScroll, const tools::Rectangle& rRect, ScrollFlags nFlags = ScrollFlags::NONE ); void Invalidate( InvalidateFlags nFlags = InvalidateFlags::NONE ); void Invalidate( const tools::Rectangle& rRect, InvalidateFlags nFlags = InvalidateFlags::NONE ); void Invalidate( const vcl::Region& rRegion, InvalidateFlags nFlags = InvalidateFlags::NONE ); /** * Notification about some rectangle of the output device got invalidated.Used for the main * document window. * * @param pRectangle If 0, that means the whole area, otherwise the area in logic coordinates.
*/ virtualvoid LogicInvalidate(const tools::Rectangle* pRectangle);
virtualbool InvalidateByForeignEditView(EditView* ); /** * Notification about some rectangle of the output device got invalidated. Used for the * dialogs and floating windows (e.g. context menu, popup). * * @param pRectangle If 0, that means the whole area, otherwise the area in pixel coordinates.
*/ virtualvoid PixelInvalidate(const tools::Rectangle* pRectangle); void Validate();
SAL_DLLPRIVATE bool HasPaintEvent() const; void PaintImmediately();
// toggles new docking support, enabled via toolkit void EnableDocking( bool bEnable = true ); // retrieves the single dockingmanager instance static DockingManager* GetDockingManager();
/** * Set this when you need to act as if the window has focus even if it * doesn't. This is necessary for implementing tab stops inside floating * windows, but floating windows don't get focus from the system.
*/
SAL_DLLPRIVATE void SetFakeFocus( bool bFocus );
virtualvoid SetText( const OUString& rStr ); virtual OUString GetText() const; // return the actual text displayed // this may have e.g. accelerators removed or portions // replaced by ellipses virtual OUString GetDisplayText() const; // gets the visible background color. for transparent windows // this may be the parent's background color; for controls // this may be a child's background color (e.g. ListBox) virtualconst Wallpaper& GetDisplayBackground() const;
vcl::Window* GetAccessibleParentWindow() const;
sal_uInt16 GetAccessibleChildWindowCount();
vcl::Window* GetAccessibleChildWindow( sal_uInt16 n );
css::uno::Reference<css::accessibility::XAccessible> GetAccessibleParent() const; // Explicitly set an accessible parent (usually not needed) void SetAccessibleParent(const css::uno::Reference<css::accessibility::XAccessible>& rxParent);
// to avoid sending accessibility events in cases like closing dialogs // checks complete parent path bool IsAccessibilityEventsSuppressed();
KeyEvent GetActivationKey() const;
protected:
// These eventually are supposed to go when everything is converted to .ui
SAL_DLLPRIVATE vcl::Window* getLegacyNonLayoutAccessibleRelationMemberOf() const;
SAL_DLLPRIVATE vcl::Window* getLegacyNonLayoutAccessibleRelationLabeledBy() const;
SAL_DLLPRIVATE vcl::Window* getLegacyNonLayoutAccessibleRelationLabelFor() const;
// Let Label override the code part of GetAccessibleRelationLabelFor virtual vcl::Window* getAccessibleRelationLabelFor() const; virtual sal_uInt16 getDefaultAccessibleRole() const; virtual OUString getDefaultAccessibleName() const;
/* * Advisory Sizing - what is a good size for this widget * * Retrieves the preferred size of a widget ignoring * "width-request" and "height-request" properties. * * Implement this in sub-classes to tell layout * the preferred widget size. * * Use get_preferred_size to retrieve this value * cached and mediated via height and width requests
*/ virtual Size GetOptimalSize() const; /// clear OptimalSize cache
SAL_DLLPRIVATE void InvalidateSizeCache(); private:
/* * Retrieves the preferred size of a widget taking * into account the "width-request" and "height-request" properties. * * Overrides the result of GetOptimalSize to honor the * width-request and height-request properties. * * So the same as get_ungrouped_preferred_size except * it ignores groups. A building block of get_preferred_size * that access the size cache * * @see get_preferred_size
*/
SAL_DLLPRIVATE Size get_ungrouped_preferred_size() const; public: /* records all DrawText operations within the passed rectangle; * a synchronous paint is sent to achieve this
*/ void RecordLayoutData( vcl::ControlLayoutData* pLayout, const tools::Rectangle& rRect );
// set and retrieve for Toolkit
VCLXWindow* GetWindowPeer() const; void SetWindowPeer( css::uno::Reference< css::awt::XVclWindowPeer > const & xPeer, VCLXWindow* pVCLXWindow );
// remember if it was generated by Toolkit
SAL_DLLPRIVATE bool IsCreatedWithToolkit() const; void SetCreatedWithToolkit( bool b );
// Drag and Drop interfaces
css::uno::Reference< css::datatransfer::dnd::XDropTarget > GetDropTarget();
css::uno::Reference< css::datatransfer::dnd::XDragSource > GetDragSource();
css::uno::Reference< css::datatransfer::dnd::XDragGestureRecognizer > GetDragGestureRecognizer();
// Clipboard/Selection interfaces
css::uno::Reference< css::datatransfer::clipboard::XClipboard > GetClipboard(); /// Sets a custom clipboard for the window's frame, instead of creating it on-demand using css::datatransfer::clipboard::SystemClipboard. void SetClipboard(css::uno::Reference<css::datatransfer::clipboard::XClipboard> const & xClipboard);
/* * Widgets call this to inform their owner container that the widget wants * to renegotiate its size. Should be called when a widget has a new size * request. e.g. a FixedText Control gets a new label. * * akin to gtk_widget_queue_resize
*/ virtualvoid queue_resize(StateChangedType eReason = StateChangedType::Layout);
/* * Sets the "height-request" property * * Override for height request of the widget, or -1 if natural request * should be used. * * @see get_preferred_size, set_width_request
*/ void set_height_request(sal_Int32 nHeightRequest);
sal_Int32 get_height_request() const;
/* * Sets the "width-request" property * * Override for width request of the widget, or -1 if natural request * should be used. * * @see get_preferred_size, set_height_request
*/ void set_width_request(sal_Int32 nWidthRequest);
sal_Int32 get_width_request() const;
/* * Retrieves the preferred size of a widget taking * into account the "width-request" and "height-request" properties. * * Overrides the result of GetOptimalSize to honor the * width-request and height-request properties. * * @see GetOptimalSize * * akin to gtk_widget_get_preferred_size
*/
Size get_preferred_size() const;
/* * How to horizontally align this widget
*/
SAL_DLLPRIVATE VclAlign get_halign() const;
SAL_DLLPRIVATE void set_halign(VclAlign eAlign);
/* * How to vertically align this widget
*/
SAL_DLLPRIVATE VclAlign get_valign() const;
SAL_DLLPRIVATE void set_valign(VclAlign eAlign);
/* * Whether the widget would like to use any available extra horizontal * space.
*/ bool get_hexpand() const; void set_hexpand(bool bExpand);
/* * Whether the widget would like to use any available extra vertical * space.
*/ bool get_vexpand() const; void set_vexpand(bool bExpand);
/* * Whether the widget would like to use any available extra space.
*/ bool get_expand() const; void set_expand(bool bExpand);
/* * Whether the widget should receive extra space when the parent grows
*/
SAL_DLLPRIVATE bool get_fill() const;
SAL_DLLPRIVATE void set_fill(bool bFill);
/* * How the widget is packed with reference to the start or end of the parent
*/
SAL_DLLPRIVATE VclPackType get_pack_type() const;
SAL_DLLPRIVATE void set_pack_type(VclPackType ePackType);
/* * The extra space to put between the widget and its neighbors
*/
SAL_DLLPRIVATE sal_Int32 get_padding() const;
SAL_DLLPRIVATE void set_padding(sal_Int32 nPadding);
/* * The number of columns that the widget spans
*/
SAL_DLLPRIVATE sal_Int32 get_grid_width() const;
SAL_DLLPRIVATE void set_grid_width(sal_Int32 nCols);
/* * The column number to attach the left side of the widget to
*/
SAL_DLLPRIVATE sal_Int32 get_grid_left_attach() const;
SAL_DLLPRIVATE void set_grid_left_attach(sal_Int32 nAttach);
/* * The number of row that the widget spans
*/
SAL_DLLPRIVATE sal_Int32 get_grid_height() const;
SAL_DLLPRIVATE void set_grid_height(sal_Int32 nRows);
/* * The row number to attach the top side of the widget to
*/
SAL_DLLPRIVATE sal_Int32 get_grid_top_attach() const;
SAL_DLLPRIVATE void set_grid_top_attach(sal_Int32 nAttach);
/* * If true this child appears in a secondary layout group of children * e.g. help buttons in a buttonbox
*/
SAL_DLLPRIVATE bool get_secondary() const;
SAL_DLLPRIVATE void set_secondary(bool bSecondary);
/* * If true this child is exempted from homogeneous sizing * e.g. special button in a buttonbox
*/
SAL_DLLPRIVATE bool get_non_homogeneous() const;
SAL_DLLPRIVATE void set_non_homogeneous(bool bNonHomogeneous);
/* * Sets a widget property * * @return false if property is unknown
*/ virtualbool set_property(const OUString &rKey, const OUString &rValue);
/* * Sets a font attribute * * @return false if attribute is unknown
*/
SAL_DLLPRIVATE bool set_font_attribute(const OUString &rKey, std::u16string_view rValue);
/* * Adds this widget to the xGroup VclSizeGroup *
*/
SAL_DLLPRIVATE void add_to_size_group(const std::shared_ptr<VclSizeGroup>& xGroup);
SAL_DLLPRIVATE void remove_from_all_size_groups();
/* * Move this widget to be the nNewPosition'd child of its parent
*/
SAL_DLLPRIVATE void reorderWithinParent(sal_uInt16 nNewPosition);
/** * Sets an ID.
*/ void set_id(const OUString& rID);
/** * Get the ID of the window.
*/ const OUString& get_id() const;
// Native Widget Rendering functions
// form controls must never use native widgets, this can be toggled here void EnableNativeWidget( bool bEnable = true ); bool IsNativeWidgetEnabled() const;
// a helper method for a Control's Draw method void PaintToDevice( ::OutputDevice* pDevice, const Point& rPos );
// Keyboard access functions
/** Query the states of keyboard indicators - Caps Lock, Num Lock and Scroll Lock. Use the following mask to retrieve the state of each indicator:
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.