ViewContainer Class Reference

#include <viewcontainer.h>

Collaboration diagram for ViewContainer:

Collaboration graph
[legend]
List of all members.

Public Slots

void updateCaption ()

Public Member Functions

 ViewContainer (const QString &caption, KTechlab *ktechlab, QWidget *parent=0)
 ~ViewContainer ()
Viewview (uint id) const
ViewAreaviewArea (uint id) const
void setActiveViewArea (uint id)
uint activeViewArea () const
ViewactiveView () const
bool closeViewArea (uint id)
int createViewArea (int relativeViewArea, ViewArea::Position position=ViewArea::Right)
bool closeViewContainer ()
uint viewCount () const
void setFocused ()
void setUnfocused ()
ViewContainerduplicateViewContainer ()
void copyViewContainerIntoExisting (ViewContainer *viewContainer)
void setViewAreaId (ViewArea *viewArea, uint id)
void setViewAreaRemoved (uint id)
void setIdUsed (int id)
void saveState (KConfig *config)
void restoreState (KConfig *config, const QString &groupName)
int uniqueParentId ()
int uniqueNewId ()
bool canSaveUsefulStateInfo () const
void setKTechlabDeleted ()

Protected Slots

void baseViewAreaDestroyed (QObject *obj)

Protected Member Functions

void restoreViewArea (KConfig *config, int id, ViewArea *viewArea)
void findActiveViewArea ()

Protected Attributes

int m_activeViewArea
ViewAream_baseViewArea
ViewAreaMap m_viewAreaMap
IntList m_usedIDs
KTechlabp_ktechlab
bool b_focused
bool b_deleted

Detailed Description

Author:
David Saxton

Definition at line 112 of file viewcontainer.h.


Constructor & Destructor Documentation

ViewContainer::ViewContainer ( const QString &  caption,
KTechlab ktechlab,
QWidget *  parent = 0 
)

Constructs a new ViewContainer, along with a default ViewArea ready for parenting a View, with an id of 0. parent is only used if ktechlab is null; otherwise the parent widget is ktechlab's tabWidget()

Definition at line 24 of file viewcontainer.cpp.

References b_deleted, b_focused, baseViewAreaDestroyed(), m_activeViewArea, m_baseViewArea, p_ktechlab, and updateCaption().

Referenced by duplicateViewContainer().


Member Function Documentation

View * ViewContainer::view ( uint  id  )  const

Returns the view in the ViewArea with the given id

Definition at line 108 of file viewcontainer.cpp.

References viewArea().

Referenced by activeView(), closeViewArea(), copyViewContainerIntoExisting(), setActiveViewArea(), setFocused(), and setUnfocused().

ViewArea * ViewContainer::viewArea ( uint  id  )  const

Returns the ViewArea with the given id

Definition at line 124 of file viewcontainer.cpp.

References m_viewAreaMap.

Referenced by closeViewArea(), createViewArea(), setActiveViewArea(), setViewAreaId(), view(), and View::View().

void ViewContainer::setActiveViewArea ( uint  id  ) 

The active view area is the one that is focused.

Definition at line 81 of file viewcontainer.cpp.

References b_focused, m_activeViewArea, View::setFocused(), View::setUnfocused(), view(), and viewArea().

Referenced by findActiveViewArea().

uint ViewContainer::activeViewArea (  )  const [inline]

Returns the id of the active ViewArea

Definition at line 139 of file viewcontainer.h.

References m_activeViewArea.

Referenced by activeView(), and createViewArea().

View* ViewContainer::activeView (  )  const [inline]

Returns a pointer to the view of the active view area

Definition at line 143 of file viewcontainer.h.

References activeViewArea(), and view().

Referenced by setFocused(), setUnfocused(), DocManager::slotViewFocused(), and updateCaption().

bool ViewContainer::closeViewArea ( uint  id  ) 

Attempts to close the given viewarea, returning true if successful (i.e if the user did not object to the close request )

Definition at line 145 of file viewcontainer.cpp.

References View::document(), Document::fileClose(), findActiveViewArea(), m_activeViewArea, m_viewAreaMap, Document::numberOfViews(), view(), and viewArea().

Referenced by closeViewContainer().

int ViewContainer::createViewArea ( int  relativeViewArea,
ViewArea::Position  position = ViewArea::Right 
)

Creates a view area (parent QWidget, splitter et al) ready for inclusion of a view.

Parameters:
relativeViewArea the viewarea to position the new viewarea next to, if -1 then is taken to be the active view area
position Top, Right, Bottom or Left of given relativeViewArea
Returns:
id of the the view area, or -1 if unsucessful

Definition at line 178 of file viewcontainer.cpp.

References activeViewArea(), ViewArea::createViewArea(), uniqueNewId(), and viewArea().

