home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1997 January
/
Chip_1997-01_cd.bin
/
ms95
/
disk22
/
dir02
/
f015540.re_
/
f015540.re
Wrap
Text File
|
1996-04-02
|
9KB
|
219 lines
/*----------------------------------------------------------------------+
| |
| Copyright (1995) Bentley Systems, Inc., All rights reserved. |
| |
| "MicroStation" is a registered trademark and "MDL" and "MicroCSL" |
| are trademarks of Bentley Systems, Inc. |
| |
| Limited permission is hereby granted to reproduce and modify this |
| copyrighted material provided that the resulting code is used only |
| in conjunction with Bentley Systems products under the terms of the |
| license agreement provided therein, and that this notice is retained |
| in its entirety in any such reproduction or modification. |
| |
+----------------------------------------------------------------------*/
/*----------------------------------------------------------------------+
| |
| $Logfile: J:/mdl/examples/listbox/listbox.mcv $
| $Workfile: listbox.mc $
| $Revision: 1.2 $
| $Date: 26 Jul 1995 07:04:16 $
| |
+----------------------------------------------------------------------*/
/*----------------------------------------------------------------------+
| |
| Function - |
| |
| MDL example to show new items |
| |
| main - Main entry point |
| |
+----------------------------------------------------------------------*/
/*----------------------------------------------------------------------+
| |
| Include Files |
| |
+----------------------------------------------------------------------*/
#include <mdl.h> /* MDL Library funcs structures & constants */
#include <dlogitem.h> /* Dialog Box Manager structures & constants */
#include <userfnc.h>
#include <dlogids.h>
#include <dlogman.fdf> /* dialog box manager function prototypes */
#include <msrsrc.fdf>
#include <msparse.fdf>
#include <mssystem.fdf>
#include <mscexpr.fdf>
#include "listbox.h" /* dialog box example constants & structs */
#include "listbcmd.h" /* dialog box command numbers */
#include "listicon.fdf" /* dialog hook function definitions */
#include "listsash.fdf" /* dialog hook function definitions */
#include "listmult.fdf" /* dialog hook function definitions */
#include "listcolr.fdf" /* dialog hook function definitions */
/*----------------------------------------------------------------------+
| |
| Local defines |
| |
+----------------------------------------------------------------------*/
/*----------------------------------------------------------------------+
| |
| Private Global variables |
| |
+----------------------------------------------------------------------*/
static DItem_PulldownMenuItem gAppMenuItem;
Public ListBoxGlobals listboxGlobs;
/*----------------------------------------------------------------------+
| |
| Asynchronous Functions |
| |
+----------------------------------------------------------------------*/
/*----------------------------------------------------------------------+
| |
| name listbox_unloadFunction |
| |
| author BSI 05/95 |
| |
+----------------------------------------------------------------------*/
Private int listbox_unloadFunction
(
int unloadType
)
{
/* no need to clean up menus if shutting down */
if (SYSTEM_TERMINATED_SHUTDOWN == unloadType)
return (0);
mdlDialog_menuBarDeleteCmdWinMenu (&gAppMenuItem);
return (0);
}
/*----------------------------------------------------------------------+
| |
| Utility routines |
| |
+----------------------------------------------------------------------*/
/*----------------------------------------------------------------------+
| |
| name listbox_errorPrint -- print an error message into |
| Dialog Box Manager Messages dialog box |
| |
| author BSI 05/95 |
| |
+----------------------------------------------------------------------*/
Public void listbox_errorPrint
(
int errorNumber /* => number of error to print */
)
{
char errorMsg[80];
if (SUCCESS != mdlResource_loadFromStringList (errorMsg, NULL,
MESSAGELISTID_ListBox, errorNumber))
{
/* unable to find message with number "errorNumber" */
return;
}
mdlDialog_dmsgsPrint (errorMsg);
}
/*----------------------------------------------------------------------+
| |
| Command Handling routines |
| |
+----------------------------------------------------------------------*/
/*----------------------------------------------------------------------+
| |
| name listbox_openDialogBox |
| |
| author BSI 05/95 |
| |
+----------------------------------------------------------------------*/
Private void listbox_openDialogBox
(
char *unparsedP /* => unparsed part of command */
)
cmdNumber CMD_LISTBOX_OPEN_LISTICON,
CMD_LISTBOX_OPEN_SASH,
CMD_LISTBOX_OPEN_COLORS,
CMD_LISTBOX_OPEN_MULTILIST
{
long dialogId;
DialogBox *dbP; /* a ptr to a dialog box */
/* Find the dialog id from the command number */
dialogId = (mdlCommandNumber & 0xFF00) >> 8;
if (dialogId == 0)
return;
/* open the newItems dialog box */
if (NULL == (dbP = mdlDialog_open (NULL, dialogId)))
listbox_errorPrint (MSGID_DialogBox);
}
/*----------------------------------------------------------------------+
| |
| name main |
| |
| author BSI 05/95 |
| |
+----------------------------------------------------------------------*/
static DialogHookInfo uHooks[] =
{
{HOOKDIALOGID_ListIcon, listicon_mainBoxHook},
{HOOKDIALOGID_DialogSash, listsash_sashDialogHook},
{HOOKDIALOGID_MultiList, listmult_multiListDialogHook},
{HOOKDIALOGID_Colors, listcolr_colorsDialogHook},
{HOOKITEMID_ListIcon_FileListDirectory, listicon_iconListBoxHook},
{HOOKITEMID_CheckListBox, listicon_checkListBoxHook},
{HOOKITEMID_Sash, listsash_sashHook},
{HOOKITEMID_ListBoxSash, listsash_sashListBoxHook},
{HOOKITEMID_ListBoxMulti, listmult_multiListBoxHook},
{HOOKITEMID_PDMMultiListTests, listmult_multiListTestsMenusHook},
{HOOKITEMID_ToggleBtnColor, listcolr_colorsToggleBtnHook},
{HOOKITEMID_ColoredListBox, listcolr_coloredListBoxHook},
};
Public void main
(
int argc, /* => number of args in next array */
char *argv[] /* => array of cmd line arguments */
)
{
char *setP; /* ptr to "C expression symbol set" */
RscFileHandle rscFileH; /* a resource file handle */
/* open the resource file that we came out of */
mdlResource_openFile (&rscFileH, NULL, 0);
/* Load our command table */
if (NULL == mdlParse_loadCommandTable (NULL))
listbox_errorPrint(MSGID_CommandTable);
/* Publish a function for the unload program event */
mdlSystem_setFunction (SYSTEM_UNLOAD_PROGRAM, listbox_unloadFunction);
/* publish our hook functions */
mdlDialog_hookPublish (sizeof(uHooks)/sizeof(DialogHookInfo), uHooks);
/* set up variables that will be evaluated within C expression strings */
setP = mdlCExpression_initializeSet (VISIBILITY_DIALOG_BOX, 0, FALSE);
mdlDialog_publishComplexVariable (setP, "listboxglobals", "listboxGlobs", &listboxGlobs);
listcolr_initializeColorDescriptors (&listboxGlobs.localPalP, listboxGlobs.localColorsP, NLOCAL_COLORS);
/* add our commands to the application menu */
mdlDialog_menuBarAddCmdWinMenu (&gAppMenuItem, PULLDOWNMENUID_ListBox, TRUE);
mdlSystem_setFunction (SYSTEM_COLORMAP_CHANGE, listcolr_handleRemap);
}