org.kde.koala
public class KMdiMainFrm extends DockMainWindow
public class MyMainWindow implements KMdiMainFrm { .... }to define your main window class and
MyMainWindow mainframe; qApp.setMainWidget(&mainframe); mainframe.addWindow(view1); // put it under MDI control mainframe.addWindow(view2);when you wish to use your main window class. The above example also adds a few windows to the frame. KMdiMainFrm will provide the "Window" menu needed in common MDI applications. Just insert it in your main menu:
if ( !isFakingSDIApplication() ) { menuBar().insertItem( i18n( "&Window" ), windowMenu() ); }To synchronize the positions of the MDI control buttons inserted in your mainmenu:
void B_MainModuleWidget.initMenuBar() { setMenuForSDIModeSysButtons( menuBar() ); } ... void B_MainModuleWidget.resizeEvent ( QResizeEvent e ) { KMdiMainFrm.resizeEvent( e ); setSysButtonsAtMenuPosition(); }\par Dynamic mode switching Dynamic switching of the MDI mode can be done via the following functions: - switchToChildframeMode() - switchToToplevelMode() - switchToTabPageMode() - switchToIDEAlMode() The MDI mode can be gotten using mdiMode(). If you need to fake the look of an SDI application use fakeSDIApplication() to fake it and isFakingSDIApplication() to query whether or not an SDI interface is being faked. You can dynamically change the shape of the attached MDI views using setFrameDecorOfAttachedViews(). Additionally, here's a hint how to restore the mainframe's settings from config file:
// restore MDI mode (toplevel, childframe, tabpage) int mdiMode = config.readIntEntry( "mainmodule session", "MDI mode", KMdi.ChildframeMode); switch (mdiMode) { case KMdi.ToplevelMode: { int childFrmModeHt = config.readIntEntry( "mainmodule session", "Childframe mode height", desktop().height() - 50); mainframe.resize( m_pMdiMainFrm.width(), childFrmModeHt); mainframe.switchToToplevelMode(); } break; case KMdi.ChildframeMode: break; case KMdi.TabPageMode: { int childFrmModeHt = m_pCfgFileManager.readIntEntry( "mainmodule session", "Childframe mode height", desktop().height() - 50); mainframe.resize( m_pMdiMainFrm.width(), childFrmModeHt); mainframe.switchToTabPageMode(); } break; default: break; } // restore a possible maximized Childframe mode boolean maxChildFrmMode = config.readBoolEntry( "mainmodule session", "maximized childframes", true); mainframe.setEnableMaximizedChildFrmMode(maxChildFrmMode);The maximized-Childframe mode means that currently all views are maximized in Childframe mode's application desktop. \par Managing views This class provides placing algorithms in Childframe mode. The following is a list of the window placement functions - tilePragma() - Tile the windows and allow them to overlap - tileAnodine() - Tile the windows but don't allow them to overlap - tileVertically() - Tile the windows vertically - cascadeWindows() - cascade windows - cascadeMaximized() - cascade windows and maximize their viewing area - expandVertical() - expand all the windows to use the most amount of vertical space - expandHorizontal() - expand all the windows to use the most amount of horizontal space activateView(KMdiChildView) and activateView(int index) set the appropriate MDI child view as the active one. It will be raised, will get an active MDI frame and will get the focus. Call activeView() to find out what the current MDI view is. Use detachWindow() and attachWindow() for docking the MDI views to desktop and back. Connect accels of your program with activatePrevWin(), activateNextWin() and activateView(int index). Note: KMdiChildViews can be added in 2 meanings: Either as a normal child view (usually containing user document views) or as a tool-view (usually containing status, info or control widgets). The tool-views can be added as floating dockwidgets or as stay-on-top desktop windows in tool style. Also, pay attention to the fact that when you click on the close button of MDI views that their close event should be redirected to closeWindow(). Otherwise the mainframe class will not get noticed about the deleted view and a dangling pointer will remain in the MDI control. The closeWindow() or the removeWindowFromMdi() method is for that issue. The difference is closeWindow() deletes the view object. So if your application wants to control that by itself, call removeWindowFromMdi() and call delete by yourself. See also KMdiChildView.closeEvent() for that issue. Here's an example how you can suggest things for the adding of views to the MDI control via flags:
m_mapOfMdiWidgets.insert( pWnd, mh ); unsigned int mdiFlags = KMdi.StandardAdd; if ( !show ) mdiFlags |= KMdi.Hide; if ( !attach ) mdiFlags |= KMdi.Detach; if ( minimize ) mdiFlags |= KMdi.Minimize; if ( bToolWindow) mdiFlags |= KMdi.ToolWindow; if ( m_pMdiMainFrm.isFakingSDIApplication() ) { if ( attach ) //fake an SDI app mdiFlags |= KMdi.Maximize; } else { m_pMdiMainFrm.addWindow( pWnd, QPoint(20, 20), KMdi.AddWindowFlags(mdiFlags)); return; } m_pMdiMainFrm.addWindow( pWnd, KMdi.AddWindowFlags(mdiFlags));See KMdiMainFrmSignals for signals emitted by KMdiMainFrm
UNKNOWN: \short Base class for all your special main frames.
Field Summary | |
---|---|
static int | AnyView |
static int | DocumentView |
static int | ToolView |
Constructor Summary | |
---|---|
protected | KMdiMainFrm(Class dummy) |
KMdiMainFrm(QWidget parentWidget, String name, int mdiMode, int flags) | |
KMdiMainFrm(QWidget parentWidget, String name, int mdiMode) | |
KMdiMainFrm(QWidget parentWidget, String name) | |
KMdiMainFrm(QWidget parentWidget) |
Method Summary | |
---|---|
void | activateFirstWin()
Activates the view first viewed concerning to the access time. |
void | activateLastWin()
Activates the view last viewed concerning to the access time. |
void | activateNextWin()
Activates the next open view |
void | activatePrevWin()
Activates the previous open view |
void | activateView(int index)
Activates the view with the tab page index (TabPage mode only) |
protected void | activateView(KMdiChildView pWnd)
Sets the focus to this MDI view, raises it, activates its taskbar button and updates
the system buttons in the main menubar when in maximized (Maximize mode). |
KMdiChildView | activeWindow()
Returns the focused attached MDI view. |
KMdiToolViewAccessor | addToolWindow(QWidget pWnd, int pos, QWidget pTargetWnd, int percent, String tabToolTip, String tabCaption)
Usually called from addWindow() when adding a tool view window. |
KMdiToolViewAccessor | addToolWindow(QWidget pWnd, int pos, QWidget pTargetWnd, int percent, String tabToolTip) |
KMdiToolViewAccessor | addToolWindow(QWidget pWnd, int pos, QWidget pTargetWnd, int percent) |
KMdiToolViewAccessor | addToolWindow(QWidget pWnd, int pos, QWidget pTargetWnd) |
KMdiToolViewAccessor | addToolWindow(QWidget pWnd, int pos) |
KMdiToolViewAccessor | addToolWindow(QWidget pWnd) |
void | addWindow(KMdiChildView pWnd, int flags)
Adds a KMdiChildView to the MDI system. |
void | addWindow(KMdiChildView pWnd) |
void | addWindow(KMdiChildView pWnd, int flags, int index)
Adds a KMdiChildView to the MDI system. |
void | addWindow(KMdiChildView pWnd, QPoint pos, int flags)
Adds a KMdiChildView to the MDI system. |
void | addWindow(KMdiChildView pWnd, QPoint pos) |
void | addWindow(KMdiChildView pWnd, QRect rectNormal, int flags)
Adds a KMdiChildView to the MDI system. |
void | addWindow(KMdiChildView pWnd, QRect rectNormal) |
void | applyOptions()
Called in the constructor (forces a resize of all MDI views) |
void | attachWindow(KMdiChildView pWnd, boolean bShow, boolean bAutomaticResize)
Makes a main frame controlled undocked KMdiChildView docked.
|
void | attachWindow(KMdiChildView pWnd, boolean bShow) |
void | attachWindow(KMdiChildView pWnd) |
protected void | blockClearingOfWindowMenu(boolean bBlocked)
prevents fillWindowMenu() from m_pWindowMenu.clear(). |
void | cascadeMaximized()
Cascades the windows resizing them to the maximum available size. |
void | cascadeWindows()
Cascades the windows without resizing them. |
int | childFrameModeHeight()
Returns the Childframe mode height of this. |
void | childWindowCloseRequest(KMdiChildView pWnd)
Someone wants that the MDI view to be closed. |
String | className() |
void | closeActiveView()
Closes the view of the active (topchild) window |
void | closeAllViews()
Close all views |
protected void | closeViewButtonPressed()
internally used to handle click on view close button (TabPage mode, only) |
void | closeWindow(KMdiChildView pWnd, boolean layoutTaskBar)
Removes a KMdiChildView from the MDI system and from the main frame`s control.
|
void | closeWindow(KMdiChildView pWnd) |
protected void | createMdiManager()
Creates the MDI view area and connects some signals and slots with the KMdiMainFrm widget. |
protected void | createTaskBar()
Creates a new MDI taskbar (showing the MDI views as taskbar entries) and shows it. |
KMdiToolViewAccessor | createToolWindow()
Using this method you have to use the setWidget method of the access object, and it is very recommendet, that you use
the widgetContainer() method for the parent of your newly created widget |
KMdiChildView | createWrapper(QWidget view, String name, String shortName)
addWindow demands a KMdiChildView. |
QSize | defaultChildFrmSize()
Returns the default size for a newly added KMdiChildView. |
void | deleteToolWindow(QWidget pWnd) |
void | deleteToolWindow(KMdiToolViewAccessor accessor) |
void | detachWindow(KMdiChildView pWnd, boolean bShow)
Makes a docked KMdiChildView undocked.
|
void | detachWindow(KMdiChildView pWnd) |
void | dispose() Delete the wrapped C++ instance ahead of finalize() |
protected void | dockMenuItemActivated(int id)
Usually called when the user clicks an MDI view item in the sub-popup menu "Docking" of the "Window" menu. |
protected void | dragEndTimeOut()
The timer for main widget moving has elapsed . send drag end to all concerned views. |
boolean | event(QEvent e)
Catches certain Qt events and processes it here.
|
boolean | eventFilter(QObject arg1, QEvent e) |
void | expandHorizontal()
Maximizes only in horizontal direction. |
void | expandVertical()
Maximizes only in vertical direction. |
void | fakeSDIApplication()
An SDI application user interface is faked:
|
void | fillWindowMenu()
Update of the window menu contents. |
protected void | finalize() Deletes the wrapped C++ instance |
KMdiChildView | findWindow(String caption)
Returns the KMdiChildView belonging to the given caption string. |
void | finishChildframeMode() |
void | finishIDEAlMode(boolean full) |
void | finishIDEAlMode() |
void | finishTabPageMode() |
void | finishToplevelMode() |
static int | frameDecorOfAttachedViews() |
void | hideViewTaskBar()
Hides the view taskbar. |
void | iconifyAllViews()
Iconfiy all views |
protected void | idealToolViewsToStandardTabs(String[] widgetNames, int pos, int sizee) |
boolean | isDisposed() Has the wrapped C++ instance been deleted? |
boolean | isFakingSDIApplication() |
boolean | isInMaximizedChildFrmMode()
Returns whether the application's MDI views are in maximized state or not. |
boolean | isViewTaskBarOn() |
int | mdiMode()
Returns the MDI mode. |
QMetaObject | metaObject() |
void | nextToolViewInDock() |
protected void | popupWindowMenu(QPoint p)
Popups the "Window" menu. |
protected ArrayList | prepareIdealToTabs(KDockWidget container) |
void | prevToolViewInDock() |
void | removeWindowFromMdi(KMdiChildView pWnd)
Removes a KMdiChildView from the MDI system and from the main frame`s control.
|
protected void | resizeEvent(QResizeEvent arg1) |
void | setBackgroundColor(QColor c)
Sets a background color for the MDI view area widget. |
void | setBackgroundPixmap(QPixmap pm)
Sets a background pixmap for the MDI view area widget. |
void | setDefaultChildFrmSize(QSize sz)
Sets a size that is used as the default size for a newly to the MDI system added KMdiChildView .
|
void | setEnableMaximizedChildFrmMode(boolean bEnable)
If in Childframe mode, we can switch between maximized or restored shown MDI views |
void | setManagedDockPositionModeEnabled(boolean enabled) |
void | setMenuForSDIModeSysButtons(KMenuBar menuBar)
Tells the MDI system a QMenu where it can insert buttons for
the system menu, undock, minimize, restore actions.
|
void | setMenuForSDIModeSysButtons() |
void | setMinimumSize(int minw, int minh)
Do nothing when in Toplevel mode |
void | setStandardMDIMenuEnabled(boolean showModeMenu)
Control whether or not the standard MDI menu is displayed
when a context menu is displayed |
void | setStandardMDIMenuEnabled() |
void | setSwitching(boolean switching) We're switching something. |
void | setSysButtonsAtMenuPosition()
If there's a main menubar given, it will create the 4 maximize mode buttons there (undock, minimize, restore, close). |
protected void | setTabWidgetVisibility(int arg1) Set tabwidget visibility @short Set tabwidget visibility |
void | setToolviewStyle(int flags)
Sets the appearance of the toolview tabs. |
void | setUndockPositioningOffset(QPoint offset)
Sets an offset value that is used on detachWindow() . |
void | showViewTaskBar()
Shows the view taskbar. |
void | slot_toggleTaskBar()
Switches the KMdiTaskBar on and off. |
boolean | switching() |
protected void | switchOffMaximizeModeForMenu(KMdiChildFrm oldChild)
Turns the system buttons for maximize mode (SDI mode) off, and disconnects them |
void | switchToChildframeMode()
Docks all view windows (Windows-like) |
void | switchToIDEAlMode()
Docks all view windows. |
void | switchToTabPageMode()
Docks all view windows (Windows-like) |
void | switchToToplevelMode()
Undocks all view windows (unix-like) |
protected KTabWidget | tabWidget() Returns the tabwidget used in IDEAl and Tabbed modes. |
protected int | tabWidgetVisibility() Get tabwidget visibility @short Get tabwidget visibility |
protected void | taskbarButtonRightClicked(KMdiChildView pWnd)
Activates the MDI view (see activateView() ) and popups the taskBar popup menu (see taskBarPopup() ). |
int | taskBarHeight()
Returns the height of the taskbar. |
QPopupMenu | taskBarPopup(KMdiChildView pWnd, boolean bIncludeWindowPopup)
Returns a popup menu filled according to the MDI view state. |
QPopupMenu | taskBarPopup(KMdiChildView pWnd) |
void | tileAnodine()
Tile Anodine |
void | tilePragma()
Tile Pragma |
void | tileVertically()
Tile Vertically |
protected void | updateSysButtonConnections(KMdiChildFrm oldChild, KMdiChildFrm newChild)
Reconnects the system buttons form maximize mode (SDI mode) with the new child frame |
boolean | windowExists(KMdiChildView pWnd, int as)
Returns whether this MDI child view is under MDI control (using addWindow() ) or not. |
QPopupMenu | windowMenu()
Returns a popup menu that contains the MDI controlled view list.
|
protected void | windowMenuItemActivated(int id)
Usually called when the user clicks an MDI view item in the "Window" menu. |
QPopupMenu | windowPopup(KMdiChildView pWnd, boolean bIncludeTaskbarPopup)
Returns a popup menu with only a title "Window". |
QPopupMenu | windowPopup(KMdiChildView pWnd) |
UNKNOWN: Activates the view first viewed concerning to the access time.
UNKNOWN: Activates the view last viewed concerning to the access time.
UNKNOWN: Activates the next open view
UNKNOWN: Activates the previous open view
UNKNOWN: Activates the view with the tab page index (TabPage mode only)
UNKNOWN: Sets the focus to this MDI view, raises it, activates its taskbar button and updates the system buttons in the main menubar when in maximized (Maximize mode).
UNKNOWN: Returns the focused attached MDI view.
UNKNOWN: Usually called from addWindow() when adding a tool view window.
UNKNOWN: Adds a KMdiChildView to the MDI system.
UNKNOWN: Adds a KMdiChildView to the MDI system.
UNKNOWN: Adds a KMdiChildView to the MDI system.
UNKNOWN: Adds a KMdiChildView to the MDI system.
UNKNOWN: Called in the constructor (forces a resize of all MDI views)
UNKNOWN: Makes a main frame controlled undocked KMdiChildView docked.
UNKNOWN: prevents fillWindowMenu() from m_pWindowMenu.clear().
UNKNOWN: Cascades the windows resizing them to the maximum available size.
UNKNOWN: Cascades the windows without resizing them.
UNKNOWN: Returns the Childframe mode height of this.
UNKNOWN: Someone wants that the MDI view to be closed.
UNKNOWN: Closes the view of the active (topchild) window
UNKNOWN: Close all views
UNKNOWN: internally used to handle click on view close button (TabPage mode, only)
UNKNOWN: Removes a KMdiChildView from the MDI system and from the main frame`s control.
UNKNOWN: Creates the MDI view area and connects some signals and slots with the KMdiMainFrm widget.
UNKNOWN: Creates a new MDI taskbar (showing the MDI views as taskbar entries) and shows it.
UNKNOWN: Using this method you have to use the setWidget method of the access object, and it is very recommendet, that you use the widgetContainer() method for the parent of your newly created widget
UNKNOWN: addWindow demands a KMdiChildView.
UNKNOWN: Returns the default size for a newly added KMdiChildView.
UNKNOWN: Makes a docked KMdiChildView undocked.
UNKNOWN: Usually called when the user clicks an MDI view item in the sub-popup menu "Docking" of the "Window" menu.
UNKNOWN: The timer for main widget moving has elapsed . send drag end to all concerned views.
UNKNOWN: Catches certain Qt events and processes it here.
UNKNOWN: Maximizes only in horizontal direction.
UNKNOWN: Maximizes only in vertical direction.
UNKNOWN: Update of the window menu contents.
UNKNOWN: Returns the KMdiChildView belonging to the given caption string.
Returns: the decoration of the window frame of docked (attached) MDI views
UNKNOWN:
UNKNOWN: Hides the view taskbar.
UNKNOWN: Iconfiy all views
Returns: if we are faking an SDI application (fakeSDIApplication())
UNKNOWN:
UNKNOWN: Returns whether the application's MDI views are in maximized state or not.
Returns: if the view taskbar should be shown if there are MDI views
UNKNOWN:
UNKNOWN: Returns the MDI mode.
UNKNOWN: Popups the "Window" menu.
UNKNOWN: Removes a KMdiChildView from the MDI system and from the main frame`s control.
UNKNOWN: Sets a background color for the MDI view area widget.
UNKNOWN: Sets a background pixmap for the MDI view area widget.
UNKNOWN: Sets a size that is used as the default size for a newly to the MDI system added KMdiChildView .
UNKNOWN: If in Childframe mode, we can switch between maximized or restored shown MDI views
UNKNOWN: Tells the MDI system a QMenu where it can insert buttons for the system menu, undock, minimize, restore actions.
UNKNOWN: Do nothing when in Toplevel mode
UNKNOWN: Control whether or not the standard MDI menu is displayed when a context menu is displayed
UNKNOWN: If there's a main menubar given, it will create the 4 maximize mode buttons there (undock, minimize, restore, close).
Parameters: flags See KMdi.ToolviewStyle.
UNKNOWN: Sets the appearance of the toolview tabs.
UNKNOWN: Sets an offset value that is used on detachWindow() .
UNKNOWN: Shows the view taskbar.
UNKNOWN: Switches the KMdiTaskBar on and off.
UNKNOWN: Turns the system buttons for maximize mode (SDI mode) off, and disconnects them
UNKNOWN: Docks all view windows (Windows-like)
UNKNOWN: Docks all view windows.
UNKNOWN: Docks all view windows (Windows-like)
UNKNOWN: Undocks all view windows (unix-like)
UNKNOWN: Activates the MDI view (see activateView() ) and popups the taskBar popup menu (see taskBarPopup() ).
UNKNOWN: Returns the height of the taskbar.
UNKNOWN: Returns a popup menu filled according to the MDI view state.
UNKNOWN: Tile Anodine
UNKNOWN: Tile Pragma
UNKNOWN: Tile Vertically
UNKNOWN: Reconnects the system buttons form maximize mode (SDI mode) with the new child frame
UNKNOWN: Returns whether this MDI child view is under MDI control (using addWindow() ) or not.
UNKNOWN: Returns a popup menu that contains the MDI controlled view list.
UNKNOWN: Usually called when the user clicks an MDI view item in the "Window" menu.
UNKNOWN: Returns a popup menu with only a title "Window".