OWLNext 6.32
Public Member Functions | Protected Member Functions
owl::TColumnHeader Class Reference

#include <colmnhdr.h>

Inheritance diagram for owl::TColumnHeader:
owl::TControl owl::TWindow owl::TEventHandler owl::TStreamableBase

List of all members.

Public Member Functions

 TColumnHeader (TWindow *parent, int id, int x, int y, int w, int h, TModule *module=0)
 TColumnHeader (TWindow *parent, int resourceId, TModule *module=0)
bool Layout (TRect &boundingRect, WINDOWPOS &winPos)
bool Layout (uint swpFlags=0)
int GetCount () const
int Add (const THdrItem &item)
int Insert (const THdrItem &item, int index)
bool Delete (int index)
bool GetItem (THdrItem &, int index, uint mask=0)
bool SetItem (const THdrItem &itemInfo, int index)
int HitTest (THeaderHitTestInfo &ht)
HIMAGELIST CreateDragImage (int index) const
HIMAGELIST GetImageList () const
HIMAGELIST SetImageList (HIMAGELIST iml)
bool GetItemRect (TRect &rect, int index) const
bool SetOrderArray (int size, int *array)
bool GetOrderArray (int size, int *array) const
TResult OrderToIndex (int order)
int SetHotDivider (uint32 value, bool flag=true)
uint Transfer (void *buffer, TTransferDirection direction)

Protected Member Functions

virtual TGetClassNameReturnType GetClassName ()

Detailed Description

TColumnHeader encapsulates the 'header control', a window usually positioned above columns of text or numbers.


Constructor & Destructor Documentation

owl::TColumnHeader::TColumnHeader ( TWindow parent,
int  id,
int  x,
int  y,
int  w,
int  h,
TModule module = 0 
)

Constructor for TColumnHeader.

Initializes its data fields using parameters passed and default values. By default, a ColumnHeader associated with the TColumnHeader will:

  • be visible upon creation
  • have a border, divider tracks
  • be a horizontal header window
owl::TColumnHeader::TColumnHeader ( TWindow parent,
int  resourceId,
TModule module = 0 
)

Constructor of a ColumnHeader object which aliases a control found within a dialog.


Member Function Documentation

int owl::TColumnHeader::Add ( const THdrItem item)

Adds a new item to the column header. The following illustrates a typical use of the 'Add' method:

      THdrItem hdrItem("&Employee Names");
      hdr.Add(hdrItem);

References GetCount(), and Insert().

HIMAGELIST owl::TColumnHeader::CreateDragImage ( int  index) const [inline]

Version 4.70 functionality.

Creates a semi-transparent version of an item's image for use as a dragging image. Returns a handle to an image list that contains the new image as its only element. The image assigned to this item is the basis for the transparent image.

Parameters:
indexis a zero-based index of the item within the header control.

References owl::TWindow::SendMessage().

bool owl::TColumnHeader::Delete ( int  index)

Deletes the item at the specified 'index' from the header control.

References owl::TWindow::SendMessage().

TWindow::TGetClassNameReturnType owl::TColumnHeader::GetClassName ( ) [protected, virtual]

Returns the class name of the underlying control associated with the TColumnHeader object.

Note:
The logic used depends on the availability of native Common Control support. In the case where OWL provides the underlying support, we'll specify a TColumnHeader -specific classname although that's not necessary [it eases debugging]

Reimplemented from owl::TWindow.

int owl::TColumnHeader::GetCount ( ) const

If successful this method returns the number of items in the header control. In case of failure it returns -1.

HIMAGELIST owl::TColumnHeader::GetImageList ( ) const [inline]

Version 4.70 functionality.

Retrieves the handle to the image list that has been set for an existing header control.

References owl::TWindow::SendMessage().

bool owl::TColumnHeader::GetItem ( THdrItem itemInfo,
int  index,
uint  msk = 0 
)

Retrieves information about the item at the specified index by filling out the 'itemInfo' structure passed in. The 'msk' contains one or more HDI_xxxx constants and can be used to specify which information should be copied.

References owl::TWindow::SendMessage().

bool owl::TColumnHeader::GetItemRect ( TRect rect,
int  index 
) const [inline]

Version 4.70 functionality.

Retrieves the bounding rectangle for a given item in a header control. Returns nonzero if successful, or zero otherwise.

References owl::TWindow::SendMessage().

bool owl::TColumnHeader::GetOrderArray ( int  size,
int *  array 
) const [inline]

Version 4.70 functionality.

Retrieves the current left-to-right order of items in a header control. Returns nonzero if successful, and the buffer at lpiArray receives the item number for each item in the header control in the order in which they appear from left to right. Otherwise, the message returns zero.

