DBEDIT Class Reference

#include <mi32/dbedit.h>

List of all members.

Public Types

enum  LABELCOLOR { LABELCOLOR_Normal = 0, LABELCOLOR_Computed, LABELCOLOR_PK, LABELCOLOR_FK }
enum  MODE {
  MODE_SingleRecord = 0, MODE_Form, MODE_TabularView, MODE_GenView,
  MODE_ModalSingleRecord, MODE_NumModes
}

Public Member Functions

int CallbackAdd (void(*func)(MxdDatabaseEditorCallbackStruct *, void *), void *data, UINT32 reason)
void CallbackRemove (void(*func)(MxdDatabaseEditorCallbackStruct *, void *), void *data, UINT32 reason)
void CallCallbacks (MxdDatabaseEditorCallbackStruct *cbs, UINT32 reason)
int Close ()
int Create (MDLGPARENT parent, const UNICODE *fname, INT32 pinode, ELEMTYPE elemtype, UINT32 flags=0)
void DBCallbackResume (bool ReallyIgnore, bool Totally=false)
void DBCallbackSuspend (bool ReallyIgnore, bool Totally=false)
 DBEDIT ()
int FindRecords (int active)
int Flush ()
int FormClose (INT32 inode)
int FormDrop (MDLGPARENT parent, INT32 inode)
int FormNew (MDLGPARENT parent, INT32 *pinode, UINT32 flags)
int FormOpen (INT32 inode, UINT32 flags)
int GenViewCreate (DBEDIT_TINSTANCE **pinstance, INT32 TableNum, MGUI::LAYOUT_PANE_BASE &ParentPane, UINT32 flags)
int GenViewCreate (DBEDIT_TINSTANCE **pinstance, INT32 TableNum, MDLGPARENT parent, MDLGPARENT *pwidget, Arg *uarg, int numuargs, UINT32 flags)
int GetActiveElement () const
int GetDatabaseHandle () const
void * GetDBRelateHandle () const
ELEMTYPE GetElemType () const
int GetFileHandle () const
RVCINODENUM GetInode () const
void GetLabelColor (LABELCOLOR colornum, COLOR &color)
UINT32 GetLabelColor (LABELCOLOR color)
void GetLabelColorFromFlags (UINT32 flags, COLOR &color)
UINT32 GetLabelColorFromFlags (UINT32 flags)
int GetNumOpen ()
int GetNumTables () const
int GetObjType () const
MDLGPARENT GetParent () const
bool GetStyleObject (RVC::STYLE &StyleObj)
DBEDIT_TDATA * GetTableData (int table) const
DBEDIT_TINSTANCE * GetTableInstanceHandle (INT32 TableNum, UINT32 flags)
bool IsCreated () const
int IsMainLevel () const
int IsPinMapping () const
int IsTableOpen (int TableNum)
int ModalSingleRecordView (INT32 TableNum, INT32 Record, void *initvals, MDLGPARENT parent, UINT32 flags)
int MultiSelectAddElement (INT32 element)
int MultiSelectAddElementOld (INT32 element, ELEMTYPE elemtype)
int MultiSelectEnd (UINT32 flags)
int MultiSelectRemoveElement (INT32 element)
int MultiSelectStart (UINT32 flags, ELEMTYPE ElemType, int BaseTable=0)
int RefreshActiveElementAttachments (UINT32 flags)
int RefreshAttachments (UINT32 flags)
int SetActiveElement (INT32 element, ELEMTYPE elemtype, UINT32 flags, INT32 BaseTable=0)
void SetBaseTable (int table)
void SetDBRelateHandle (void *handle)
int SetElements (ELEMTYPE ElemType, INT32 BaseTable, UINT8 *Bits, INT32 NumElements, INT32 ActiveElement, UINT32 flags)
void SetParent (MDLGPARENT parent)
int SetRecord (int table, INT32 record)
int SetStyleNumber (int StyleNum, int RecNum)
int SetStyleObject (const RVC::OBJITEM &StyleObjItem, const RVC::OBJECTNAME &StyleTableName, const void *dftstyle)
int SetStyleObject (const UNICODE *fname, INT32 inode, int table, const void *dftstyle)
int StyleDialogClose ()
int StyleDialogOpen (MDLGPARENT parent)
int TableClose (INT32 TableNum)
int TableCreate (MDLGPARENT parent)
int TableCreate (MDLGPARENT parent, RVCTABLEINFO *info, DBFIELDINFO *finfo=0)
int TableDestroy (int TableNum)
int TableDrop (MDLGPARENT parent, int TableNum)
int TableEditDefinition (MDLGPARENT parent, int TableNum)
int TableOpen (INT32 TableNum, UINT32 flags)
int UpdateDialogs ()
int UpdateResume (UINT32 flags)
void UpdateSuspend ()
 ~DBEDIT ()


