home *** CD-ROM | disk | FTP | other *** search
- #include "CITGroup.h"
- #include "CITButton.h"
- #include "CITGetScreenMode.h"
-
- #include <libraries/asl.h>
-
- #define NEWSCREEN (MAIN_STOPMASK<<1)
-
- CITApp Application;
-
- CITScreen DemoScreen;
- CITWindow DemoWindow;
- CITVGroup winGroup;
- CITGetScreenMode screenModeReq;
- CITButton quitButton;
-
- ULONG modeID = DEF_MONITOR;
- UBYTE depth = 0;
-
- void CloseEvent();
- void ScreenModeReqEvent(ULONG ID);
- void QuitEvent(ULONG ID);
-
- int main(void)
- {
- ULONG StopCode;
- BOOL Error=FALSE;
-
- DemoScreen.InsObject(DemoWindow,Error);
- DemoWindow.Position(WPOS_CENTERSCREEN);
- DemoWindow.CloseGadget();
- DemoWindow.DragBar();
- DemoWindow.SizeGadget();
- DemoWindow.DepthGadget();
- DemoWindow.IconifyGadget();
- DemoWindow.Activate();
- DemoWindow.Caption("CITGetScreenMode Test");
- DemoWindow.CloseEventHandler(CloseEvent);
- DemoWindow.InsObject(winGroup,Error);
- winGroup.SpaceOuter();
- winGroup.InsObject(screenModeReq,Error);
- screenModeReq.LabelText("ScreenMode:");
- screenModeReq.TitleText("Select ScreenMode..");
- screenModeReq.EventHandler(ScreenModeReqEvent);
- winGroup.InsObject(quitButton,Error);
- quitButton.Text("Quit");
- quitButton.MaxHeight(30);
- quitButton.EventHandler(QuitEvent);
- do
- {
- DemoScreen.Display(modeID);
- DemoScreen.Depth(depth);
-
- Application.InsObject(DemoScreen,Error);
-
- // Ok?
- if( Error )
- return 10;
-
- StopCode = Application.Run(NEWSCREEN|MAIN_STOPMASK);
-
- Application.RemObject(DemoScreen);
- }
- while( !(StopCode&MAIN_STOPMASK) );
-
- return 0;
- }
-
- void ScreenModeReqEvent(ULONG ID)
- {
- ULONG oldModeID;
- UBYTE oldDepth;
-
- quitButton.Disabled(TRUE);
-
- oldModeID = screenModeReq.DisplayID();
- oldDepth = screenModeReq.DisplayDepth();
- screenModeReq.ReqScreenMode();
- modeID = screenModeReq.DisplayID();
- depth = screenModeReq.DisplayDepth();
-
- if( (oldModeID != modeID) || (oldDepth != depth) )
- Application.Stop(NEWSCREEN);
-
- quitButton.Disabled(FALSE);
- }
-
- void QuitEvent(ULONG ID)
- {
- Application.Stop();
- }
-
- void CloseEvent()
- {
- Application.Stop();
- }
-