Referenced by copyViewContainerIntoExisting().

bool ViewContainer::closeViewContainer (  ) 

Attempts to close each view area, returning false if any fail to be closed

Definition at line 133 of file viewcontainer.cpp.

References closeViewArea(), and m_viewAreaMap.

uint ViewContainer::viewCount (  )  const [inline]

Returns:
number of views in this view container

Definition at line 165 of file viewcontainer.h.

References m_viewAreaMap.

Referenced by updateCaption().

void ViewContainer::setFocused (  ) 

Called when the view container is focused (e.g. user clicks on the tab for this view container)

Definition at line 57 of file viewcontainer.cpp.

References activeView(), b_focused, View::setFocused(), and view().

void ViewContainer::setUnfocused (  ) 

Called when the view container is unfocused (e.g. user clicks on another tab).

Definition at line 69 of file viewcontainer.cpp.

References activeView(), b_focused, View::setUnfocused(), and view().

ViewContainer * ViewContainer::duplicateViewContainer (  ) 

Create a new view container, and make a new instance of each view in that view container.

Definition at line 247 of file viewcontainer.cpp.

References KTechlab::addWindow(), copyViewContainerIntoExisting(), p_ktechlab, and ViewContainer().

Referenced by KTechlab::slotTabReceivedDropEvent().

void ViewContainer::copyViewContainerIntoExisting ( ViewContainer viewContainer  ) 

Copies each view in this ViewContainer into the given ViewContainer

Definition at line 258 of file viewcontainer.cpp.

References createViewArea(), m_viewAreaMap, and view().

Referenced by duplicateViewContainer().

void ViewContainer::setViewAreaId ( ViewArea viewArea,
uint  id 
)

Sets the pointer to the view area with the given id

Definition at line 201 of file viewcontainer.cpp.

References m_usedIDs, m_viewAreaMap, and viewArea().

Referenced by ViewArea::restoreState(), and ViewArea::ViewArea().

void ViewContainer::setViewAreaRemoved ( uint  id  ) 

Removes a ViewArea from internal lists

Definition at line 208 of file viewcontainer.cpp.

References b_deleted, findActiveViewArea(), m_activeViewArea, and m_viewAreaMap.

Referenced by ViewArea::restoreState(), and ViewArea::~ViewArea().

void ViewContainer::setIdUsed ( int  id  ) 

Sets the id to be "used"

Definition at line 336 of file viewcontainer.cpp.

References m_usedIDs.

Referenced by ViewArea::restoreState(), and ViewArea::ViewArea().

void ViewContainer::saveState ( KConfig *  config  ) 

Writes the state of the View Container (layout of views and view URLs) to the given KConfig. Doesn't change the group - so preset it if needed!

Definition at line 288 of file viewcontainer.cpp.

References ViewArea::id(), m_baseViewArea, and ViewArea::saveState().

void ViewContainer::restoreState ( KConfig *  config,
const QString &  groupName 
)

Reads in the saved config state (as written by saveState), and restores the ViewContainer with all appropriate views open

Parameters:
groupName e.g. "ViewContainer 1"

Definition at line 298 of file viewcontainer.cpp.

References m_baseViewArea, and ViewArea::restoreState().

int ViewContainer::uniqueParentId (  ) 

Returns a unique id (negative) for a ViewArea that is now a Parent of other ViewAreas

Definition at line 306 of file viewcontainer.cpp.

References m_usedIDs.

Referenced by ViewArea::createViewArea().

int ViewContainer::uniqueNewId (  ) 

Returns a unique id (positive) for a new ViewArea

Definition at line 321 of file viewcontainer.cpp.

References m_usedIDs.

Referenced by createViewArea().

bool ViewContainer::canSaveUsefulStateInfo (  )  const

Returns true if this ViewArea can save useful information as to its state (i.e. it's children can save useful information about their state, or has a view with a url in it)

Definition at line 282 of file viewcontainer.cpp.

References ViewArea::canSaveUsefulStateInfo(), and m_baseViewArea.

void ViewContainer::setKTechlabDeleted (  ) 

Calls setKTechlabDeleted for each ViewArea.

Definition at line 362 of file viewcontainer.cpp.

References m_viewAreaMap, and p_ktechlab.

void ViewContainer::updateCaption (  )  [slot]

Sets the tab caption et al from the contents of this ViewContainer

Definition at line 342 of file viewcontainer.cpp.

References activeView(), Document::caption(), View::document(), p_ktechlab, KTechlab::tabWidget(), Document::url(), and viewCount().

Referenced by KTechlab::slotUpdateCaptions(), and ViewContainer().


The documentation for this class was generated from the following files:
Generated on Tue May 8 17:06:01 2007 for KTechLab by  doxygen 1.5.1