Member Enumeration Documentation

enum DBEDIT::LABELCOLOR
 

This should go in DBEDIT.

Enumeration values:
LABELCOLOR_Normal 
LABELCOLOR_Computed 
LABELCOLOR_PK 
LABELCOLOR_FK 

Definition at line 195 of file dbedit.h.

enum DBEDIT::MODE
 

Enums.

Enumeration values:
MODE_SingleRecord 
MODE_Form 
MODE_TabularView 
MODE_GenView 
MODE_ModalSingleRecord 
MODE_NumModes 

Definition at line 183 of file dbedit.h.


Constructor & Destructor Documentation

DBEDIT::DBEDIT  ) 
 

Constructor.

Note: Since a constructor can't return an error, it only initialized the class to blank settings. You should call the Create method to actually set the thing up.

DBEDIT::~DBEDIT  ) 
 


Member Function Documentation

int DBEDIT::CallbackAdd void(*  func)(MxdDatabaseEditorCallbackStruct *, void *),
void *  data,
UINT32  reason
 

Add a callback.

void DBEDIT::CallbackRemove void(*  func)(MxdDatabaseEditorCallbackStruct *, void *),
void *  data,
UINT32  reason
 

Remove a callback.

void DBEDIT::CallCallbacks MxdDatabaseEditorCallbackStruct cbs,
UINT32  reason
 

Call callbacks.

This should be private. Only used by friend classes.

int DBEDIT::Close  ) 
 

Close everything, but don't destroy anything.

int DBEDIT::Create MDLGPARENT  parent,
const UNICODE fname,
INT32  pinode,
ELEMTYPE  elemtype,
UINT32  flags = 0
 

Create.

You should call this after constructing the DBEDIT and check for an error. This is because a constructor can't return an error.

Parameters:
pinode  Inode of database object's parent (vector, raster, whatever)
elemtype  Element type of the database to open (ELEMTYPE_Record if pinode is of an OTYPE_DBASE)

void DBEDIT::DBCallbackResume bool  ReallyIgnore,
bool  Totally = false
 

Resume database callback handling.

If any callbacks happened while suspended (and we're not still suspended) they will be processed.

Parameters:
Totally  If true, throw out everything - Use with caution

void DBEDIT::DBCallbackSuspend bool  ReallyIgnore,
bool  Totally = false
 

Suspend database callbacks.

Unless ReallyIgnore is set, callbacks which happen while suspended will be queued and processed when resumed. Suspend/Resumes are refcounted.

Parameters:
Totally  If true, throw out everything - Use with caution

int DBEDIT::FindRecords int  active  ) 
 

Find records.

Shouldn't this be private? Should only be called by friend classes.

int DBEDIT::Flush  ) 
 

Force all unwritten records to be written.

int DBEDIT::FormClose INT32  inode  ) 
 

Close a form.

Parameters:
inode  Inode of form to close

int DBEDIT::FormDrop MDLGPARENT  parent,
INT32  inode
 

Deleta a form.

Parameters:
parent  Parent widget for "Are you sure" dialog
inode  Inode of form do delete

int DBEDIT::FormNew MDLGPARENT  parent,
INT32 pinode,
UINT32  flags
 

Create a new, blank form.

Parameters:
parent  Parent widget for dialogs
pinode  Returned inode of the form created

int DBEDIT::FormOpen INT32  inode,
UINT32  flags
 

Open a form.

Parameters:
inode  Inode of form to open
flags  flags XXX

