// -----------------------------------------------------------------------------
// CTestSDKSettingPages::TestSettingpagesRadioButtonWriteInternalStateLL
// -----------------------------------------------------------------------------
//
TInt CTestSDKSettingPages::TestSettingpagesRadioButtonWriteInternalStateLL( CStifItemParser& /*aItem*/ )
    {
    CDesCArrayFlat* mArr = new( ELeave ) CDesCArrayFlat( KSize );
    CleanupStack::PushL( mArr );

    TBuf<KBufSize> tom( KTom );
    TBuf<KBufSize> jack( KJack );
    TBuf<KBufSize> mary( KMary );
    mArr->AppendL( tom );
    mArr->AppendL( jack );
    mArr->AppendL( mary );
    TInt optin( KZero );
    TBuf< KBufSize > buffer( KTestString );
    CTestRadioButtonSettingPage* dialog =
    new (ELeave) CTestRadioButtonSettingPage( &buffer, KOne, EAknCtPopupSettingList,
        R_EXAMPLE_EDITOR_CONTROL, R_EXAMPLE_SETTING_PAGE, optin, mArr );
    CleanupStack::PushL( dialog );
    dialog->ConstructL();
    
    RDesWriteStream stream;
    CleanupClosePushL( stream );
    HBufC8* hbuf = HBufC8::NewL( KHBufSize );
    CleanupStack::PushL( hbuf );
    TPtr8 ptr = hbuf->Des();
    stream.Open( ptr );
    dialog->DoWriteInternalStateL( stream );
    stream.CommitL();
    stream.Close();  
    CleanupStack::PopAndDestroy( KFour );
    return KErrNone;
    }
// -----------------------------------------------------------------------------
// CTestSDKSettingPages::TestSettingpagesRadioButtonSelectCurrentItemLL
// -----------------------------------------------------------------------------
//
TInt CTestSDKSettingPages::TestSettingpagesRadioButtonSelectCurrentItemLL( CStifItemParser& /*aItem*/ )
    {
    CDesCArrayFlat* mArr = new( ELeave ) CDesCArrayFlat( KSize );
    CleanupStack::PushL( mArr );

    TBuf<KBufSize> tom( KTom );
    TBuf<KBufSize> jack( KJack );
    TBuf<KBufSize> mary( KMary );
    mArr->AppendL( tom );
    mArr->AppendL( jack );
    mArr->AppendL( mary );
    
    TInt optin( KZero );
    TBuf< KBufSize > buffer( KTestString );
    CTestRadioButtonSettingPage* dialog =
    new (ELeave) CTestRadioButtonSettingPage( &buffer, KOne, EAknCtPopupSettingList,
        R_EXAMPLE_EDITOR_CONTROL, R_EXAMPLE_SETTING_PAGE, optin, mArr );
    CleanupStack::PushL( dialog );
    
    dialog->ConstructL();
    dialog->DoSelectCurrentItemL();
    
    CleanupStack::PopAndDestroy( KTwo );
    return KErrNone;
    }
// -----------------------------------------------------------------------------
// CTestSDKSettingPages::TestSettingpagesRadioButtonHandlePointerEventLL
// -----------------------------------------------------------------------------
//
TInt CTestSDKSettingPages::TestSettingpagesRadioButtonHandlePointerEventLL( CStifItemParser& /*aItem*/ )
    {
    CDesCArrayFlat* mArr = new( ELeave ) CDesCArrayFlat( KSize );
    CleanupStack::PushL( mArr );

    TBuf<KBufSize> tom( KTom );
    TBuf<KBufSize> jack( KJack );
    TBuf<KBufSize> mary( KMary );
    mArr->AppendL( tom );
    mArr->AppendL( jack );
    mArr->AppendL( mary );
    
    TInt optin( KZero );
    TBuf< KBufSize > buffer( KTestString );
    CAknRadioButtonSettingPage* dialog =
    new (ELeave) CAknRadioButtonSettingPage( &buffer, KOne, EAknCtPopupSettingList,
        R_EXAMPLE_EDITOR_CONTROL, R_EXAMPLE_SETTING_PAGE, optin, mArr );
    CleanupStack::PushL( dialog );
    
    dialog->ConstructL();
    TPointerEvent event;
    event.iType = TPointerEvent::EButton1Down;
    event.iModifiers = 0;
    TPoint eventPos( 10, 30 );
    event.iPosition = eventPos;
    event.iParentPosition = eventPos;
    dialog->HandlePointerEventL( event );
    
    CleanupStack::PopAndDestroy( KTwo );
    return KErrNone;
    }
