home *** CD-ROM | disk | FTP | other *** search
- #define STRICT_WINDOWS 1
- #include <Dialogs.h>
- #include <Menus.h>
-
- #include "ToolBoxInit.h"
- #include "Dim_text_3.h"
-
- enum { // dialog item numbers
- i_done = 1,
- i_title,
- i_checkbox1,
- i_checkbox2,
- i_stat1,
- i_edit1,
- i_edit3,
- i_stat2,
- i_edit2,
- i_refresh
- };
-
- void main( void )
- {
- DialogRef dp;
- ControlHandle checkbox1, checkbox2;
- Rect iRect;
- short iType, hit, val;
- MenuHandle apple_menu;
- ModalFilterUPP Dialog_filter_UPP;
-
- ToolBoxInit();
- apple_menu = NewMenu( 128, "\p\x14" );
- AppendMenu( apple_menu, "\pYo;(-" );
- AddResMenu( apple_menu, 'DRVR' );
- InsertMenu( apple_menu, 0 );
- DrawMenuBar();
-
- Dialog_filter_UPP = NewModalFilterProc( Dim_filter_proc );
-
- dp = GetNewDialog( 128, NULL, (WindowRef)-1L );
- SetGrafPortOfDialog( dp );
- SetDialogDefaultItem( dp, i_done );
- GetDialogItem( dp, i_checkbox1, &iType, (Handle *)&checkbox1, &iRect );
- GetDialogItem( dp, i_checkbox2, &iType, (Handle *)&checkbox2, &iRect );
- Init_dimmer( dp, NULL );
-
- ShowWindow( GetDialogWindow( dp ) );
- do {
- ModalDialog( Dialog_filter_UPP, &hit );
- switch (hit)
- {
- case i_checkbox1:
- val = !GetControlValue( checkbox1 );
- SetControlValue( checkbox1, val );
- Dim_text( dp, i_stat1, val );
- Dim_text( dp, i_edit1, val );
- Dim_text( dp, i_edit3, val );
- break;
-
- case i_checkbox2:
- val = !GetControlValue( checkbox2 );
- if (val)
- {
- Alert( 129, NULL );
- }
- SetControlValue( checkbox2, val );
- Dim_text( dp, i_stat2, val );
- Dim_text( dp, i_edit2, val );
- break;
-
- case i_refresh:
- EraseRect( &qd.thePort->portRect );
- InvalRect( &qd.thePort->portRect );
- break;
- }
- } while (hit != i_done);
-
- Dispose_dimmer( dp );
- DisposeDialog( dp );
- DisposeRoutineDescriptor( Dialog_filter_UPP );
- }
-