int DBEDIT::GenViewCreate DBEDIT_TINSTANCE **  pinstance,
INT32  TableNum,
MGUI::LAYOUT_PANE_BASE ParentPane,
UINT32  flags
 

Create a generic single record view form for a given table.

This form doesn't do anything automatically. This is the MFC version of this function.

Parameters:
pinstance  instance returned
TableNum  Table number to create view for

int DBEDIT::GenViewCreate DBEDIT_TINSTANCE **  pinstance,
INT32  TableNum,
MDLGPARENT  parent,
MDLGPARENT pwidget,
Arg *  uarg,
int  numuargs,
UINT32  flags
 

Create a generic single record view form for a given table.

This form doesn't do anything automatically. This is the X version of this function.

Parameters:
pinstance  instance returned
TableNum  Table number to create view for
parent  Parent widget to create view in
pwidget  XmForm returned
uarg  Arguments to use when creating form

int DBEDIT::GetActiveElement  )  const [inline]
 

Get the active element number.

Returns MxdDATABASE_NoElement if none active.

Definition at line 328 of file dbedit.h.

int DBEDIT::GetDatabaseHandle  )  const [inline]
 

Get the RVC object handle for this database.

Definition at line 334 of file dbedit.h.

void* DBEDIT::GetDBRelateHandle  )  const [inline]
 

Used by database relationships dialog to make sure there's only one instance of itself.

Definition at line 346 of file dbedit.h.

ELEMTYPE DBEDIT::GetElemType  )  const [inline]
 

Get the ELEMTYPE_ for this database.

Definition at line 351 of file dbedit.h.

int DBEDIT::GetFileHandle  )  const [inline]
 

Get the RVC file handle for this database.

Definition at line 340 of file dbedit.h.

RVCINODENUM DBEDIT::GetInode  )  const [inline]
 

Get the inode of the database.

Definition at line 357 of file dbedit.h.

void DBEDIT::GetLabelColor LABELCOLOR  colornum,
COLOR color
 

Get the color to use for a label given a DBEDIT::LABELCOLOR.

UINT32 DBEDIT::GetLabelColor LABELCOLOR  color  ) 
 

Get the color to use for a label given a DBEDIT::LABELCOLOR.

void DBEDIT::GetLabelColorFromFlags UINT32  flags,
COLOR color
 

Get the color to use for a label from the DBFIELDINFO.flags.

UINT32 DBEDIT::GetLabelColorFromFlags UINT32  flags  ) 
 

Get the color to use for a label from the DBFIELDINFO.flags XXX.

These should return a COLORREF, but I don't know where that's defined. I don't think I really want this to include it anyway.

Parameters:
flags  From DBFIELDINFO.flags

int DBEDIT::GetNumOpen  ) 
 

Get the number of tables open.

int DBEDIT::GetNumTables  )  const [inline]
 

Get the number of tables in the database.

Definition at line 404 of file dbedit.h.

int DBEDIT::GetObjType  )  const [inline]
 

Get the OTYPE of the database object.

Definition at line 410 of file dbedit.h.

MDLGPARENT DBEDIT::GetParent  )  const [inline]
 

Get the widget used as a parent for any dialogs we create.

Definition at line 416 of file dbedit.h.

bool DBEDIT::GetStyleObject RVC::STYLE StyleObj  ) 
 

Open the style object associated with a database.

This is for use by DBEDIT_TDATA only (?).

DBEDIT_TDATA* DBEDIT::GetTableData int  table  )  const [inline]
 

Get the DBEDIT_TDATA for a given table.

Should this be private?

< To account for table -1

Parameters:
table  Get internal table data

Definition at line 424 of file dbedit.h.

DBEDIT_TINSTANCE* DBEDIT::GetTableInstanceHandle INT32  TableNum,
UINT32  flags
 

Returns the instance handle for a given table and open mode.

Will create one unless passed the flag DBVIEW_NoCreateIfNotExist.

Parameters:
TableNum  Table number to look for
flags  DBVIEW_TabularView or 0

bool DBEDIT::IsCreated  )  const [inline]
 

Determine if Create() has been done yet.

Definition at line 441 of file dbedit.h.

int DBEDIT::IsMainLevel  )  const [inline]
 

Returns true if this database is not under a vector or anything.

Definition at line 447 of file dbedit.h.

int DBEDIT::IsPinMapping  )  const [inline]
 

Returns true if the database is being used for pin-mapping.

i.e., we've called SetRecord or SetElement with an ELEMTYPE of ELEMTYPE_Record.

Definition at line 456 of file dbedit.h.

int DBEDIT::IsTableOpen int  TableNum  ) 
 

Returns 1 if the requested table is open in some way.

Parameters:
TableNum  Table to check for

int DBEDIT::ModalSingleRecordView INT32  TableNum,
INT32  Record,
void *  initvals,
MDLGPARENT  parent,
UINT32  flags
 

Open a table in single record view as a modal dialog.

Returns:
Record number or error (May be EUserCancel).
Parameters:
TableNum  Table number to open
Record  Record to edit (or RECORD_New)
initvals  Buffer to initialize as (only for record==RECORD_New)
parent  Parent widget to use for dialog
flags  MxdDATABASE_AutoSave if you don't want a "Do you wish to save changes" question on OK

int DBEDIT::MultiSelectAddElement INT32  element  ) 
 

Add an element to the multi-Select list.

Parameters:
element  Element number or MxdDATABASE_NoElement

int DBEDIT::MultiSelectAddElementOld INT32  element,
ELEMTYPE  elemtype
 

Add an element to the multi-Select list.

Don't use this version. It's only here for backwards compatibility. It's used by the wrapper function MxdDatabaseEditorSetElement().

Parameters:
element  Element number or MxdDATABASE_NoElement
elemtype  Why did we pass this for every element?

int DBEDIT::MultiSelectEnd UINT32  flags  ) 
 

Finish a multiple element selection.

Parameters:
flags  Could pass MxdDATABASE_DontUpdateDialogs

int DBEDIT::MultiSelectRemoveElement INT32  element  ) 
 

Remove an element from the multi-Select list.

Parameters:
element  Element to remove from the selected element set

int DBEDIT::MultiSelectStart UINT32  flags,
ELEMTYPE  ElemType,
int  BaseTable = 0
 

Start adding elements to the element list.

SetElements() is the prefered method, but isn't well suited to CAD. Call MultiSelectStart, MultiSelectAddElement as many times as you need, then MultiSelectEnd. If you want to clear the list first, pass MxdDATABASE_Clear.

Parameters:
flags  MxdDATABASE_Clear
ElemType  ELEMTYPE_Xxxx
BaseTable  Only needed if for ELEMTYPE_Record

int DBEDIT::RefreshActiveElementAttachments UINT32  flags  ) 
 

Notify the database editor that attachments to active element may have changed.

(Should be unnecessary now that we have database callbacks to deal with all this, but you can totally suspend the callbacks).

Parameters:
flags  Can be MxdDATABASE_DontUpdateDialogs

int DBEDIT::RefreshAttachments UINT32  flags  ) 
 

Notify the database editor that attachments may have changed.

(Should be unnecessary now that we have database callbacks to deal with all this, but you can totally suspend the callbacks).

Parameters:
flags  Can be MxdDATABASE_DontUpdateDialogs

int DBEDIT::SetActiveElement INT32  element,
ELEMTYPE  elemtype,
UINT32  flags,
INT32  BaseTable = 0
 

Set the "active" element.

Parameters:
element  Element number of MxdDATABASE_NoElement
elemtype  ELEMTYPE_Xxxx
flags  Can be MxdDATABASE_DontUpdateDialogs
BaseTable  Table to use if this is ELEMTYPE_RECORD

void DBEDIT::SetBaseTable int  table  ) 
 

Set the base table number for PinMapping.

Parameters:
table  Table number to use

void DBEDIT::SetDBRelateHandle void *  handle  )  [inline]
 

Used by database relationships dialog to make sure there's only one instance of itself.

Definition at line 554 of file dbedit.h.

int DBEDIT::SetElements ELEMTYPE  ElemType,
INT32  BaseTable,
UINT8 Bits,
INT32  NumElements,
INT32  ActiveElement,
UINT32  flags
 

Set the list of selected elements using a bit array.

Parameters:
ElemType  ELEMTYPE_Xxxx
BaseTable  Base table number
Bits  Bit array with selected elements set
NumElements  Number of bits in array
ActiveElement  Active element number
flags  could pass MxdDATABASE_DontUpdateDialogs, but why?

void DBEDIT::SetParent MDLGPARENT  parent  )  [inline]
 

Set widget to use as parent for all dialogs.

Parameters:
parent  Widget to use as a parent

Definition at line 571 of file dbedit.h.

int DBEDIT::SetRecord int  table,
INT32  record
 

Set the current record.

This just Calls SetActiveElement.

Parameters:
table  Base table number
record  Current record number

int DBEDIT::SetStyleNumber int  StyleNum,
int  RecNum
 

Set the style number to edit in the style editor dialog.

Also remembers internally which record this was for. Returns without doing anything if style editor isn't open.

Parameters:
StyleNum  Style number to edit
RecNum  Record number in Style Assignment Table

int DBEDIT::SetStyleObject const RVC::OBJITEM StyleObjItem,
const RVC::OBJECTNAME StyleTableName,
const void *  dftstyle
 

Set the style object to use for style samples.

Parameters:
StyleObjItem  Style object to use
StyleTableName  Name of style table
dftstyle  Default style appropriate to the database type

int DBEDIT::SetStyleObject const UNICODE fname,
INT32  inode,
int  table,
const void *  dftstyle
 

Set the style object to use for style samples.

Parameters:
fname  Filename of style object
inode  inode of style object
table  Style Assignment Table number
dftstyle  Default style appropriate to the database type

int DBEDIT::StyleDialogClose  ) 
 

Close the style dialog.

Actually does nothing.

int DBEDIT::StyleDialogOpen MDLGPARENT  parent  ) 
 

Open the style editor dialog.

Parameters:
parent  Parent widget for the dialog

int DBEDIT::TableClose INT32  TableNum  ) 
 

Close all instances of a given table.

Parameters:
TableNum  Table number to close (all instances)

int DBEDIT::TableCreate MDLGPARENT  parent  ) 
 

Popup a table creation wizard.

This uses a wizard to walk the user through the first few steps of creating a table.

Parameters:
parent  Parent widget for dialogs

int DBEDIT::TableCreate MDLGPARENT  parent,
RVCTABLEINFO info,
DBFIELDINFO finfo = 0
 

Popup a table creation dialog.

This pops up the "New Table" dialog to let the user design a new table.

If the optional tableinfo is supplied, it will be used for defaults and the the new table's info will be returned in it.

Parameters:
parent  Parent widget for dialogs
info  Defaults for new table (optional)
finfo  Initial field info (optional)

int DBEDIT::TableDestroy int  TableNum  ) 
 

Destroy table instance (just the dialog, not the underlying table).

Parameters:
TableNum  Table number to destroy

int DBEDIT::TableDrop MDLGPARENT  parent,
int  TableNum
 

Drop (delete) a table.

Parameters:
parent  Parent for "Are you sure" dialog
TableNum  Table number to drop

int DBEDIT::TableEditDefinition MDLGPARENT  parent,
int  TableNum
 

popup a dialog to allow the user to edit the table's definition.

Parameters:
parent  Parent for "Are you sure" dialog
TableNum  Table number to drop

int DBEDIT::TableOpen INT32  TableNum,
UINT32  flags
 

Open a table window in DBVIEW_TabularView mode or (default) Single Record View.

Parameters:
TableNum  Table number to open
flags  DBVIEW_flags (in xdefns.h)

int DBEDIT::UpdateDialogs  ) 
 

Force all open table windows to update.

int DBEDIT::UpdateResume UINT32  flags  ) 
 

Similar to DBCallbackResume, but if resuming (it's refcounted so may these can be nested), this will check to see if we think we need to update everything and do so.

In a perfect world, this should never be the case. CallbackResume will handle it all for us.

Parameters:
flags  could pass MxdDATABASE_DontUpdateDialogs, but why?

void DBEDIT::UpdateSuspend  ) 
 

Just calls DBCallbackSuspend().


The documentation for this class was generated from the following file:
Generated on Tue Dec 14 13:19:41 2004 for TNTsdk by  doxygen 1.3.8-20040913