Parameters:
sizeNumber of integer elements that array can hold. This value must be equal to the number of items in the control (see GetCount().
arrayAddress of an array of integers that receive the index values for items in the header. The number of elements in this array is specified in size and must be equal to or greater than the number of items in the control. For example, the following code fragment will reserve enough memory to hold the index values.
 int    items;
 int *array;
 
 // Get memory for buffer.
 items = GetCount();
 if(!(array = calloc(items,sizeof(int))))
    MessageBox("Out of memory.","Error", MB_OK);

References owl::TWindow::SendMessage().

int owl::TColumnHeader::HitTest ( THeaderHitTestInfo ht)

Tests a point to determine which header item, if any, is at the specified point. Returns the index of the item at the specified position, if any, or – 1 otherwise. ht contains the position to test and receives information about the results of the test.

Note:
The coordinates are specified via the 'pt' member of the THeaderHitTestInfo parameter.

References owl::TWindow::SendMessage().

int owl::TColumnHeader::Insert ( const THdrItem item,
int  index 
)

Inserts a new item after the specified location, 'index', in the column Header control. The new item is inserted at the end of the header control if index is greater than or equal to the number of items in the control. If index is zero, the new item is inserted at the beginning of the header control. The following illustrates a typical use of the 'Insert' method:

 THdrItem hdrItem(GetModule().LoadBitmap(IDB_COMPANYLOGO));
 hdr.Insert(hdrItem, 0);

If the operation succeeds, the return value is the index of the new item. If the operation fails, the return value is - 1.

References owl::TWindow::SendMessage().

bool owl::TColumnHeader::Layout ( uint  swpFlags = 0)

This method repositions the columnHeader control within the client area of its parent window by taking advantage of the columnHeader's ability to specify its desired/appropriate position from a specified bounding rectangle. This method assumes that the control will occupy the full width of the client area of its parent.

References owl::TWindow::GetClientRect(), owl::TWindow::GetParentO(), Layout(), and owl::TWindow::SetWindowPos().

bool owl::TColumnHeader::Layout ( TRect boundingRect,
WINDOWPOS &  wp 
)

This method retrieves the size and position of a header control within a given rectangle. It determines the appropriate dimensions of a new header control that is to occupy the given rectangle. Upon entry the 'boundingRect' parameter specifies the rectangle within which the columnHeader must lie. The control then updates the WINDOWPOS structure to contain the desired/appropriate dimensions for the control to occupy within the specified rectangle.

References owl::TWindow::SendMessage().

TResult owl::TColumnHeader::OrderToIndex ( int  order) [inline]

Version 4.70 functionality.

Retrieves an index value for an item based on its order in the header control. Returns int that indicates the item index. If order is invalid (negative or too large), the return equals order.

Parameters:
orderOrder in which the item appears within the header control, from left to right. For example, the index value of the item in the far left column would be 0. The value for the next item to the right would be 1, and so on.

References owl::TWindow::SendMessage().

int owl::TColumnHeader::SetHotDivider ( uint32  value,
bool  flag = true 
) [inline]

Version 4.70 functionality.

Changes the color of a divider between header items to indicate the destination of an external drag-and-drop operation. Returns a value equal to the index of the divider that the control highlighted.

Parameters:
flagValue specifying the type of value represented by dwInputValue. This value can be one of the following:
  • true Indicates that value holds the client coordinates of the pointer.
  • false Indicates that value holds a divider index value.
valueValue held in dwInputValue is interpreted depending on the value of flag. If flag is true, dwInputValue represents the x- and y-coordinates of the pointer. The x-coordinate is in the low word, and the y-coordinate is in the high word. When the header control receives the message, it highlights the appropriate divider based on the dwInputValue coordinates. If flag is false, dwInputValue represents the integer index of the divider to be highlighted.

This message creates an effect that a header control automatically produces when it has the HDS_DRAGDROP style. This function is intended to be used when the owner of the control handles drag-and-drop operations manually.

References owl::TWindow::SendMessage().

HIMAGELIST owl::TColumnHeader::SetImageList ( HIMAGELIST  iml) [inline]

Version 4.70 functionality.

Assigns an image list to an existing header control. Returns the handle to the image list previously associated with the control. Returns NULL upon failure or if no image list was set previously.

References owl::TWindow::SendMessage().

bool owl::TColumnHeader::SetItem ( const THdrItem itemInfo,
int  index 
)

Updates the attribute(s) a the item at the specified 'index'. The 'itemInfo' structure contains the new attributes of the item.

References owl::TWindow::SendMessage().

bool owl::TColumnHeader::SetOrderArray ( int  size,
int *  array 
) [inline]

Version 4.70 functionality.

Sets the left-to-right order of header items. Returns nonzero if successful, or zero otherwise.

Parameters:
sizeSize of the buffer at lpiArray, in elements. This value must equal the value returned by GetItemCount().
arrayAddress of an array that specifies the order in which items should be displayed, from left to right. For example, if the contents of the array are { 2,0,1}, the control displays item 2, item 0, and item 1, from left to right.

References owl::TWindow::SendMessage().

uint owl::TColumnHeader::Transfer ( void *  buffer,
TTransferDirection  direction 
) [virtual]

Transfers are not implemented for ColumnHeaders. Simply return 0.

Reimplemented from owl::TWindow.


The documentation for this class was generated from the following files: