ControlTable Class Reference

Stores/manipulates an array of ControlEntry objects, in order to keep track of all the controls we have currently subclassed. More...

#include <ctrlhelp.h>

Inheritance diagram for ControlTable:

SimpleCCObject List of all members.

Public Member Functions

 ControlTable ()
 Construct the control table object.
 ~ControlTable ()
 Destroy a ControlTable object - frees up all memory used by the table data.
BOOL Init ()
 Allocate and initialise the table of control entries.
ControlEntryFindControl (wxWindow *Window)
 Given a control's window handle, return the information currently registered for that control. Do not free the data pointed to by the return value.
BOOL ChangeControl (wxWindow *, ControlHelpInfo *)

Private Types

enum  { NotFound = -1, EmptySlot = 0, Granularity = 30, InitialSize = 100 }

Private Member Functions

INT32 FindControlIndex (wxWindow *Window, BOOL IgnoreChildren=TRUE)
 Given the window handle of a control, return the offset into the table array of its record, or optionally of the control's child windows.

Private Attributes

ControlEntryTable
INT32 TableSize
wxWindow * LastWindow
INT32 LastIndex

Detailed Description

Stores/manipulates an array of ControlEntry objects, in order to keep track of all the controls we have currently subclassed.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/04/94
See also:
ControlEntry; ControlHelper

Definition at line 354 of file ctrlhelp.h.


Member Enumeration Documentation

anonymous enum [private]
 

Enumerator:
NotFound 
EmptySlot 
Granularity 
InitialSize 

Definition at line 372 of file ctrlhelp.h.

00373     {
00374         NotFound = -1,
00375         EmptySlot = 0,
00376         Granularity = 30,
00377         InitialSize = 100
00378     };


Constructor & Destructor Documentation

ControlTable::ControlTable  ) 
 

Construct the control table object.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/04/94
See also:
ControlTable::Init

Definition at line 477 of file ctrlhelp.cpp.

00478 {
00479     // No table data yet.
00480     Table = NULL;
00481     TableSize = 0;
00482 
00483     // Initial state
00484     LastWindow = NULL;
00485     LastIndex = 0;
00486 }

ControlTable::~ControlTable  ) 
 

Destroy a ControlTable object - frees up all memory used by the table data.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/04/94
See also:
ControlTable::Init

Definition at line 499 of file ctrlhelp.cpp.

00500 {
00501     // Free up the table data.
00502     CCFree(Table);
00503 }


Member Function Documentation

BOOL ControlTable::ChangeControl wxWindow *  ,
ControlHelpInfo
 

Definition at line 673 of file ctrlhelp.cpp.

00674 {
00675     INT32 i = FindControlIndex(Window);
00676 
00677     if (i == ControlTable::NotFound)
00678         return FALSE;
00679 
00680     Table[i].BubbleID = pInfo->BubbleID;
00681     Table[i].StatusID = pInfo->StatusID;
00682     Table[i].ModuleID = pInfo->ModuleID;  
00683 
00684     // Everything worked
00685     return TRUE;
00686 }

ControlEntry * ControlTable::FindControl wxWindow *  Window  ) 
 

Given a control's window handle, return the information currently registered for that control. Do not free the data pointed to by the return value.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/04/94
Parameters:
Window - the handle of the control to look for. [INPUTS]
Returns:
Pointer to the data currently registered for the control in question, or NULL if the control could not be found.
See also:
ControlEntry

Definition at line 703 of file ctrlhelp.cpp.

00704 {
00705     INT32 i=FindControlIndex(Window);
00706 
00707     if (i==ControlTable::NotFound)
00708         return NULL;
00709 
00710     return Table + i;
00711 }

INT32 ControlTable::FindControlIndex wxWindow *  Window,
BOOL  IgnoreChildren = TRUE
[private]
 

Given the window handle of a control, return the offset into the table array of its record, or optionally of the control's child windows.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/04/94
Parameters:
Window - the handle of the control to search for. [INPUTS] IgnoreChildren - if TRUE, then only return the entry for the control itself; if FALSE then return entries for the control or any children of it.
Returns:
The index into the Table array of the control's record, or ControlTable::NotFound if the control is not registered in the table.

Errors: Not found.

See also:
ControlTable::FindControl; ControlTable::DeleteControl

Definition at line 733 of file ctrlhelp.cpp.

00734 {
00735     // Scan the table for this entry...
00736     INT32 i;
00737 
00738     // Is this the same as the last window handle we looked for?
00739     // If so, start from the last slot we looked at.
00740     if (LastWindow == Window)
00741         i = LastIndex;
00742     else 
00743         i = 0;
00744 
00745     while ((i < TableSize) && (Table[i].Window != Window) &&
00746            (IgnoreChildren || (Table[i].Parent != Window)))
00747         i++;
00748 
00749     // Did we find it?
00750     if (i >= TableSize)
00751         // No - inform caller of failure.
00752         return ControlTable::NotFound;
00753 
00754     // Yes, success
00755     LastIndex = i;
00756     LastWindow = Window;
00757 
00758     return i;
00759 }

BOOL ControlTable::Init void   ) 
 

Allocate and initialise the table of control entries.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/04/94
Returns:
TRUE if successful; FALSE if not.

Errors: Out of memory.

See also:
ControlTable

Reimplemented from SimpleCCObject.

Definition at line 519 of file ctrlhelp.cpp.

00520 {
00521     // Try to get some space for our table.
00522     Table = (ControlEntry *) CCMalloc(ControlTable::InitialSize * sizeof(ControlEntry));
00523     if (Table == NULL)
00524         return FALSE;
00525 
00526     // Initialise the table
00527     for (INT32 i = 0; i < ControlTable::InitialSize; i++)
00528     {
00529         // No control registered in this entry yet
00530         Table[i].Window = EMPTY_SLOT;
00531     }
00532 
00533     // Update the table size
00534     TableSize = ControlTable::InitialSize;
00535 
00536     // Success!
00537     return TRUE;
00538 }


Member Data Documentation

INT32 ControlTable::LastIndex [private]
 

Definition at line 385 of file ctrlhelp.h.

wxWindow* ControlTable::LastWindow [private]
 

Definition at line 384 of file ctrlhelp.h.

ControlEntry* ControlTable::Table [private]
 

Definition at line 380 of file ctrlhelp.h.

INT32 ControlTable::TableSize [private]
 

Definition at line 381 of file ctrlhelp.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 03:53:09 2007 for Camelot by  doxygen 1.4.4