qmdiServer Class Reference

A default interface for MDI servers. More...

Inheritance diagram for qmdiServer:

qmdiTabWidget qmdiWorkspace List of all members.

Public Member Functions

 qmdiServer ()
 Empty constructor. Creates the object.
virtual ~qmdiServer ()
 Empty destructor. Destroys the object.
virtual void addClient (qmdiClient *client)=0
 insert a new client to the server
virtual void deleteClient (qmdiClient *)
 callback to get alarm of deleted object
virtual int getClientsCount ()=0
 return the number of sub clients in this server
virtual qmdiClientgetClient (int i)=0
 return a pointer to an MDI client
void tryCloseClient (int i)
 request an MDI client to be closed
void tryCloseAllButClient (int i)
 request to close all other clients
void tryCloseAllCliens ()
 try to close all MDI clients
void showClientMenu (int i, QPoint p)
 display the menu of a specific MDI client

Public Attributes

qmdiHostmdiHost
 a pointer to the MDI host

Detailed Description

A default interface for MDI servers.

This class is used only to get messages from the qmdiClient that it asks to be removed from the list.

Classes which derive this class, MUST implement the clientDeleted() function. This a rather abstract class, you are probably looking for qmdiTabWidget.

Other classes which implement this interface are planned for next versions.


Constructor & Destructor Documentation

qmdiServer::qmdiServer (  ) 

Empty constructor. Creates the object.

Constructs the mdi Server. By default does nothing

qmdiServer::~qmdiServer (  )  [virtual]

Empty destructor. Destroys the object.

Since this class needs to be dynamic_casted by the derived classes, to assign the correct qmdiServer, this class needs to have a virtual table. If the class has a virtual function, it's only smart to have a virtual destructor.

See also:
qmdiClient

qmdiTabWidget


Member Function Documentation

qmdiServer::addClient ( qmdiClient client  )  [pure virtual]

insert a new client to the server

Parameters:
client the new client to be added
When deriving this class, you should also supply a function for adding new clients to it. For example when deriving QTabWidget, your new function should actually call QTabWidget::insertTab().

Users of this class should be able to add new clients, and set the properties needed using this function, but you should also supply more advanced functions provided by your new widget, like add the widget into another location, setting an icon for this client, etc.

Since it's defined as pure virtual, you must implement this on derived classes.

See also:
qmdiTabWidget

Implemented in qmdiTabWidget, and qmdiWorkspace.

void qmdiServer::deleteClient ( qmdiClient  )  [virtual]

callback to get alarm of deleted object

This function gets called on the destructor of qmdiClient, to announce that the object is about to be deleted. This function should be used to remove the menus and toolbars and other cleanup actions needed.

Why not using QTabWidget::tabRemoved ( int index ) ?

Why not using the signal QObject::destroyed( QObject * obj = 0 ) ?

This means that the qmdiClient needs to know the MDI server (usually a qmdiTabWidget) and ask to be removed before it gets destructed.

Why this function is not pure virtual?

Even tough this is not a pure virtual, you must implement this on derived classes.

Reimplemented in qmdiTabWidget.

qmdiServer::getClientsCount (  )  [pure virtual]

return the number of sub clients in this server

Return the number of sub-widgets in this server. Please note that this function can return also non-mdi clients.

Since it's defined as pure virtual, you must implement this on derived classes.

See also:
getClient

Implemented in qmdiTabWidget, and qmdiWorkspace.

qmdiClient * qmdiServer::getClient ( int  i  )  [pure virtual]

return a pointer to an MDI client

Parameters:
i the number of sub widget to return
Return a pointer to an MDI client. If the number passed denotes a sub widget which does not derive qmdiClient this function will return NULL.

Since it's defined as pure virtual, you must implement this on derived classes.

Since:
0.0.4
See also:
getClientsCount

Implemented in qmdiTabWidget, and qmdiWorkspace.

void qmdiServer::tryCloseClient ( int  i  ) 

request an MDI client to be closed

Parameters:
i the number of the client (tab) to be closed
Call this slot to ask the MDI client to close itself. The MDI client may show a dialog to ask for saving. It's not guaranteed that the action will be handled as the MDI client can abort the action.

This function used to be part of qmdiTabWidget, but it was ported down to this abstract interface at version 0.0.4.

Since:
0.0.4
See also:
qmdiClient::closeClient()

void qmdiServer::tryCloseAllButClient ( int  i  ) 

request to close all other clients

Parameters:
i the number of the client to keep open
Call this slot to ask all the MDI clients (but the widget found at index i in the tab widget, passed as a parameter). Each MDI client may show a dialog to ask for saving. It's not guaranteed that the action will be handled as the MDI client can abort the action. At the end, only the client number i will not be asked to close itself.

If some widget on the MDI server does not derive (implements) the qmdiClient interface, the widget will not be closed.

This function used to be part of qmdiTabWidget, but it was ported down to this abstract interface at version 0.0.4.

Since:
0.0.4
See also:
qmdiClient::closeClient() tryCloseClient() tryCloseAllCliens

void qmdiServer::tryCloseAllCliens (  ) 

try to close all MDI clients

Call this slot when you want to close all the MDI clients.

This function used to be part of qmdiTabWidget, but it was ported down to this abstract interface at version 0.0.4.

Since:
0.0.4

void qmdiServer::showClientMenu ( int  i,
QPoint  p 
)

display the menu of a specific MDI client

Parameters:
i the mouse button that has been pressed
p the location of the mouse click
This function shuold be called when a user presses the right mouse button on the tab bar of the tab widget. The coordinates of the click are passed on the parameter p , while the mouse button which has been pressed is passed on the parameter p .

This function used to be part of qmdiTabWidget, but it was ported down to this abstract interface at version 0.0.4.

Since:
0.0.4
See also:
qmdiTabBar


Member Data Documentation

qmdiServer::mdiHost

a pointer to the MDI host

This is a pointer to the MDI host in which the server is registered. It should not be assigned any value, and should be threated as read only.


The documentation for this class was generated from the following files:
Generated on Fri Jun 29 21:56:34 2007 for qmdilib by  doxygen 1.5.1