home *** CD-ROM | disk | FTP | other *** search
- #ifndef _ICNRCTL_
- #define _ICNRCTL_
- /*******************************************************************************
- * FILE NAME: icnrctl.hpp *
- * *
- * DESCRIPTION: *
- * Declaration of the class(es): *
- * IContainerControl - Base container control class *
- * IContainerObject::ObjectCursor - iterate the objects in a container *
- * IContainerObject::ColumnCursor - iterate the columns in a container *
- * ICnrControlList - a collection of container controls *
- * *
- * COPYRIGHT: *
- * (C) Copyright IBM Corporation 1992 *
- * All Rights Reserved *
- * Licensed Materials * Property of IBM *
- * *
- * HISTORY: *
- * $Log: U:/ibmclass/icnr/vcs/icnrctl.hpv $
- //
- // Rev 1.18 26 Oct 1992 17:36:18 PETERB
- //Added ScrolltoObject for columns
- //
- // Rev 1.17 25 Oct 1992 19:26:36 BOBLOVE
- //Updated documentation
- //
- // Rev 1.16 25 Oct 1992 16:27:44 nunn
- //changed library name to ICLUI
- //
- // Rev 1.15 25 Oct 1992 11:16:28 BOBLOVE
- //External Beta Release
- * *
- *******************************************************************************/
-
- #ifndef _ICONTROL_
- #include <icontrol.hpp>
- #endif
-
- #ifndef _ICNROBJ_
- #include <icnrobj.hpp>
- #endif
-
- #ifndef _IRECT_
- #include <irect.hpp>
- #endif
-
-
- // Forward Declarations
- class IContainerControl;
- class IContainerColumn;
- class IContainerObject;
- class IResourceId;
- class IPrivateResource;
- class IMultiLineEdit;
- struct ICnrInfo;
-
-
-
- // Replace with BB
- #ifdef _USEBB_
- #include <iset.h>
- #else
- #include <iset.hpp>
- #endif
-
- /*---------------------------------------------------------*/
- /* Type Definition of Sort and Filter Functions */
- /* Warning: These callback functions will be made */
- /* obsolete in the future - replace with objects. */
- /*---------------------------------------------------------*/
- #if (OS2LEVEL > 130)
- typedef long (_System ICOMPOBJCALLBACK)(const IContainerObject* pcnrobj1,
- const IContainerObject* pcnrobj2,
- void *pUserData);
- typedef Boolean (_System IFILTEROBJCALLBACK)(const IContainerObject* pcnrobj,
- const IContainerControl*pcnrctl);
- #else
- typedef long (pascal far ICOMPOBJCALLBACK)(const IContainerObject* pcnrobj1,
- const IContainerObject* pcnrobj2,
- void *pUserData);
- typedef Boolean (pascal far IFILTEROBJCALLBACK)(const IContainerObject* pcnrobj,
- const IContainerControl*pcnrctl);
- #endif
-
- #ifdef _USEBB_
- typedef ISet<IContainerControl*> ICnrControlList;
- #else
-
- declare(IGSet1, IContainerControl);
- class ICnrControlList : public IGSet1(IContainerControl)
- {
- public:
- ICnrControlList() : IGSet1(IContainerControl)() {}
-
- };
-
- #endif
-
-
- class IContainerControl : public IControl
- {
- /*******************************************************************************
- * IContainerControl is used to display a container of objects in any of *
- * the supported views (Icon, Name, Tree, Details, Text). *
- * *
- * This control can be constructed similar to the other controls in the *
- * library - on a window, loaded in a dialog template, or as a pre-existing *
- * control. *
- * *
- * EXAMPLE: *
- * ** Frame Window Constructor ** *
- * CustomerList :: CustomerList(const IRectangle& rect, *
- * Boolean fLoadObjectsIn) *
- * : IFrameWindow(CNR_MAINWINDOW) *
- * ** Create a Container Control ** *
- * pCustContainer = new IContainerControl(CNR_RESID, this, this); *
- * ** Make the container the client ** *
- * setClient(pCustContainer); *
- * ** Now construct columns and objects ** *
- *******************************************************************************/
- typedef IControl Inherited;
- friend class IContainerColumn;
- friend class IContainerObject;
- friend class ICnrEditHandler;
-
- public:
- /*---------------------------- ENUMERATIONS ------------------------------------
- | The following enumerations are defined: |
- | state - internal container state flag |
- | enumerationOrder - order that icons are enumerated in |
- | titleAlighnment - title justification |
- ------------------------------------------------------------------------------*/
- enum state { ok=1, noRefresh=2, invalid=4};
- enum enumerationOrder { inItemOrder, inIconZOrder};
- enum titleAlignment { left, right, center};
-
- /*---------------------------- STYLES/ATTRIBUTES -------------------------------
- | The following classes are macro generated: |
- | IContainerControl::Style |
- | IContainerControl::Attribute |
- | Default styles and attributes can be queried/set with the following: |
- | defaultStyle - retrieve the default style |
- | setDefaultStyle - set a new default style |
- | defaultAttribute - retrieve the default style |
- | setDefaultAttribute - set a new default style |
- ------------------------------------------------------------------------------*/
- INESTEDBITFLAGCLASSDEF2( Style, IContainerControl, IWindow, IControl);
- INESTEDBITFLAGCLASSDEF0( Attribute, IContainerControl);
-
- /* Available const styles (in addition to IWindow/IControl) */
- static const Style
- readOnly,
- autoPosition, /* default */
- extendedSelection,
- singleSelection, /* default */
- multipleSelection,
- verifyPointers;
-
- /* Available const attributes */
- static const Attribute
- textView,
- iconView, /* default */
- nameView,
- detailsView,
- treeView,
- flowedView,
- readOnlyTitle, /* default */
- titleSeparator,
- detailsViewTitles, /* default */
- visibleTitle,
- centeredTitle,
- leftJustifiedTitle,
- rightJustifiedTitle,
- handleForgroundPaint,
- handleBackgroundPaint,
- orderedTargetEmphasis,
- mixedTargetEmphasis,
- visibleTreeLine; /* default */
-
- /* References to default styles and attributes */
- static const Style& defStyle;
- static const Attribute& defAttribute;
-
- static Style
- defaultStyle();
- static void
- setDefaultStyle( Style style);
- static Attribute
- defaultAttribute();
- static void
- setDefaultAttribute( Attribute attribute);
-
- /*------------------------ CONSTRUCTORS/DESTRUCTORS ----------------------------
- | There are 3 ways to construct instances of this class: |
- | 1. On a window by specifying the parent and owner. |
- | |
- | 2. From a container control on a loaded dialog template. |
- | |
- | 3. From and existing container control's window handle. |
- ------------------------------------------------------------------------------*/
- /* Construct a control from scratch */
- IContainerControl( unsigned long Id,
- const IWindow* parent,
- const IWindow* owner,
- const IRectangle& initial = IRectangle(),
- const Style& initialStyle
- = defStyle,
- const Attribute& initialAttribute
- = defAttribute);
-
- /* Construct from a control on a Dialog */
- IContainerControl( unsigned long Id,
- const IWindow* parentDialog);
-
- /* Construct from an existing control */
- IContainerControl( IWindowHandle handle);
-
- /* Compare two controls, equality if they are the same */
- Boolean operator==( const IContainerControl& that) { return (&that==this); }
-
- virtual
- ~IContainerControl();
-
- /*------------------------ INITIALIZATION --------------------------------------
- | initialize - setup the container environment. Called automatically if |
- | the first container component created is an IContainerControl but MUST |
- | be called explicitly if creating IContainerObjects before the container |
- | is constructed. |
- ------------------------------------------------------------------------------*/
- static void
- initialize();
-
-
- class ObjectCursor
- {
- /***************************************************************************
- * The cursor class is used to iterate the container finding objects *
- * based on the selection criteria established during construction of the *
- * cursor. *
- * *
- * EXAMPLE: *
- * ** smack all the objects in a container ** *
- * IContainerControl::ObjectCursor cursor(*pCustContainer) *
- * for (cursor.setToFirst(); *
- * cursor.isValid(); *
- * cursor.setToNext() ) *
- * { *
- * object.objectAt(cursor).smack(); *
- * } *
- * *
- ***************************************************************************/
- public:
- /*------------------------ CONSTRUCTORS/DESTRUCTORS -------------------------
- | There are 3 ways to construct instances of this class: |
- | 1) A cursor to iterate all records in the container or records meeting |
- | the Emphasis selection criteria. Records can be found in item order |
- | (the default) or Z order. |
- | 2) A cursor to find text in the Icon View. The search can be case |
- | sensitive or not and the text can required to start the icon string. |
- | 3) A cursor to find all objects that have the passed object as a parent. |
- ---------------------------------------------------------------------------*/
- ObjectCursor( const IContainerControl& container,
- IContainerObject::emphasis Emphasis= IContainerObject::none,
- enumerationOrder Enumeration=inIconZOrder);
-
- /* Construct an iterator for text occurances */
- ObjectCursor( const IContainerControl& container,
- const char* Text,
- Boolean isCaseSensitive = true,
- Boolean isFirstInRecord = false);
-
- /* Construct an iterator for Child Iteration */
- ObjectCursor( const IContainerControl& container,
- const IContainerObject* parentObject);
-
- virtual
- ~ObjectCursor();
-
- /*------------------------ CURSOR MOVEMENT ----------------------------------
- | setToFirst - point to the first object in the container |
- | setToNext - point to the next or first object in the container |
- | setToLast - point to the last object in the container |
- | setToPrevious - point to the previous or last object in the container |
- ---------------------------------------------------------------------------*/
- virtual Boolean
- setToFirst(),
- setToNext(),
- setToLast(),
- setToPrevious();
-
- /*------------------------ CURSOR MOVEMENT/ OBJECT RETRIEVAL ----------------
- | first - point to and return the first object in the container |
- | next - point to and return the next or first object in the container |
- | last - point to and return the last object in the container |
- | previous - point to and return the previous or last object in container |
- | current - return the current object of this cursor |
- | setCurrent - set the cursor to point to a particular object |
- ---------------------------------------------------------------------------*/
- IContainerObject
- *first(),
- *next(),
- *previous(),
- *last(),
- *current() const;
- void
- setCurrent( const IContainerObject* Current);
-
- /*------------------------ CURSOR VALIDATION --------------------------------
- | isValid - does this cursor point to a valid object? |
- | invalidate - flag this cursor as invalid |
- ---------------------------------------------------------------------------*/
- virtual Boolean
- isValid() const;
- virtual void
- invalidate();
-
- protected:
- /*----------------------------- IMPLEMENTATION ------------------------------
- | object - retrieve an object in the container |
- | find - search for an object in the container |
- | selectedObject - return an object with the specified emphasis |
- ---------------------------------------------------------------------------*/
- IContainerObject
- *object( const IContainerObject* pcnrobjAfter,
- unsigned long ulCmd),
- *find( unsigned long ulView,
- IContainerObject* pcnrobjAfter,
- const char* pszText,
- Boolean fIsCaseSensitive,
- Boolean fIsFirstInRecord),
- *selectedObject( const IContainerObject* pcnrobjAfter,
- unsigned long ulEmphasis);
- private:
- /*------------------------------ DATA MEMBERS -------------------------------
- | pcnrobjClCurrent - the current object or zero |
- | pcnrobjClParent - the parent to search for descendent objects |
- | ulClView - the view to search in |
- | pcnrctlClOwner - the container to search |
- | flClEmphasis - the emphasis to restrict the search |
- | strClSearchString - text for search |
- | fClIsCaseSensitive - should text search be case sensitive or not |
- | fClIsFirstInRecord - must match from the beginning |
- | flClEnumeration - order to enumerate in icon view |
- ---------------------------------------------------------------------------*/
- IContainerObject
- *pcnrobjClCurrent,
- *pcnrobjClParent;
- unsigned long
- ulClView;
- IContainerControl
- *pcnrctlClOwner;
- unsigned long
- flClEmphasis;
- IString
- strClSearchString;
- Boolean
- fClIsCaseSensitive,
- fClIsFirstInRecord;
- unsigned long
- flClEnumeration;
- }; /* end ObjectCursor */
-
-
- class ColumnCursor
- {
- /***************************************************************************
- * The cursor class is used to iterate the containers details view columns *
- * *
- * EXAMPLE: *
- * ** smack all the columns in a container ** *
- * IContainerControl::ColumnCursor cursor(*pCustContainer); *
- * for (cursor.setToFirst(); *
- * cursor.isValid(); *
- * cursor.setToNext() ) *
- * { *
- * object.columnAt(cursor).smack(); *
- * } *
- * *
- ****************************************************************************/
- public:
- /*------------------------ CONSTRUCTORS/DESTRUCTORS -------------------------
- | There is 1 way to construct an instance of this class: |
- | 1) A cursor to iterate all columns in the container meeting the |
- | visibility criteria(All columns or visible columns only). |
- ---------------------------------------------------------------------------*/
- ColumnCursor( const IContainerControl& container,
- Boolean VisibleOnly=false);
- virtual
- ~ColumnCursor() {}
-
- /*------------------------ CURSOR MOVEMENT ----------------------------------
- | setToFirst - point to the first column in the container |
- | setToNext - point to the next or first column in the container |
- | setToLast - point to the last column in the container |
- | setToPrevious - point to the previous or last column in the container |
- ---------------------------------------------------------------------------*/
- virtual Boolean
- setToFirst(),
- setToNext(),
- setToLast(),
- setToPrevious();
-
- /*------------------------ CURSOR MOVEMENT/ COLUMN RETRIEVAL ----------------
- | first - point to and return the first column in the container |
- | next - point to and return the next or first column in the container |
- | last - point to and return the last column in the container |
- | previous - point to and return the previous or last column in container |
- | current - return the current column of this cursor |
- | setCurrent - set the cursor to point to a particular column |
- ---------------------------------------------------------------------------*/
- virtual IContainerColumn
- *first(),
- *next(),
- *previous(),
- *last(),
- *current() const;
- void
- setCurrent( const IContainerColumn* Current);
-
- /*------------------------ CURSOR VALIDATION --------------------------------
- | isValid - does this cursor point to a valid column? |
- | invalidate - flag this cursor as invalid |
- ---------------------------------------------------------------------------*/
- virtual Boolean
- isValid() const;
- virtual void
- invalidate();
-
- private:
- /*------------------------------ DATA MEMBERS -------------------------------
- | pcnrcolClCurrent - the current column or zero |
- | pcnrctlOwner - the container to search |
- | fClVisible - should search be on visible columns only |
- ---------------------------------------------------------------------------*/
- IContainerColumn
- *pcnrcolClCurrent;
- IContainerControl
- *pcnrctlClOwner;
- Boolean
- fClVisible;
- };
- friend class ColumnCursor;
-
-
-
- /*-------------------------------- ACCESSORS -----------------------------------
- | These function provide means of getting and setting the accessible |
- | attributes of instances of this class: |
- | |
- | setContainerTitle - Set container title using text or a resource ID. |
- | justifyContainerTitle - Set the justification attributes for the title. |
- | showContainerTitle - Show the container title. |
- | hideContainerTitle - Remove the container title from the container window.|
- | enableTitleUpdate - Allow the container title to be edited. |
- | disableTitleUpdate - Do not allow the container title to be edited |
- | showTitleSeparator - Display a horizontal separator between title and |
- | viewport. |
- | hideTitleSeparator - Remove title separator from container window. |
- | showDetailsViewTitles - Display column titles in details view. |
- | hideDetailsViewTitles - Remove column titles from details view. |
- | setLineSpacing - Set vertical distance between records. |
- | setIconSize - Set Icon or Bitmap size for all objects. |
- | setSingleSelection - Set selection mode to Single Selection. |
- | setMultipleSelection - Set selection mode to Multiple Selection. |
- | setExtendedSelection - Set selection mode to Extended Selection. |
- | setNormalTargetEmphasis - Set drag mode to normal object emphasis. |
- | setOrderedTargetEmphasis - Set drag mode to ordered target emphasis. |
- | setMixedTargetEmphasis - Set drag mode to mixed target emphasis |
- | containerTitle - Query the title of the container. |
- | isContainerTitleVisible - Is the container title currently displayed? |
- | lineSpacing - Query the space in Pixels between lines. |
- | iconSize - Query the icon or bitmap size of all objects. |
- ------------------------------------------------------------------------------*/
- IContainerControl
- &setContainerTitle( const char* pszTitle),
- &setContainerTitle( const IResourceId& resid),
- &justifyContainerTitle( titleAlignment align = center),
- &showContainerTitle(),
- &hideContainerTitle(),
- &enableTitleUpdate(),
- &disableTitleUpdate(),
- &showTitleSeparator(),
- &hideTitleSeparator(),
- &showDetailsViewTitles(),
- &hideDetailsViewTitles(),
- &setLineSpacing( long lLineSpacing),
- &setIconSize( const ISize& sizeIcon),
- &setSingleSelection(),
- &setMultipleSelection(),
- &setExtendedSelection(),
- &setNormalTargetEmphasis(),
- &setOrderedTargetEmphasis(),
- &setMixedTargetEmphasis();
-
- IString
- containerTitle() const;
-
- Boolean
- isContainerTitleVisible() const;
-
- long
- lineSpacing() const;
-
- ISize
- iconSize() const;
-
- /******************************************************************************/
- /* The following functions are still under development and are in the midst of*/
- /* substantial change. */
- /******************************************************************************/
- IContainerControl
- &enableCaching( unsigned long ulDeltaValue = 30),
- &disableCaching(),
- &enableOwnerDraw(),
- &disableOwnerDraw(),
- &enableOwnerPaintBackground(),
- &disableOwnerPaintBackground();
-
-
-
- /*-------------------- CHANGING THE CONTAINER VIEW -----------------------------
- | showTextView - Set the current view to Non-flowed Text View. |
- | showFlowedTextView - Set the current view to Flowed Text View. |
- | showNameView - Set the current view to Non-flowed Name View. |
- | showFlowedNameView - Set the current view to Flowed Name View. |
- | showDetailsView - Set the current view to Details View. |
- | showTreeIconView - Set the current view to Tree-icon View. |
- | showTreeTextView - Set the current view to Tree-text View. |
- | showTreeNameView - Set the current view to Tree-name View. |
- | showIconView - Set the current view to Icon View. |
- | arrangeIconView - Arrange the Icon View. |
- ------------------------------------------------------------------------------*/
- IContainerControl
- &showTextView(),
- &showFlowedTextView(),
- &showNameView(),
- &showFlowedNameView(),
- &showDetailsView(),
- &showTreeIconView(),
- &showTreeTextView(),
- &showTreeNameView(),
- &showIconView(),
- &arrangeIconView();
-
- /*-------------- QUERYING THE CURRENT CONTAINER VIEW ---------------------------
- | isTextView - Is the container currently in Text View? |
- | isNameView - Is the container currently in Name View? |
- | isDetailsView - Is the container currently in Details View? |
- | isTreeView - Is the container currently in Tree View? |
- | isIconView - Is the container currently in Icon View? |
- | isFlowed - Is the current container view flowed? |
- ------------------------------------------------------------------------------*/
- Boolean
- isTextView() const,
- isNameView() const,
- isDetailsView() const,
- isTreeView() const,
- isIconView() const,
-
- isFlowed() const;
-
- /*-------------------- CONTAINER REFRESH ---------------------------------------
- | setRefreshOff - Disable refreshing the container after changes. |
- | setRefreshOn - Enable refreshing the container after changes. |
- | refresh - Refresh all objects in the container. |
- | refreshAllContainers - Refresh all containers. |
- | isRefreshOn - Query the refresh state of the container. |
- ------------------------------------------------------------------------------*/
- IContainerControl
- &setRefreshOff(),
- &setRefreshOn(),
- &refresh();
-
- static void
- refreshAllContainers();
-
- Boolean
- isRefreshOn();
-
- /*-------------- QUERYING THE CONTAINER VIEWPORT RECTANGLE ---------------------
- | viewportOnWorkspace - Retrieve the current viewport in workspace coordinates |
- | viewportOnWindow - Retrieve the current viewport in window coordinates |
- | detailsViewportOnWorkspace - Details viewport(R or L) in workspace coord. |
- | detailsViewportOnWindow - Details viewport(R or L) in window coord. |
- ------------------------------------------------------------------------------*/
- IRectangle
- viewportOnWorkspace() const,
- viewportOnWindow() const,
- detailsViewportOnWorkspace( Boolean fRight = false) const,
- detailsViewportOnWindow( Boolean fRight = false) const;
-
- /*------------------- SCROLLING ------------------------------------------------
- | scrollVertically - Scroll the container vertically. |
- | scrollHorizontally - Scroll the container horizontally. |
- | scroll - Scroll both horizontally and vertically. |
- | scrollDetailsHorizontally - Scroll right or left Details view horizontally. |
- | scrollToObject - Scroll a particular object into the vieport. |
- | scrollToObject - Scroll a particular object and column into the viewport. |
- ------------------------------------------------------------------------------*/
- virtual IContainerControl
- &scrollVertically( long lPixels),
- &scrollHorizontally( long lPixels,
- Boolean fRight=false),
- &scroll( long lVericalPixels,
- long lHorizontalPixels,
- Boolean fRight=false),
- &scrollDetailsHorizontally( long lHorizontalPixels,
- Boolean fRight=false),
- &scrollToObject( const IContainerObject* Object),
- &scrollToObject( const IContainerObject* Object,
- const IContainerColumn* Column);
-
- /*------------------------------------------------------------------------------
- | The following functions are still under development and are in the midst of |
- | substantial change. |
- ------------------------------------------------------------------------------*/
- IContainerControl
- &setIconViewBackground( const IBitmapHandle& Background,
- const ISize& sizBitmap),
- &setIconViewBackground( const IBitmapHandle& Background),
- &removeIconViewBackground();
-
- /*------------------- TREE VIEW FUNCTIONS --------------------------------------
- | showTreeLine - Show lines connecting parents to children records. |
- | hideTreeLine - Do not show lines connecting parents to children records. |
- | setTreeExpandIconSize - Change the size of the Expanded/Collapsed Bitmaps. |
- | setTreeViewIndent - Set distance children will be offset horiz. from parent.|
- | setTreeItemBitmaps - Set the Bitmaps to be use for Tree View. |
- | setTreeItemIcons - Set the Icons to be used for Tree View. |
- | collapseTree - Collapse all nodes of Tree view. |
- | expandTree - Expand all nodes of Tree view. |
- ------------------------------------------------------------------------------*/
- virtual IContainerControl
- &showTreeLine( long lTreeLinePelWidth=-1),
- &hideTreeLine(),
- &setTreeExpandIconSize( const ISize& sizeIcon),
- &setTreeViewIndent( long lIndentPels=-1),
- &setTreeItemBitmaps( const IBitmapHandle& Expanded,
- const IBitmapHandle& Collapsed),
- &setTreeItemBitmaps( const IResourceId& Expanded,
- const IResourceId& Collapsed),
- &setTreeItemIcons( const IPointerHandle& Expanded,
- const IPointerHandle& Collapsed),
- &setTreeItemIcons( const IResourceId& Expanded,
- const IResourceId& Collapsed),
- &collapseTree(),
- &expandTree();
-
- /*------------------- DETAILS VIEW FUNCTIONS -----------------------------------
- | showSplitBar - Add the split bar to the details view viewport. |
- | hideSplitBar - Remove the split bar from the detail view viewport. |
- | setDetailsViewSplit - Split the details view- specifying last column in left.|
- | isColumnRight - Return true if the given column is to the right |
- | of the splitbar. |
- | addColumn - Add column to container following the given column. |
- | removeColumn - Remove given column from the container. |
- | removeColumnAt - Remove the column at a gievn index or Cursor. |
- | columnAt - Retrieve column at given index or Cursor. |
- | detailsViewSplit - Return last column before split bar. |
- | columnCount - Return number of columns in the container. |
- ------------------------------------------------------------------------------*/
- virtual IContainerControl
- &showSplitBar(),
- &hideSplitBar(),
- &setDetailsViewSplit(
- const IContainerColumn* LastColumnBeforeSplit,
- unsigned long ulPixelsFromLeft=50);
- /* note: the 1st parameter is the last column */
- /* which will ever be scrolled in the left */
- /* frame. The 2nd parameter is the location */
- /* of the split bar in Pixels */
- Boolean
- isColumnRight( const IContainerColumn* pcnrcol) const;
-
- virtual IContainerControl
- &addColumn( const IContainerColumn* Column,
- const IContainerColumn* AfterColumn=0),
- &removeColumn( const IContainerColumn* Column),
- &removeColumnAt( IContainerControl::ColumnCursor& cursor);
-
- IContainerColumn
- *columnAt( unsigned long Index) const,
- *columnAt( const ColumnCursor&) const,
- *detailsViewSplit() const;
-
- unsigned long
- columnCount() const;
-
- /*------------------- ADDING AND REMOVING OBJECTS ------------------------------
- | addObject - Add an object to the container. The parent defines |
- | the objects location in the tree view. |
- | addObjectAfter - Add an object to be placed after a given object |
- | removeObject - Remove an object from this container or all |
- | containers. |
- | removeObjectAt - Remove the object at the Cursor location. |
- | removeSelectedObjects - Remove all selected objects from the container. |
- | removeAllObjects - Remove all objects from the container. |
- | deleteSelectedObjects - Delete this containers selected objects. If an |
- | object exists in other containers it is removed |
- | and deleted from them as well. |
- | deleteAllObjects - Delete all objects in this container. If an |
- | object exists in other containers it is removed |
- | and deleted from them as well. |
- ------------------------------------------------------------------------------*/
- virtual IContainerControl
- &addObject( const IContainerObject* newObject,
- const IContainerObject* parentObject = 0),
- &addObjectAfter( const IContainerObject* newObject,
- const IContainerObject* afterObject,
- const IContainerObject* parentObject = 0),
- /* remove does not delete the object */
- &removeObject( IContainerObject* object,
- Boolean fAllContainers = false),
- &removeObjectAt( IContainerControl::ObjectCursor& cursor),
- &removeSelectedObjects(),
- &removeAllObjects(),
- &deleteSelectedObjects(),
- &deleteAllObjects();
-
- /*----------------- MOVING/COPYING SUBTREES ------------------------------------
- | moveObjectTo - Move an object and it's descendents to a new location in the |
- | tree view. |
- | copyObjectTo - Copy an object and it's descendents to a new location in the |
- | tree view. The object must overload the "objectCopy" function.|
- ------------------------------------------------------------------------------*/
- Boolean
- moveObjectTo( IContainerObject* moveObject,
- IContainerObject* newParent = 0,
- IContainerControl* newContainer = 0),
- copyObjectTo( IContainerObject* copyObject,
- IContainerObject* Parent = 0,
- IContainerControl* newContainer = 0);
-
- Boolean
- containsObject( const IContainerObject* Object) const;
-
- /*-------------------- RETRIEVING OBJECTS --------------------------------------
- | objectAt - Return an object at an index in the container. |
- | objectAt - Return an object at a Cursor location. |
- | parent - Return the parent object in the container tree view.|
- | descendentsOf - Return the set of all descendents of an object |
- | in the container tree view. |
- | immediateDescendentsOf - Return the set of immediate descendents (only) of |
- | an object in the container tree view. |
- | objectList - Return the set of all objects in the container. |
- ------------------------------------------------------------------------------*/
- virtual IContainerObject
- *objectAt( unsigned long ulIndex) const,
- *objectAt( const IContainerControl::ObjectCursor&) const,
- *parent() const;
-
- /* Return a list of descendents of the passed object */
- ICnrObjectSet
- descendentsOf( IContainerObject* ParentObject) const,
- immediateDescendentsOf( IContainerObject* ParentObject) const,
- objectList() const;
-
-
- unsigned long
- objectCount() const;
-
-
- IContainerControl
- &setDestroyObjectsOnClose() {fClDestructObjects=true; return *this;}
-
- /*------------------ SETTING OBJECT ATTRIBUTES ---------------------------------
- | setSelected - Give an object selection emphasis. |
- | removeSelected - Remove selection emphasis from an object. |
- | setInUse - Give an object in-use emphasis. |
- | removeInUse - Remove in-use emphasis from an object. |
- | setCursor - Give an object cursored emphasis. |
- | enableDataUpdate - Disable read-only for an object. |
- | disableDataUpdate - Make an object read-only. |
- | expand - Expand a tree-view parent object. |
- | collapse - Collapse a tree-view parent object. |
- | refresh - Invalidate an object so it will be redrawn. |
- | enableDrop - Set an object to receive target emphasis during drag. |
- | disableDrop - Set an object to not droponable, no target emph is drawn.|
- ------------------------------------------------------------------------------*/
- IContainerControl
- &setSelected( IContainerObject* pcnrobj),
- &removeSelected( IContainerObject* pcnrobj),
- &setInUse( IContainerObject* pcnrobj),
- &removeInUse( IContainerObject* pcnrobj),
- &setCursor( IContainerObject* pcnrobj),
- &enableDataUpdate( IContainerObject* pcnrobj),
- &disableDataUpdate( IContainerObject* pcnrobj),
- &expand( IContainerObject* pcnrobj),
- &collapse( IContainerObject* pcnrobj),
- &refresh( IContainerObject* pcnrobj),
- &enableDrop( IContainerObject* pcnrobj),
- &disableDrop( IContainerObject* pcnrobj);
-
- /*------------------ QUERYING OBJECT ATTRIBUTES --------------------------------
- | isTarget - Is the object a target of direct manipulation? |
- | isSelected - Does the object have selection emphasis? |
- | isInUse - Does the object have in-use emphasis? |
- | isCursored - Does the object have cursored emphasis? |
- | isFiltered - Is the object currently filtered out? |
- | isExpanded - Is the tree-view node object currently expanded? |
- | isCollapsed - Is the tree-view node object currently collapsed? |
- | isReadOnly - Is the object read-only(no direct edit support)? |
- | isDropOnAble - Is the object set to receive a direct manipulation drop action|
- ------------------------------------------------------------------------------*/
- Boolean
- isTarget( const IContainerObject* pcnrobj) const,
- isSelected( const IContainerObject* pcnrobj) const,
- isInUse( const IContainerObject* pcnrobj) const,
- isCursored( const IContainerObject* pcnrobj) const,
- isFiltered( const IContainerObject* pcnrobj) const,
- isExpanded( const IContainerObject* pcnrobj) const,
- isCollapsed( const IContainerObject* pcnrobj) const,
- isReadOnly( const IContainerObject* pcnrobj) const,
- isDropOnAble( const IContainerObject* pcnrobj) const;
-
- /*------------------ ICON VIEW OBJECT POSITION ---------------------------------
- | moveIconTo - Move object to specified workspace location. |
- | iconRectangle - Query icon rectangle (optionally include text rect). |
- | detailObjectRectangle - Query details view rectangle. |
- | detailObjectRectangle - Query object and column intersection rectangle. |
- | textRectangle - Query text rectangle. |
- | objectUnderPoint - Retrieve object under point in window coordinates. |
- ------------------------------------------------------------------------------*/
- IContainerControl
- &moveIconTo( IContainerObject* pcnrobj,
- const IPoint& pt);
- IRectangle
- iconRectangle( const IContainerObject* pcnrobj,
- Boolean fIncludeText=false) const,
- detailObjectRectangle( const IContainerObject* pcnrobj,
- Boolean fRightWindow=0 ) const,
- detailObjectRectangle( const IContainerObject* pcnrobj,
- const IContainerColumn* pcnrcol) const,
- textRectangle( const IContainerObject* pcnrobj) const;
-
- IContainerObject
- *objectUnderPoint(const IPoint& pt);
-
- /*------------------------ SORTING OBJECTS -------------------------------------
- | Notes: |
- | 1) Sorting by user defined data is handled in the |
- | subclass by: |
- | a) creating a user comparison function which |
- | returns: |
- | 0 if p1==p2 |
- | <0 if p1<p2 |
- | >0 if p1>p2 |
- | b) invoking setSortFunction with the function |
- | c) invoking the sort() function. |
- | 2) User data will be passed to sort function. |
- | 3) If user data not specified, container passed. |
- | |
- | setSortFunction - Indicate a function to be used for object comparison. |
- | sortByIconText - Sort the container by the icons text. |
- | sort - Sort by the User Defined Sort function. |
- | nlsCompare - Compare two strings with National Language Support. |
- ------------------------------------------------------------------------------*/
- IContainerControl
- &setSortFunction( ICOMPOBJCALLBACK* pfncomp)
- { pfncompCl = pfncomp; return *this;}
- IContainerControl
- &sortByIconText(),
- &sort( void* pUserData=0);
-
- long
- nlsCompare( const char* pszString1,
- const char* pszString2) const;
-
- /*------------------------ FILTERING OBJECTS -----------------------------------
- | Notes: |
- | 1) Filter Function returns true to keep record in. |
- | 2) User data will be passed to filter function. |
- | 3) If user data not specified, container passed. |
- | |
- | setFilterFunction - |
- | filter - Filter the container with User Defined Filter |
- ------------------------------------------------------------------------------*/
- IContainerControl
- &setFilterFunction( IFILTEROBJCALLBACK* pfnfilter)
- { pfnfilterCl = pfnfilter; return *this; }
- IContainerControl
- &filter( void* pUserData=0);
-
- /*------------------------ DIRECT EDITING --------------------------------------
- | editContainerTitle - Open an edit field on the Container Title. |
- | editColumnTitle - Open an edit field on a Column Title. |
- | editObject - Open an edit field on an object. |
- | closeEdit - Close an open edit field. |
- | setEditMLE - Store an MLE being used for editing. |
- | setEditColumn - Store the Column over which editing is occurring. |
- | setEditObject - Store the Object over which editing is occurring. |
- | currentEditMLE - Retrieve the MLE being used for editing. |
- | currentEditColumn - Retrieve the column being edited. |
- | currentEditObject - Retrieve the object being edited. |
- ------------------------------------------------------------------------------*/
- virtual IContainerControl
- &editContainerTitle(),
- &editColumnTitle( IContainerColumn* pcnrcol),
- &editObject( IContainerObject* pcnrobj,
- IContainerColumn* pcnrcol=0),
- &closeEdit(),
- &setEditMLE( IMultiLineEdit*),
- &setEditColumn( IContainerColumn*),
- &setEditObject( IContainerObject*);
-
- IMultiLineEdit
- *currentEditMLE();
- IContainerColumn
- *currentEditColumn();
- IContainerObject
- *currentEditObject();
-
-
-
- /*------------------------ MISCELLANEOUS ---------------------------------------
- | cursoredObject - Return the object with the cursor. |
- | containerFromHandle - Retrieve a container from the list using the handle. |
- ------------------------------------------------------------------------------*/
- IContainerObject
- *cursoredObject() const;
-
- static IContainerControl
- *containerFromHandle( const IWindowHandle& ContainerHandle);
-
-
-
-
- protected:
- /*----------------------------- IMPLEMENTATION ---------------------------------
- | The following functions are used in the implementation of the class: |
- | setContainerAttributes - Set the attributes into the container control. |
- | containerInfo - Refresh our copy of the containers state data. |
- | setEmphasis - Set an object to an emphasis attribute. |
- | setAttibutes - Update the attributes of an object. |
- | setDefaultContainer - Initialize a container to the default styles. |
- | containerAttributes - Return the current container attribute mask. |
- | attributes - Return an attribute mask for an object. |
- | column - Return a column matching the CMD criteria. |
- | calcMinSize - Return a minimum size for the container. |
- ------------------------------------------------------------------------------*/
-
- virtual void
- setContainerAttributes( unsigned long ulCnrAttrOff,
- unsigned long ulCnrAttrOn),
- containerInfo() const,
- setEmphasis( IContainerObject* pcnrobj,
- unsigned long ulEmphasisAttribute,
- Boolean fOn=true),
- setAttributes( IContainerObject* pcnrobj,
- unsigned long flAttrOff,
- unsigned long flAttrOn),
- setDefaultContainer( const Attribute& attribute);
-
- unsigned long
- containerAttributes() const,
- attributes( const IContainerObject* pcnrobj) const;
-
- IContainerColumn
- *column( IContainerColumn* pcnrcol,
- unsigned long ulCmd,
- Boolean visible);
-
- virtual unsigned long
- baseRecordSize();
-
- virtual ISize
- calcMinSize() {return ISize(50,50); }
-
- IContainerControl();
-
- /*-------------------------------- OVERRIDES -----------------------------------
- | This class overrides the following inherited functions: |
- | handleWindowEvent - Overriddent to ensure that objects and column are |
- | removed from the container on WM_DESTROY. |
- ------------------------------------------------------------------------------*/
- virtual Boolean
- handleWindowEvent( IEvent& evt);
-
-
-
- private:
- /*--------------------------------- PRIVATE ----------------------------------*/
- void
- addContainer(),
- showView( unsigned long ulViewFlags),
- collectDescendents( ICnrObjectSet& cnrset,
- IContainerObject* pcnrobj) const;
-
- IContainerObject
- *findFirst( unsigned long usView,
- const char* pszText,
- Boolean isCaseSensitive = false,
- Boolean isFirstInRecord = false) const,
- *selectedObject( const IContainerObject* pcnrobjAfter,
- unsigned long ulEmphasis) const,
- *object( const IContainerObject* pcnrobjAfter,
- unsigned long ulCmd) const;
-
- static IWindowHandle
- hwndAllocation();
- static ICnrControlList
- &containerList();
- static IPrivateResource
- &containerKey();
-
- IRectangle
- viewport( unsigned long ulCoordinateSpace,
- Boolean fRightSplitWindow) const;
-
- ICnrInfo
- *pcnrinfoCl;
- ICOMPOBJCALLBACK
- *pfncompCl;
- IFILTEROBJCALLBACK
- *pfnfilterCl;
-
- /* MLE Edit data */
- IContainerColumn
- *pcnrcolClEdit;
- IContainerObject
- *pcnrobjClEdit;
- IMultiLineEdit
- *pmleClEdit;
-
- Boolean
- fClDestructObjects,
- fClInvalidate;
- int
- lClSplitbar,
- flClState;
- unsigned long
- ulClDragEvent;
- IBitmapHandle
- hbmClIconViewBackground;
- ISize
- sizIconViewBitmap;
- static Attribute
- classDefaultAttribute;
- static Style
- classDefaultStyle;
- static IWindowHandle
- hwndClAllocate;
- };
-
-
- /*-----------------------*/
- /* INLINES */
- /*-----------------------*/
- inline IContainerControl& IContainerControl ::setRefreshOff()
- { flClState |= IContainerControl::noRefresh; return *this;}
- inline IContainerControl& IContainerControl ::setRefreshOn()
- { flClState &= ~IContainerControl::noRefresh; return *this; }
- inline Boolean IContainerControl ::isRefreshOn()
- { return !(flClState & IContainerControl::noRefresh); }
-
-
-
- INESTEDBITFLAGCLASSFUNCS(Style, IContainerControl);
-
- #define _USEBBIMP_ 1
-
- #endif