org.kde.koala

Class Part

public class Part extends QObject implements PartBaseInterface

Base class for parts. A "part" is a GUI component, featuring:
  • A widget embeddedable in any application.
  • GUI elements that will be merged in the "host" user interface (menubars, toolbars... ).
  • About the widget:
  • Note that KParts.Part does not inherit QWidget. This is due to the fact that the "visual representation" will probably not be a mere QWidget, but an elaborate one. That's why when implementing your KParts.Part (or derived) you should call KParts.Part.setWidget() in your constructor.
  • About the GUI elements:
  • Those elements trigger actions, defined by the part (action()). The layout of the actions in the GUI is defined by an XML file (setXMLFile()). See also ReadOnlyPart and ReadWritePart, which define the framework for a "viewer" part and for an "editor"-like part. Use Part directly only if your part doesn't fit into those. See PartSignals for signals emitted by Part

    UNKNOWN: Base class for parts.

    Constructor Summary
    protected Part(Class dummy)
    Part(QObject parent, String name)
    Constructor.
    Part(QObject parent)
    Part()
    Method Summary
    StringclassName()
    protected voidcustomEvent(QCustomEvent event)
    voidembed(QWidget parentWidget)
    Embed this part into a host widget.
    protected voidguiActivateEvent(GUIActivateEvent event)
    Convenience method which is called when the Part received a GUIActivateEvent .
    ParthitTest(QWidget widget, QPoint globalPos)
    Returns the part (this, or a child part) at the given global position.
    protected QWidgethostContainer(String containerName)
    Convenience method for KXMLGUIFactory.container.
    booleanisSelectable()
    Returns whether the part is selectable or not.
    protected voidloadPlugins(QObject parent, KXMLGUIClientInterface parentGUIClient, KInstanceInterface instance)
    Load the Plugins honoring the PluginLoadingMode.
    PartManagermanager()
    Returns the part manager handling this part, if any (null otherwise).
    QMetaObjectmetaObject()
    protected voidpartActivateEvent(PartActivateEvent event)
    Convenience method which is called when the Part received a PartActivateEvent .
    QObjectpartObject()
    protected voidpartSelectEvent(PartSelectEvent event)
    Convenience method which is called when the Part received a PartSelectEvent .
    protected voidsetInstance(KInstanceInterface instance)
    Set the instance ( KInstance) for this part.
    protected voidsetInstance(KInstanceInterface instance, boolean loadPlugins)
    Set the instance ( KInstance) for this part.
    voidsetManager(PartManager manager)
    Used by the part manager.
    voidsetPartObject(QObject object)
    Internal method.
    voidsetSelectable(boolean selectable)
    protected voidsetWidget(QWidget widget)
    Set the main widget.
    QWidgetwidget()

    Constructor Detail

    Part

    protected Part(Class dummy)

    Part

    public Part(QObject parent, String name)
    Constructor.

    Parameters: parent Parent object of the part. name QT-internal name of the part.

    UNKNOWN: Constructor.

    Part

    public Part(QObject parent)

    Part

    public Part()

    Method Detail

    className

    public String className()

    customEvent

    protected void customEvent(QCustomEvent event)

    UNKNOWN:

    embed

    public void embed(QWidget parentWidget)
    Embed this part into a host widget. You don't need to do this if you created the widget with the correct parent widget - this is just a QWidget.reparent(). Note that the Part is still the holder of the QWidget, meaning that if you delete the Part, then the widget gets destroyed as well, and vice-versa. This method is not recommended since creating the widget with the correct parent is simpler anyway.

    UNKNOWN: Embed this part into a host widget.

    guiActivateEvent

    protected void guiActivateEvent(GUIActivateEvent event)
    Convenience method which is called when the Part received a GUIActivateEvent . Reimplement this if you don't want to reimplement event and test for the event yourself or even install an event filter.

    UNKNOWN: Convenience method which is called when the Part received a GUIActivateEvent .

    hitTest

    public Part hitTest(QWidget widget, QPoint globalPos)
    Returns the part (this, or a child part) at the given global position. This is called by the part manager to ask whether a part should be activated when clicking somewhere. In most cases the default implementation is enough. Reimplement this if your part has child parts in some areas (like in khtml or koffice)

    Parameters: widget the part widget being clicked - usually the same as widget(), except in koffice. globalPos the mouse coordinates in global coordinates

    UNKNOWN: Returns the part (this, or a child part) at the given global position.

    hostContainer

    protected QWidget hostContainer(String containerName)
    Convenience method for KXMLGUIFactory.container.

    Returns: a container widget owned by the Part's GUI.

    UNKNOWN: Convenience method for KXMLGUIFactory.container.

    isSelectable

    public boolean isSelectable()
    Returns whether the part is selectable or not.

    UNKNOWN: Returns whether the part is selectable or not.

    loadPlugins

    protected void loadPlugins(QObject parent, KXMLGUIClientInterface parentGUIClient, KInstanceInterface instance)
    Load the Plugins honoring the PluginLoadingMode. If you call this method in an already constructed GUI (like when the user has changed which plugins are enabled) you need to add the new plugins to the KXMLGUIFactory:
    		 if( factory() )
    		 {
    		   QPtrList plugins = KParts.Plugin.pluginObjects( this );
    		   QPtrListIterator it( plugins );
    		   KParts.Plugin  plugin;
    		   while( ( plugin = it.current() ) != 0 )
    		   {
    		     ++it;
    		     factory().addClient(  plugin );
    		   }
    		 }
    		 

    UNKNOWN: Load the Plugins honoring the PluginLoadingMode.

    manager

    public PartManager manager()
    Returns the part manager handling this part, if any (null otherwise).

    UNKNOWN: Returns the part manager handling this part, if any (0L otherwise).

    metaObject

    public QMetaObject metaObject()

    partActivateEvent

    protected void partActivateEvent(PartActivateEvent event)
    Convenience method which is called when the Part received a PartActivateEvent . Reimplement this if you don't want to reimplement event and test for the event yourself or even install an event filter.

    UNKNOWN: Convenience method which is called when the Part received a PartActivateEvent .

    partObject

    public QObject partObject()

    partSelectEvent

    protected void partSelectEvent(PartSelectEvent event)
    Convenience method which is called when the Part received a PartSelectEvent . Reimplement this if you don't want to reimplement event and test for the event yourself or even install an event filter.

    UNKNOWN: Convenience method which is called when the Part received a PartSelectEvent .

    setInstance

    protected void setInstance(KInstanceInterface instance)
    Set the instance ( KInstance) for this part. Call this first in the inherited class constructor, because it loads the i18n catalogues.

    UNKNOWN: Set the instance ( KInstance) for this part.

    setInstance

    protected void setInstance(KInstanceInterface instance, boolean loadPlugins)
    Set the instance ( KInstance) for this part. Call this first in the inherited class constructor, because it loads the i18n catalogues.

    UNKNOWN: Set the instance ( KInstance) for this part.

    setManager

    public void setManager(PartManager manager)
    Used by the part manager.

    UNKNOWN:

    setPartObject

    public void setPartObject(QObject object)
    Internal method. Called by KParts.Part to specify the parent object for plugin objects.

    UNKNOWN: Internal method.

    setSelectable

    public void setSelectable(boolean selectable)

    Parameters: selectable Indicates whether the part is selectable or not.

    UNKNOWN:

    setWidget

    protected void setWidget(QWidget widget)
    Set the main widget. Call this in the Part-inherited class constructor.

    UNKNOWN: Set the main widget.

    widget

    public QWidget widget()

    Returns: The widget defined by this part, set by setWidget().

    UNKNOWN: