DBEDIT Class Reference

Manager for user interface windows associated with databases and tables. More...

#include <mi32/dbedit.h>

List of all members.

Classes

struct  EVENT

Public Types

enum  CREATEFLAGS { CREATEFLAG_None = 0x00, CREATEFLAG_NoEdit = 0x01, CREATEFLAG_AllowEditInTNTatlas = 0x20 }
enum  LABELCOLOR { LABELCOLOR_Normal = 0, LABELCOLOR_Computed, LABELCOLOR_PK, LABELCOLOR_FK }
enum  VIEWFLAGS {
  VIEWFLAG_None = 0, VIEWFLAG_ViewActive = 0x00000001, VIEWFLAG_ViewSelected = 0x00000002, VIEWFLAG_ViewAll = 0x00000004,
  VIEWFLAG_NoChangeViewMode = 0x00000008, VIEWFLAG_NoSwitchTableView = 0x00000010, VIEWFLAG_NoRecordSelection = 0x00000020, VIEWFLAG_NoAttachmentIndicator = 0x00000040,
  VIEWFLAG_NoRowControls = (VIEWFLAG_NoRecordSelection|VIEWFLAG_NoAttachmentIndicator), VIEWFLAG_NoNewRecord = 0x00000080, VIEWFLAG_NoDropTable = 0x00000100, VIEWFLAG_NoEditDefn = 0x00000200,
  VIEWFLAG_TabularView = 0x00000400, VIEWFLAG_NoElementSelection = 0x00000800, VIEWFLAG_NoCreateIfNotExist = 0x00001000, VIEWFLAG_SingleRecordView = 0x00002000
}

Public Member Functions

 DBEDIT ()
 ~DBEDIT ()
ERRVALUE CallbackAdd (void(*func)(const DBEDIT_MSG *, void *), void *data, DBEDIT_MSG::REASON reason)
void CallbackRemove (void(*func)(const DBEDIT_MSG *, void *), void *data, DBEDIT_MSG::REASON reason)
void CallCallbacks (DBEDIT_MSG &cbs)
bool CanMakeTableImplied () const
int Close ()
int Create (MDLGPARENT parent, const RVC::OBJITEM &ParentObjItem, ELEMTYPE elemtype, CREATEFLAGS flags=CREATEFLAG_None, const RVC::CREDENTIALS *Credentials=0)
void DBCallbackResume (bool ReallyIgnore, bool Totally=false)
void DBCallbackSuspend (bool ReallyIgnore, bool Totally=false)
int Flush ()
int FormClose (const RVC::OBJITEM &ObjItem)
int FormDrop (MDLGPARENT dlgparent, const RVC::OBJITEM &ObjItem)
int FormNew (MDLGPARENT dlgparent, VIEWFLAGS flags=VIEWFLAG_None, const RVC::CREDENTIALS *Credentials=0)
int FormOpen (const RVC::OBJITEM &ObjItem, VIEWFLAGS flags=VIEWFLAG_None, const RVC::CREDENTIALS *Credentials=0)
ERRVALUE GenViewCreate (MGUI::LAYOUT_PANE_BASE &ParentPane, INT32 TableNum, RVC::UI::FORM_DB_RECORD **ppFormRet=0, DBEDIT::VIEWFLAGS flags=VIEWFLAG_None)
INT32 GetActiveElement () const
INT32 GetBaseTableNum () const
CREATEFLAGS GetCreateFlags () const
const RVC::CREDENTIALSGetCredentials () const
RVC::DBASE_ELEMENTGetDBase () const
RVC::DBASE::OBSERVERGetDBRelateHandle () const
MISTRING GetDisplayPath () const
MDLGPARENT GetDlgParent () const
const LONGLISTGetElemList () const
ELEMTYPE GetElemType () const
void GetLabelColor (LABELCOLOR colornum, COLOR &color)
void GetLabelColorFromFlags (RVC::DBTABLE::FIELDINFO::FLAGS fieldflags, COLOR &color)
int GetNumOpen ()
const RVC::OBJITEMGetObjItem () const
MDLGPARENT GetParent () const
const RVC::OBJITEMGetParentObjItem () const
bool GetStyleObject (RVC::STYLE &StyleObj)
DBEDIT_TDATA * GetTableData (int table) const
DBEDIT_TINSTANCE * GetTableInstanceHandle (INT32 TableNum, VIEWFLAGS flags)
bool HasCallbacks (UINT32 reason) const
bool IsCreated () const
bool IsFormOpen (const RVC::OBJITEM &ObjItemForm)
int IsMainLevel () const
int IsPinMapping () const
int IsTableOpen (int TableNum)
int ModalSingleRecordView (INT32 TableNum, INT32 RecordNum, RVC::DBTABLE::RECORD *InitVal, MDLGPARENT dlgparent, UINT32 flags=0)
int MultiSelectAddElement (INT32 ElemNum)
ERRVALUE MultiSelectEnd (bool UpdateDialogs=true)
int MultiSelectRemoveElement (INT32 ElemNum)
ERRVALUE MultiSelectStart (int BaseTable=0)
void OnEvent (const DBEDIT::EVENT &event, bool bDeferable=true)
ERRVALUE OpenTreeView (UINT32 flags=0)
int RefreshActiveElementAttachments (bool UpdateDialogs=true)
ERRVALUE SetActiveElement (ELEMNUM ElemNum, INT32 BaseTable=0)
void SetBaseTable (int table)
void SetDBRelateHandle (RVC::DBASE::OBSERVER *handle)
ERRVALUE SetElements (INT32 BaseTable, const UNSIGNEDSET &ElemSet, ELEMNUM ActiveElemNum)
void SetParent (MDLGPARENT parent)
int SetStyleNumber (int StyleNum, int RecNum)
int SetStyleObject (const RVC::OBJITEM &StyleObjItem, const RVC::OBJECTNAME &StyleTableName, const void *dftstyle)
int StyleDialogClose ()
int StyleDialogOpen (MDLGPARENT parent)
int TableClose (INT32 TableNum)
int TableCreate (MDLGPARENT parent)
int TableCreate (MDLGPARENT parent, const RVC::DBTABLE::MAKEPARMS &MakeParms, const RVC::DESCRIPTOR *Descriptor=0)
int TableDestroy (int TableNum)
int TableDrop (MDLGPARENT parent, int TableNum)
ERRVALUE TableEditACL (MDLGPARENT parent, int TableNum)
int TableEditDefinition (MDLGPARENT parent, int TableNum)
int TableOpen (INT32 TableNum, VIEWFLAGS flags=VIEWFLAG_None)
int UpdateDialogs ()
int UpdateResume ()
void UpdateSuspend ()

Static Public Member Functions

static RVC::UI::DLG_DB_BASEDlgConstructTabularView (DBEDIT_TINSTANCE *idata)
static void SML_Install (SML::CONTEXT *context)
static ERRVALUE TableCreateDefinition (MDLGPARENT parent, RVC::OBJTYPE DBaseObjType, RVC::DBTABLE::MAKEPARMS &MakeParms, RVC::DESCRIPTOR &Descriptor)

Detailed Description

Manager for user interface windows associated with databases and tables.


Member Enumeration Documentation

Enumerator:
CREATEFLAG_None 
CREATEFLAG_NoEdit 

Disallow any editing.

CREATEFLAG_AllowEditInTNTatlas 

Let user edit data even in TNTatlas (for sketch layers).

Enumerator:
LABELCOLOR_Normal 
LABELCOLOR_Computed 
LABELCOLOR_PK 
LABELCOLOR_FK 

Flags for database table viewer.

Enumerator:
VIEWFLAG_None 
VIEWFLAG_ViewActive 

Default to viewing active.

VIEWFLAG_ViewSelected 

Default to viewing Selected.

VIEWFLAG_ViewAll 

Default to viewing all records.

VIEWFLAG_NoChangeViewMode 

Don't let user change view mode (attached/selected/all).

VIEWFLAG_NoSwitchTableView 

Don't allow user to switch between single-record/tabular view.

VIEWFLAG_NoRecordSelection 

Omit record selection buttons.

VIEWFLAG_NoAttachmentIndicator 

Omit record attachment indicators.

VIEWFLAG_NoRowControls 
VIEWFLAG_NoNewRecord 

Don't allow user to add new record.

VIEWFLAG_NoDropTable 

Don't allow user to "drop" table.

VIEWFLAG_NoEditDefn 

Don't allow user to edit table definition.

VIEWFLAG_TabularView 

Use tabular view.

VIEWFLAG_NoElementSelection 

Leave off element selection button row.

VIEWFLAG_NoCreateIfNotExist 

For MxdDatabaseEditorGetTableInstanceHandle().

VIEWFLAG_SingleRecordView 

Default to single record view.


Constructor & Destructor Documentation

DBEDIT::DBEDIT (  ) 

Constructor.

Use Create() after construction to complete setup.

DBEDIT::~DBEDIT (  ) 

Destructor.


Member Function Documentation

ERRVALUE DBEDIT::CallbackAdd ( void(*)(const DBEDIT_MSG *, void *)  func,
void *  data,
DBEDIT_MSG::REASON  reason 
)

Add a callback.

void DBEDIT::CallbackRemove ( void(*)(const DBEDIT_MSG *, void *)  func,
void *  data,
DBEDIT_MSG::REASON  reason 
)

Remove a callback.

void DBEDIT::CallCallbacks ( DBEDIT_MSG cbs  ) 

Call callbacks.

This should be private. Only used by friend classes.

bool DBEDIT::CanMakeTableImplied (  )  const

Determine if allowed to make implied one-to-one table.

int DBEDIT::Close (  ) 

Close everything, but don't destroy anything.

int DBEDIT::Create ( MDLGPARENT  parent,
const RVC::OBJITEM ParentObjItem,
ELEMTYPE  elemtype,
CREATEFLAGS  flags = CREATEFLAG_None,
const RVC::CREDENTIALS Credentials = 0 
)

Setup database editor manager with associated database.

Parameters:
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
static RVC::UI::DLG_DB_BASE* DBEDIT::DlgConstructTabularView ( DBEDIT_TINSTANCE *  idata  )  [static]
int DBEDIT::Flush (  ) 

Force all unwritten records to be written.

int DBEDIT::FormClose ( const RVC::OBJITEM ObjItem  ) 

Close a form.

int DBEDIT::FormDrop ( MDLGPARENT  dlgparent,
const RVC::OBJITEM ObjItem 
)

Delete a form.

Parameters:
dlgparent Parent for "Are you sure" dialog
int DBEDIT::FormNew ( MDLGPARENT  dlgparent,
VIEWFLAGS  flags = VIEWFLAG_None,
const RVC::CREDENTIALS Credentials = 0 
)

Create a new, blank form.

Parameters:
dlgparent Parent for dialogs
int DBEDIT::FormOpen ( const RVC::OBJITEM ObjItem,
VIEWFLAGS  flags = VIEWFLAG_None,
const RVC::CREDENTIALS Credentials = 0 
)

Open a form.

ERRVALUE DBEDIT::GenViewCreate ( MGUI::LAYOUT_PANE_BASE ParentPane,
INT32  TableNum,
RVC::UI::FORM_DB_RECORD **  ppFormRet = 0,
DBEDIT::VIEWFLAGS  flags = VIEWFLAG_None 
)

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

Parameters:
ParentPane Parent form form
TableNum Table number to create view for
ppFormRet Pointer to form returned
INT32 DBEDIT::GetActiveElement (  )  const [inline]

Get the active element number.

Returns:
ELEMENTNUM_None if none active.
INT32 DBEDIT::GetBaseTableNum (  )  const [inline]
CREATEFLAGS DBEDIT::GetCreateFlags (  )  const [inline]
const RVC::CREDENTIALS* DBEDIT::GetCredentials (  )  const [inline]
RVC::DBASE_ELEMENT* DBEDIT::GetDBase (  )  const [inline]
RVC::DBASE::OBSERVER* DBEDIT::GetDBRelateHandle (  )  const [inline]

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

MISTRING DBEDIT::GetDisplayPath (  )  const

Get display path string for database.

String will be of the form [ObjectName] / [DatabaseName] or [ObjectName].

MDLGPARENT DBEDIT::GetDlgParent (  )  const [inline]

Get parent for dialogs managed by DBEDIT instance.

const LONGLIST& DBEDIT::GetElemList (  )  const [inline]

Get element list.

ELEMTYPE DBEDIT::GetElemType (  )  const [inline]

Get element type for this database.

void DBEDIT::GetLabelColor ( LABELCOLOR  colornum,
COLOR color 
)

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

void DBEDIT::GetLabelColorFromFlags ( RVC::DBTABLE::FIELDINFO::FLAGS  fieldflags,
COLOR color 
)

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

int DBEDIT::GetNumOpen (  ) 

Get the number of tables open.

const RVC::OBJITEM& DBEDIT::GetObjItem (  )  const [inline]

Get the OBJITEM of the actual database.

MDLGPARENT DBEDIT::GetParent (  )  const [inline]

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

const RVC::OBJITEM& DBEDIT::GetParentObjItem (  )  const [inline]

Get the OBJITEM passed to create.

This is usually the OBJITEM of the parent except for main level databases, in which case it's the database's OBJITEM

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.

Parameters:
table Get internal table data
DBEDIT_TINSTANCE* DBEDIT::GetTableInstanceHandle ( INT32  TableNum,
VIEWFLAGS  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::HasCallbacks ( UINT32  reason  )  const [inline]
bool DBEDIT::IsCreated (  )  const [inline]

Determine if Create() has been done yet.

bool DBEDIT::IsFormOpen ( const RVC::OBJITEM ObjItemForm  ) 

Determine if form is open.

int DBEDIT::IsMainLevel (  )  const [inline]

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

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.

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  RecordNum,
RVC::DBTABLE::RECORD InitVal,
MDLGPARENT  dlgparent,
UINT32  flags = 0 
)

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
RecordNum Record to edit (or RECORD_New)
InitVal Initial record values (can be null)
dlgparent Parent to use for dialog
flags Not used
int DBEDIT::MultiSelectAddElement ( INT32  ElemNum  ) 

Add an element to the multi-Select list.

Parameters:
ElemNum Element number or ELEMENTNUM_None
ERRVALUE DBEDIT::MultiSelectEnd ( bool  UpdateDialogs = true  ) 

Finish a multiple element selection.

int DBEDIT::MultiSelectRemoveElement ( INT32  ElemNum  ) 

Remove an element from the multi-Select list.

Parameters:
ElemNum Element to remove from the selected element set
ERRVALUE DBEDIT::MultiSelectStart ( int  BaseTable = 0  ) 

Start adding elements to the element list, clearing previous list.

SetElements() is the prefered method, but isn't well suited to CAD. Call MultiSelectStart, MultiSelectAddElement as many times as you need, then MultiSelectEnd.

Parameters:
BaseTable Only needed if for ELEMTYPE_Record
void DBEDIT::OnEvent ( const DBEDIT::EVENT event,
bool  bDeferable = true 
)
ERRVALUE DBEDIT::OpenTreeView ( UINT32  flags = 0  ) 

Open a tree view showing table relationships.

Currently only defined for X

Parameters:
flags Old MxdFLAG_Flags
int DBEDIT::RefreshActiveElementAttachments ( bool  UpdateDialogs = true  ) 

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).

ERRVALUE DBEDIT::SetActiveElement ( ELEMNUM  ElemNum,
INT32  BaseTable = 0 
) [inline]

Set the "active" element.

Parameters:
ElemNum Element number or ELEMENTNUM_None
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 ( RVC::DBASE::OBSERVER handle  )  [inline]

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

ERRVALUE DBEDIT::SetElements ( INT32  BaseTable,
const UNSIGNEDSET ElemSet,
ELEMNUM  ActiveElemNum 
)

Set the list of selected elements using a bit array.

Parameters:
BaseTable Base table number
ElemSet Selected elements
ActiveElemNum Active element number
void DBEDIT::SetParent ( MDLGPARENT  parent  )  [inline]

Set widget to use as parent for all dialogs.

Parameters:
parent Widget to use as a parent
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
static void DBEDIT::SML_Install ( SML::CONTEXT context  )  [static]

Install SML interface.

int DBEDIT::StyleDialogClose (  ) 

Close the style dialog.

Actually does nothing.

int DBEDIT::StyleDialogOpen ( MDLGPARENT  parent  ) 

Open the style editor dialog.

Parameters:
parent Parent 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  ) 

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

Parameters:
parent Parent for dialogs
int DBEDIT::TableCreate ( MDLGPARENT  parent,
const RVC::DBTABLE::MAKEPARMS MakeParms,
const RVC::DESCRIPTOR Descriptor = 0 
)

Popup a table creation dialog.

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

The MakeParms will be used for defaults.

Parameters:
parent Parent for dialogs
MakeParms Defaults for new table
Descriptor Initial descriptor (can be 0 if no default name)
static ERRVALUE DBEDIT::TableCreateDefinition ( MDLGPARENT  parent,
RVC::OBJTYPE  DBaseObjType,
RVC::DBTABLE::MAKEPARMS MakeParms,
RVC::DESCRIPTOR Descriptor 
) [static]

Popup a table creation dialog.

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

Parameters:
MakeParms Filled in MakeParms, RETURNED
Descriptor Filled in Descriptor, RETURNED
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
ERRVALUE DBEDIT::TableEditACL ( MDLGPARENT  parent,
int  TableNum 
)

popup a dialog to allow the user to edit the table's Access Control List

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,
VIEWFLAGS  flags = VIEWFLAG_None 
)

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

Parameters:
TableNum Table number to open
flags flags
int DBEDIT::UpdateDialogs (  ) 

Force all open table windows to update.

int DBEDIT::UpdateResume (  ) 

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.

void DBEDIT::UpdateSuspend (  ) 

Just calls DBCallbackSuspend().


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

Generated on Sun Oct 7 21:33:18 2012 for TNTsdk 2012 by  doxygen 1.6.1