// -----------------------------------------------------------------------------
// CTestSDKSettingPages::TestSettingpagesRadioButtonHandleListBoxEventLL
// -----------------------------------------------------------------------------
//
TInt CTestSDKSettingPages::TestSettingpagesRadioButtonHandleListBoxEventLL( CStifItemParser& /*aItem*/ )
    {
    CDesCArrayFlat* mArr = new( ELeave ) CDesCArrayFlat( KSize );
    CleanupStack::PushL( mArr );

    TBuf<KBufSize> tom( KTom );
    TBuf<KBufSize> jack( KJack );
    TBuf<KBufSize> mary( KMary );
    mArr->AppendL( tom );
    mArr->AppendL( jack );
    mArr->AppendL( mary );
    
    TInt optin( KZero );
    TBuf< KBufSize > buffer( KTestString );
    CAknRadioButtonSettingPage* dialog =
    new (ELeave) CAknRadioButtonSettingPage( &buffer, KOne, EAknCtPopupSettingList,
        R_EXAMPLE_EDITOR_CONTROL, R_EXAMPLE_SETTING_PAGE, optin, mArr );
    CleanupStack::PushL( dialog );
    
    dialog->ConstructL();
    dialog->HandleListBoxEventL( dialog->ListBoxControl(), MEikListBoxObserver::EEventItemActioned );
    dialog->HandleListBoxEventL( dialog->ListBoxControl(), MEikListBoxObserver::EEventItemClicked );
    dialog->HandleListBoxEventL( dialog->ListBoxControl(), MEikListBoxObserver::EEventPenDownOnItem );
    
    CleanupStack::PopAndDestroy( KTwo );
    return KErrNone;
    }
// -----------------------------------------------------------------------------
// CTestSDKSettingPages::TestSettingpagesRadioButtonListBoxControlL
// -----------------------------------------------------------------------------
//
TInt CTestSDKSettingPages::TestSettingpagesRadioButtonListBoxControlL( CStifItemParser& /*aItem*/ )
    {
    CDesCArrayFlat* mArr = new( ELeave ) CDesCArrayFlat( KSize );
    CleanupStack::PushL( mArr );

    TBuf<KBufSize> tom( KTom );
    TBuf<KBufSize> jack( KJack );
    TBuf<KBufSize> mary( KMary );
    mArr->AppendL( tom );
    mArr->AppendL( jack );
    mArr->AppendL( mary );
    
    TInt optin( KZero );
    CAknRadioButtonSettingPage* dialog =
    new (ELeave) CAknRadioButtonSettingPage( R_EXAMPLE_SETTING_PAGE,
        optin, mArr );
    CleanupStack::PushL( dialog );
    
    CAknSetStyleListBox* editorControl = dialog->ListBoxControl();
    STIF_ASSERT_NULL( editorControl );
    
    dialog->ConstructL();
    
    editorControl = dialog->ListBoxControl();
    STIF_ASSERT_NOT_NULL( editorControl );
    
    CleanupStack::PopAndDestroy( KTwo );
    return KErrNone;
    }
Exemple #6
0
void generate()
{
	int i,b=1;
	maxv=1;
	for(i=0;i<LEN;i++){ b=b*m;maxv*=10;}
	nnum=b;
	for(i=0;i<b;i++) num[i]=tom(i);
}
Exemple #7
0
function plotMonth(var value,int type)
{
	int periods = 22;
	LookBack = max(LookBack,periods);
	int n = (periods*tdm())/max(periods,tom());
	//int n = (periods*day())/max(periods,dom());
	if(n > periods) return;
	plotSeason(n,n,month(),value,type);
}
Exemple #8
0
int main()
{
	Bureaucrat diego("Diego", 35);
	Bureaucrat tom("Tom", 140);
	Bureaucrat sylvie("Sylvie", 150);

	ShrubberyCreationForm A("home");

	std::cout << diego;
	std::cout << tom;
	std::cout << A;
	sylvie.executeForm(A);
	sylvie.signForm(A);
	sylvie.executeForm(A);
	std::cout << A;
	tom.executeForm(A);
	tom.signForm(A);
	tom.executeForm(A);
	std::cout << A;
	diego.executeForm(A);
	diego.signForm(A);
	diego.executeForm(A);

	RobotomyRequestForm B("Hillary");
	std::cout << B;
	sylvie.signForm(B);
	std::cout << B;
	tom.signForm(B);
	std::cout << B;
	diego.signForm(B);
	diego.executeForm(B);
	diego.executeForm(B);
	diego.executeForm(B);
	diego.executeForm(B);
	
	Bureaucrat bill("Bill", 5);
	PresidentialPardonForm C("Bill Clinton");

	std::cout << C;
	sylvie.signForm(C);
	std::cout << C;
	tom.signForm(C);
	std::cout << C;
	diego.signForm(C);
	bill.executeForm(C);
	bill.signForm(C);
	bill.executeForm(C);

	return 0;
}
// -----------------------------------------------------------------------------
// CTestSDKSettingPages::TestSettingpagesRadioButtonConstructorL
// -----------------------------------------------------------------------------
//
TInt CTestSDKSettingPages::TestSettingpagesRadioButtonConstructorL( CStifItemParser& /*aItem*/ )
    {
    CDesCArrayFlat* mArr = new( ELeave ) CDesCArrayFlat( KSize );
    CleanupStack::PushL( mArr );

    TBuf<KBufSize> tom( KTom );
    TBuf<KBufSize> jack( KJack );
    TBuf<KBufSize> mary( KMary );
    mArr->AppendL( tom );
    mArr->AppendL( jack );
    mArr->AppendL( mary );
    
    TInt optin( KZero );
    CAknRadioButtonSettingPage* dialog =
        new (ELeave) CAknRadioButtonSettingPage( R_EXAMPLE_SETTING_PAGE,
        optin, mArr );
    CleanupStack::PushL( dialog );
    CleanupStack::PopAndDestroy( KTwo );
    return KErrNone;
    }
// -----------------------------------------------------------------------------
// CTestSDKSettingPages::TestSettingPagesArrayDecoratorSetArrayL
// -----------------------------------------------------------------------------
//
TInt CTestSDKSettingPages::TestSettingPagesArrayDecoratorSetArrayL( CStifItemParser& /*aItem*/ )
    {
    TAknDesCArrayDecorator* decorator = new( ELeave ) TAknDesCArrayDecorator();
    CleanupStack::PushL( decorator );
    
    CDesCArrayFlat* arr = new( ELeave ) CDesCArrayFlat( KSize );
    CleanupStack::PushL( arr );

    TBuf<KBufSize> tom( KTom );
    TBuf<KBufSize> jack( KJack );
    TBuf<KBufSize> mary( KMary );
    
    arr->AppendL( tom );
    arr->AppendL( jack );
    arr->AppendL( mary );
    
    decorator->SetArray( arr );
    TBuf<KBufSize> buffer( KTestString );
    decorator->SetDecorationText( buffer );
    
    TInt count = decorator->MdcaCount();
    STIF_ASSERT_EQUALS( KThree, count );
    
    TInt numberofarray( KZero );
    TBool flag = decorator->DecoratedIndex( numberofarray );
    STIF_ASSERT_EQUALS( KThree, numberofarray );
    STIF_ASSERT_FALSE( flag );
    
    decorator->SetActive( ETrue );
    count = decorator->MdcaCount();
    STIF_ASSERT_EQUALS( KFour, count );
    
    TPtrC returnText = decorator->MdcaPoint( KZero );
    STIF_ASSERT_TRUE( returnText == tom );
    
    CleanupStack::PopAndDestroy( arr );
    CleanupStack::PopAndDestroy( decorator );
    return KErrNone;
    }
void LooseLightshow::handleNoteOn(byte channel, byte instrument, byte velocity) {
    isStarted = true;
    switch (instrument) {
    case KICK:
        kick();
        break;
    case SNARE:
        snare();
        break;
    case SNARE_RIM:
        snare();
        break;
    case XSTICK:
        snare();
        break;
    case CRASH1:
        crash();
        break;
    case CRASH1_EDGE:
        crash();
        break;
    case CRASH2:
        crash();
        break;
    case CRASH2_EDGE:
        crash();
        break;
    case TOM1:
        tom();
        break;
    case TOM2:
        tom();
        break;
    case TOM3:
        tom();
        break;
    case TOM1_RIM:
        tom();
        break;
    case TOM2_RIM:
        tom();
        break;
    case TOM3_RIM:
        tom();
        break;
    case RIDE:
        ride();
        break;
    case RIDE_EDGE:
        ride();
        break;
    case RIDE_BELL:
        ride();
        break;
    case HIHAT_OPEN:
        hihat();
        break;
    case HIHAT_OPEN_RIM:
        hihat();
        break;
    case HIHAT_CLOSED:
        hihat();
        break;
    case HIHAT_CLOSED_RIM:
        hihat();
        break;
    case HIHAT_PEDAL:
        break;
    }
}
//
// MIDI
//
void WitchLightshow::handleNoteOn(byte channel, byte instrument, byte velocity) {
  switch (instrument) {
    case KICK:
      break;
    case SNARE:
      break;
    case CRASH1:
      crash();
      break;
    case CRASH1_EDGE:
      crash();
      break;
    case CRASH2:
      crash();
      break;
    case CRASH2_EDGE:
      crash();
      break;
    case TOM1:
      tom();
      break;
    case TOM2:
      tom();
      break;
    case TOM3:
      tom();
      break;
    case TOM1_RIM:
      tom();
      break;
    case TOM2_RIM:
      tom();
      break;
    case TOM3_RIM:
      tom();
      break;
    case RIDE:
      ride();
      break;
    case RIDE_EDGE:
      ride();
      break;
    case RIDE_BELL:
      ride();
      break;
    case HIHAT_OPEN:
      hiHat();
      break;
    case HIHAT_OPEN_RIM:
      hiHat();
      break;
    case HIHAT_CLOSED:
      hiHat();
      break;
    case HIHAT_CLOSED_RIM:
      hiHat();
      break;
    case HIHAT_PEDAL:
      break;
  }
}