Difference between revisions of "Documentation/DevGuide/OfficeDev/Component/Window Interfaces"

From Apache OpenOffice Wiki
Jump to: navigation, search
(wrong argument type for XTopWindowListener methods)
 
(2 intermediate revisions by 2 users not shown)
Line 9: Line 9:
 
  {{DISPLAYTITLE:Window Interfaces}}
 
  {{DISPLAYTITLE:Window Interfaces}}
 
<!--<idltopic>com.sun.star.awt.XWindow;com.sun.star.awt.XTopWindow;com.sun.star.awt.XWindowPeer</idltopic>-->
 
<!--<idltopic>com.sun.star.awt.XWindow;com.sun.star.awt.XTopWindow;com.sun.star.awt.XWindowPeer</idltopic>-->
The window interfaces of the component window and container window control the {{PRODUCTNAME}} application windows. This chapter provides a short overview.
+
The window interfaces of the component window and container window control the {{AOo}} application windows. This chapter provides a short overview.
  
 
=== XWindow ===
 
=== XWindow ===
 
The interface <idl>com.sun.star.awt.XWindow</idl> is supported by the component and controller windows. This interface comprises methods to resize a window, control its visibility, enable and disable it, and make it the focus for input device events. Listeners are informed about window events.
 
The interface <idl>com.sun.star.awt.XWindow</idl> is supported by the component and controller windows. This interface comprises methods to resize a window, control its visibility, enable and disable it, and make it the focus for input device events. Listeners are informed about window events.
<source lang="idl">
+
<syntaxhighlight lang="idl">
 
   [oneway] void setPosSize ( long X, long Y, long Width, long Height, short Flags );  
 
   [oneway] void setPosSize ( long X, long Y, long Width, long Height, short Flags );  
 
   com::sun::star::awt::Rectangle getPosSize ();  
 
   com::sun::star::awt::Rectangle getPosSize ();  
Line 33: Line 33:
 
   [oneway] void addPaintListener ( com::sun::star::awt::XPaintListener xListener );  
 
   [oneway] void addPaintListener ( com::sun::star::awt::XPaintListener xListener );  
 
   [oneway] void removePaintListener ( com::sun::star::awt::XPaintListener xListener );  
 
   [oneway] void removePaintListener ( com::sun::star::awt::XPaintListener xListener );  
</source>
+
</syntaxhighlight>
 
The <idl>com.sun.star.awt.XWindowListener</idl> gets the following notifications. The <idl>com.sun.star.awt.WindowEvent</idl> has members describing the size and position of the window.
 
The <idl>com.sun.star.awt.XWindowListener</idl> gets the following notifications. The <idl>com.sun.star.awt.WindowEvent</idl> has members describing the size and position of the window.
<source lang="idl">
+
<syntaxhighlight lang="idl">
 
   [oneway] void windowResized ( [in] com::sun::star::awt::WindowEvent e )
 
   [oneway] void windowResized ( [in] com::sun::star::awt::WindowEvent e )
 
   [oneway] void windowMoved ( [in] com::sun::star::awt::WindowEvent e )
 
   [oneway] void windowMoved ( [in] com::sun::star::awt::WindowEvent e )
 
   [oneway] void windowShown ( [in] com::sun::star::lang::EventObject e )
 
   [oneway] void windowShown ( [in] com::sun::star::lang::EventObject e )
 
   [oneway] void windowHidden ( [in] com::sun::star::lang::EventObject e );  
 
   [oneway] void windowHidden ( [in] com::sun::star::lang::EventObject e );  
</source>
+
</syntaxhighlight>
 
What the other listeners do are evident by their names.
 
What the other listeners do are evident by their names.
  
Line 46: Line 46:
  
 
The interface <idl>com.sun.star.awt.XTopWindow</idl> is available at container windows. It informs listeners about top window events, and it can put itself in front of other windows or withdraw into the background. It also has a method to control the current menu bar:
 
