home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-06-25 | 1.6 KB | 75 lines | [TEXT/CWIE] |
- //
- // CSliderDemoWindow.cp
- //
-
- #include "CSliderDemoWindow.h"
- #include "CAGASlider.h"
- #include <LString.h>
-
- const MessageT msg_VerticalSlider = 1001;
- const MessageT msg_EastSlider = 1002;
- const MessageT msg_WestSlider = 1003;
- const MessageT msg_HorizontalSlider = 1004;
- const MessageT msg_SouthSlider = 1005;
- const MessageT msg_NorthSlider = 1006;
-
- const PaneIDT pane_ResultField = 1100;
-
- CSliderDemoWindow* CSliderDemoWindow::CreateSliderDemoWindowStream(LStream *inStream)
- {
- return new CSliderDemoWindow( inStream );
- }
-
- CSliderDemoWindow::CSliderDemoWindow( LStream *inStream )
- : LWindow( inStream )
- {
-
- }
-
- void CSliderDemoWindow::ListenToMessage( MessageT inMessage, void *ioParam )
- {
- Int32 theValue = *(Int32*)ioParam;
- StringPtr ind;
- Str15 ind_4 = "\p'xxxx'";
-
- switch ( inMessage ) {
- case 'enab': DoSliderEnable( theValue == 1 ); return;
- case 'vert': ind = "\pVertical"; break;
- case 'east': ind = "\pEast"; break;
- case 'west': ind = "\pWest"; break;
- case 'hori': ind = "\pHorizontal"; break;
- case 'sout': ind = "\pSouth"; break;
- case 'nort': ind = "\pNorth"; break;
-
- default: // unknown message
- ind = ind_4;
- *(long*)(ind_4+2) = inMessage;
- break;
- }
-
- LStr255 str(theValue);
- str += ' ';
- str += ind;
-
- LEditField *theField = (LEditField*)FindPaneByID( pane_ResultField );
- Assert_( theField != nil );
-
- theField->SetDescriptor( str );
- theField->Draw( nil );
-
- }
-
- void CSliderDemoWindow::DoSliderEnable( Boolean inEnable )
- {
- for ( PaneIDT p = 1001; p<=1006; p++ ) {
-
- LPane * thePane = FindPaneByID( p );
- Assert_( thePane != nil );
-
- if ( inEnable ) thePane->Enable();
- else thePane->Disable();
-
- thePane->Draw( nil );
- }
- }
-