コード例 #1
0
ファイル: HelloAdjust.cpp プロジェクト: elgalu/marmalade_sdk
void initializeUI() {
    CAppPtr app = CreateApp();
    CWindowPtr window = CreateWindow();

    app->AddWindow(window);

    CViewPtr view = CreateView("canvas");

    CButtonPtr btnTrackSimpleEvent = CreateButton(CAttributes()
                                                  .Set("name",    "btnTrackSimpleEvent")
                                                  .Set("caption", "Track Simple Event")
                                                  .Set("x1",      "50%")
                                                  .Set("y1",      "5%")
                                                  .Set("width",   "50%")
                                                  .Set("height",  "7%")
                                                  .Set("alignW",  "centre"));

    CButtonPtr btnTrackRevenueEvent = CreateButton(CAttributes()
                                                   .Set("name",    "btnTrackRevenueEvent")
                                                   .Set("caption", "Track Revenue Event")
                                                   .Set("x1",      "50%")
                                                   .Set("y1",      "15%")
                                                   .Set("width",   "50%")
                                                   .Set("height",  "7%")
                                                   .Set("alignW",  "centre"));

    CButtonPtr btnTrackCallbackEvent = CreateButton(CAttributes()
                                                    .Set("name",    "btnTrackCallbackEvent")
                                                    .Set("caption", "Track Callback Event")
                                                    .Set("x1",      "50%")
                                                    .Set("y1",      "25%")
                                                    .Set("width",   "50%")
                                                    .Set("height",  "7%")
                                                    .Set("alignW",  "centre"));

    CButtonPtr btnTrackPartnerEvent = CreateButton(CAttributes()
                                                   .Set("name",    "btnTrackPartnerEvent")
                                                   .Set("caption", "Track Partner Event")
                                                   .Set("x1",      "50%")
                                                   .Set("y1",      "35%")
                                                   .Set("width",   "50%")
                                                   .Set("height",  "7%")
                                                   .Set("alignW",  "centre"));

    CButtonPtr btnEnableOfflineMode = CreateButton(CAttributes()
                                                   .Set("name",    "btnEnableOfflineMode")
                                                   .Set("caption", "Enable Offline Mode")
                                                   .Set("x1",      "50%")
                                                   .Set("y1",      "45%")
                                                   .Set("width",   "50%")
                                                   .Set("height",  "7%")
                                                   .Set("alignW",  "centre"));

    CButtonPtr btnDisableOfflineMode = CreateButton(CAttributes()
                                                    .Set("name",    "btnDisableOfflineMode")
                                                    .Set("caption", "Disable Offline Mode")
                                                    .Set("x1",      "50%")
                                                    .Set("y1",      "55%")
                                                    .Set("width",   "50%")
                                                    .Set("height",  "7%")
                                                    .Set("alignW",  "centre"));

    CButtonPtr btnEnableSDK = CreateButton(CAttributes()
                                           .Set("name",    "btnEnableSDK")
                                           .Set("caption", "Enable SDK")
                                           .Set("x1",      "50%")
                                           .Set("y1",      "65%")
                                           .Set("width",   "50%")
                                           .Set("height",  "7%")
                                           .Set("alignW",  "centre"));

    CButtonPtr btnDisableSDK = CreateButton(CAttributes()
                                            .Set("name",    "btnDisableSDK")
                                            .Set("caption", "Disable SDK")
                                            .Set("x1",      "50%")
                                            .Set("y1",      "75%")
                                            .Set("width",   "50%")
                                            .Set("height",  "7%")
                                            .Set("alignW",  "centre"));

    CButtonPtr btnIsSDKEnabled = CreateButton(CAttributes()
                                              .Set("name",    "btnIsSDKEnabled")
                                              .Set("caption", "Is SDK Enabled?")
                                              .Set("x1",      "50%")
                                              .Set("y1",      "85%")
                                              .Set("width",   "50%")
                                              .Set("height",  "7%")
                                              .Set("alignW",  "centre"));

    btnTrackSimpleEvent->SetEventHandler("click", (void*)NULL, &OnTrackSimpleEventClick);
    btnTrackRevenueEvent->SetEventHandler("click", (void*)NULL, &onTrackRevenueEventClick);
    btnTrackCallbackEvent->SetEventHandler("click", (void*)NULL, &OnTrackCallbackEventClick);
    btnTrackPartnerEvent->SetEventHandler("click", (void*)NULL, &OnTrackPartnerEventClick);
    btnEnableOfflineMode->SetEventHandler("click", (void*)NULL, &OnEnableOfflineModeClick);
    btnDisableOfflineMode->SetEventHandler("click", (void*)NULL, &OnDisableOfflineModeClick);
    btnEnableSDK->SetEventHandler("click", (void*)NULL, &OnEnableSDKClick);
    btnDisableSDK->SetEventHandler("click", (void*)NULL, &OnDisableSDKClick);
    btnIsSDKEnabled->SetEventHandler("click", (void*)NULL, &OnIsSDKEnabledClick);

    view->AddChild(btnTrackSimpleEvent);
    view->AddChild(btnTrackRevenueEvent);
    view->AddChild(btnTrackCallbackEvent);
    view->AddChild(btnTrackPartnerEvent);
    view->AddChild(btnEnableOfflineMode);
    view->AddChild(btnDisableOfflineMode);
    view->AddChild(btnEnableSDK);
    view->AddChild(btnDisableSDK);
    view->AddChild(btnIsSDKEnabled);

    window->SetChild(view);

    // Initialize adjust SDK
    initializeSDK();

    app->ShowWindow(window);
    app->Run();
}
コード例 #2
0
ファイル: ExampleUI.cpp プロジェクト: BingoBongoVrn/certified
ExampleUI::ExampleUI()
{
    app = CreateApp();
    CWindowPtr window = CreateWindow();
    app->AddWindow(window);
    CViewPtr view = CreateView("canvas");  
    CViewPtr grayView = CreateView(CAttributes()
                                   .Set("name",        "grayView")
                                   .Set("x1",          0)
                                   .Set("y1",          0)
                                   .Set("width",       "100%")
                                   .Set("height",      "100%")
                                   .Set("backgroundColour", COLOUR_GREY)); 
    view->AddChild(grayView);   
	// buttons
    CButtonPtr button1 = CreateButton(CAttributes()
                                      .Set("name",    "Button1")
                                      .Set("caption", "Query Shop")
                                      .Set("x1", "5%")
                                      .Set("y1", "5%")
                                      .Set("alignW",  "left")
									  .Set("visible", true)
                                      );   
    button1->SetEventHandler("click", (void*)this, &OnButton1Click);   
    CButtonPtr button2 = CreateButton(CAttributes()
                                      .Set("name",    "Button2")
                                      .Set("caption", "Restore Purchases")
                                      .Set("x1", "5%")
                                      .Set("y1", "15%")
                                      .Set("alignW",  "left")
									  .Set("visible", true)
                                      );  
    button2->SetEventHandler("click", (void*)this, &OnButton2Click);
    CButtonPtr button3 = CreateButton(CAttributes()
                                      .Set("name",    "Button3")
                                      .Set("caption", "Purchase fluidtest.100coins")
                                      .Set("x1", "50%")
                                      .Set("y1", "5%")
                                      .Set("alignW",  "left")
									  .Set("visible", true)
                                      );  
    button3->SetEventHandler("click", (void*)this, &OnButton3Click);
    CButtonPtr button4 = CreateButton(CAttributes()
                                      .Set("name",    "Button4")
                                      .Set("caption", "Consume fluidtest.100coins")
                                      .Set("x1", "50%")
                                      .Set("y1", "15%")
                                      .Set("alignW",  "left")
									  .Set("visible", true)
                                      );  
    button4->SetEventHandler("click", (void*)this, &OnButton4Click);

	// text fields
    statusText = CreateLabel(CAttributes()
                            .Set("caption","")
                            .Set("x1", "5%")
							.Set("x2", "95%")
                            .Set("y1", "60%")
                            .Set("height","10%")
							.Set("alignW","left")
                            );      
	animatingText = CreateLabel(CAttributes()
                            .Set("caption","... Some Animating Text ...")
                            .Set("x1", "5%")
							.Set("x2", "95%")
                            .Set("y1", "70%")
                            .Set("height","10%")
							.Set("alignW","left")
                            ); 
	consumableText = CreateLabel(CAttributes()
                            .Set("caption","")
                            .Set("x1", "5%")
							.Set("x2", "95%")
                            .Set("y1", "50%")
                            .Set("height","10%")
							.Set("alignW","left")
                            ); 

	// log list box
	logText = CreateListBox(CAttributes()
                            .Set("x1", "5%")
							.Set("x2", "95%")
                            .Set("y1", "80%")
							.Set("alignW","left")
                            );   
	logText->SetEventHandler("selectitem",(void*)this,&ListBoxSelect);

	listBoxItems.AddString(CString("View Log"));
	logText->SetAttribute("listBoxItems",listBoxItems);

	view->AddChild(button1); buttons.push_back(button1);
    view->AddChild(button2); buttons.push_back(button2);
    view->AddChild(button3); buttons.push_back(button3);
    view->AddChild(button4); buttons.push_back(button4);
 
	view->AddChild(statusText);
	view->AddChild(animatingText);
	view->AddChild(consumableText);
    view->AddChild(logText);
	//view->AddChild(userNameText);

	SetStatusText("");
    window->SetChild(view);   
    app->ShowWindow(window);  
}