The interface <idl>com.sun.star.awt.XTopWindow</idl> is available at container windows. It informs listeners about top window events, and it can put itself in front of other windows or withdraw into the background. It also has a method to control the current menu bar:
<source lang="idl">
+
<syntaxhighlight lang="idl">
 
   [oneway] void addTopWindowListener ( com::sun::star::awt::XTopWindowListener xListener );  
 
   [oneway] void addTopWindowListener ( com::sun::star::awt::XTopWindowListener xListener );  
 
   [oneway] void removeTopWindowListener ( com::sun::star::awt::XTopWindowListener xListener );  
 
   [oneway] void removeTopWindowListener ( com::sun::star::awt::XTopWindowListener xListener );  
Line 52: Line 52:
 
   [oneway] void toBack ();  
 
   [oneway] void toBack ();  
 
   [oneway] void setMenuBar ( com::sun::star::awt::XMenuBar xMenu );
 
   [oneway] void setMenuBar ( com::sun::star::awt::XMenuBar xMenu );
</source>
+
</syntaxhighlight>
  
{{Documentation/Note|Although the <tt>XTopWindow</tt> interface has a method <tt>setMenuBar()</tt>, this method is not usable at this time. The <idl>com.sun.star.awt.XMenuBar</idl> interface is deprecated.}}
+
{{Note|Although the <tt>XTopWindow</tt> interface has a method <tt>setMenuBar()</tt>, this method is not usable at this time. The <idl>com.sun.star.awt.XMenuBar</idl> interface is deprecated.}}
  
 
The top window listener receives the following messages. All methods take a <idl>com.sun.star.lang.EventObject</idl>.
 
The top window listener receives the following messages. All methods take a <idl>com.sun.star.lang.EventObject</idl>.
<source lang="idl">
+
<syntaxhighlight lang="idl">
 
   [oneway] void windowOpened ( [in] com::sun::star::lang::EventObject e )
 
   [oneway] void windowOpened ( [in] com::sun::star::lang::EventObject e )
 
   [oneway] void windowClosing ( [in] com::sun::star::lang::EventObject e )
 
   [oneway] void windowClosing ( [in] com::sun::star::lang::EventObject e )
Line 65: Line 65:
 
   [oneway] void windowActivated ( [in] com::sun::star::lang::EventObject e )
 
   [oneway] void windowActivated ( [in] com::sun::star::lang::EventObject e )
 
   [oneway] void windowDeactivated ( [in] com::sun::star::lang::EventObject e )
 
   [oneway] void windowDeactivated ( [in] com::sun::star::lang::EventObject e )
</source>
+
</syntaxhighlight>
 
=== XWindowPeer ===
 
=== XWindowPeer ===
  
 
Each <code>XWindow</code> has a <idl>com.sun.star.awt.XWindowPeer</idl>. The <idl>com.sun.star.awt.XWindowPeer</idl> interface accesses the window toolkit implementation used to create it and provides the pointer of the pointing device, and controls the background color. It is also used to invalidate a window or portions of it to trigger a redraw cycle.
 
Each <code>XWindow</code> has a <idl>com.sun.star.awt.XWindowPeer</idl>. The <idl>com.sun.star.awt.XWindowPeer</idl> interface accesses the window toolkit implementation used to create it and provides the pointer of the pointing device, and controls the background color. It is also used to invalidate a window or portions of it to trigger a redraw cycle.
<source lang="idl">
+
<syntaxhighlight lang="idl">
 
   com::sun::star::awt::XToolkit getToolkit ()
 
   com::sun::star::awt::XToolkit getToolkit ()
 
   [oneway] void setPointer ( [in] com::sun::star::awt::XPointer Pointer )
 
   [oneway] void setPointer ( [in] com::sun::star::awt::XPointer Pointer )
Line 76: Line 76:
 
   [oneway] void invalidateRect ( [in] com::sun::star::awt::Rectangle Rect,  
 
   [oneway] void invalidateRect ( [in] com::sun::star::awt::Rectangle Rect,  
 
   [in] short Flags )
 
   [in] short Flags )
</source>
+
</syntaxhighlight>
 
{{PDL1}}
 
{{PDL1}}
  
 
[[Category:Documentation/Developer's Guide/Office Development]]
 
[[Category:Documentation/Developer's Guide/Office Development]]

Latest revision as of 17:51, 2 January 2021



The window interfaces of the component window and container window control the Apache OpenOffice application windows. This chapter provides a short overview.

XWindow

The interface com.sun.star.awt.XWindow is supported by the component and controller windows. This interface comprises methods to resize a window, control its visibility, enable and disable it, and make it the focus for input device events. Listeners are informed about window events.

  [oneway] void setPosSize ( long X, long Y, long Width, long Height, short Flags ); 
  com::sun::star::awt::Rectangle getPosSize (); 
 
  [oneway] void setVisible ( boolean Visible ); 
  [oneway] void setEnable ( boolean Enable ); 
  [oneway] void setFocus (); 
 
  [oneway] void addWindowListener ( com::sun::star::awt::XWindowListener xListener ); 
  [oneway] void removeWindowListener ( com::sun::star::awt::XWindowListener xListener ); 
  [oneway] void addFocusListener ( com::sun::star::awt::XFocusListener xListener ); 
  [oneway] void removeFocusListener ( com::sun::star::awt::XFocusListener xListener ); 
  [oneway] void addKeyListener ( com::sun::star::awt::XKeyListener xListener ); 
  [oneway] void removeKeyListener ( com::sun::star::awt::XKeyListener xListener ); 
  [oneway] void addMouseListener ( com::sun::star::awt::XMouseListener xListener ); 
  [oneway] void removeMouseListener ( com::sun::star::awt::XMouseListener xListener ); 
  [oneway] void addMouseMotionListener ( com::sun::star::awt::XMouseMotionListener xListener ); 
  [oneway] void removeMouseMotionListener ( com::sun::star::awt::XMouseMotionListener xListener ); 
  [oneway] void addPaintListener ( com::sun::star::awt::XPaintListener xListener ); 
  [oneway] void removePaintListener ( com::sun::star::awt::XPaintListener xListener );

The com.sun.star.awt.XWindowListener gets the following notifications. The com.sun.star.awt.WindowEvent has members describing the size and position of the window.

  [oneway] void windowResized ( [in] com::sun::star::awt::WindowEvent e )
  [oneway] void windowMoved ( [in] com::sun::star::awt::WindowEvent e )
  [oneway] void windowShown ( [in] com::sun::star::lang::EventObject e )
  [oneway] void windowHidden ( [in] com::sun::star::lang::EventObject e );

What the other listeners do are evident by their names.

XTopWindow

The interface com.sun.star.awt.XTopWindow is available at container windows. It informs listeners about top window events, and it can put itself in front of other windows or withdraw into the background. It also has a method to control the current menu bar:

  [oneway] void addTopWindowListener ( com::sun::star::awt::XTopWindowListener xListener ); 
  [oneway] void removeTopWindowListener ( com::sun::star::awt::XTopWindowListener xListener ); 
  [oneway] void toFront (); 
  [oneway] void toBack (); 
  [oneway] void setMenuBar ( com::sun::star::awt::XMenuBar xMenu );
Documentation note.png Although the XTopWindow interface has a method setMenuBar(), this method is not usable at this time. The com.sun.star.awt.XMenuBar interface is deprecated.

The top window listener receives the following messages. All methods take a com.sun.star.lang.EventObject.

  [oneway] void windowOpened ( [in] com::sun::star::lang::EventObject e )
  [oneway] void windowClosing ( [in] com::sun::star::lang::EventObject e )
  [oneway] void windowClosed ( [in] com::sun::star::lang::EventObject e )
  [oneway] void windowMinimized ( [in] com::sun::star::lang::EventObject e )
  [oneway] void windowNormalized ( [in] com::sun::star::lang::EventObject e )
  [oneway] void windowActivated ( [in] com::sun::star::lang::EventObject e )
  [oneway] void windowDeactivated ( [in] com::sun::star::lang::EventObject e )

XWindowPeer

Each XWindow has a com.sun.star.awt.XWindowPeer. The com.sun.star.awt.XWindowPeer interface accesses the window toolkit implementation used to create it and provides the pointer of the pointing device, and controls the background color. It is also used to invalidate a window or portions of it to trigger a redraw cycle.

  com::sun::star::awt::XToolkit getToolkit ()
  [oneway] void setPointer ( [in] com::sun::star::awt::XPointer Pointer )
  [oneway] void setBackground ( [in] long Color ) 
  [oneway] void invalidate ( [in] short Flags )
  [oneway] void invalidateRect ( [in] com::sun::star::awt::Rectangle Rect, 
  [in] short Flags )
Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages