Exemple #1
0
void __fastcall TCDirectoryOutline::WalkTree(const AnsiString& Dest)
{
    AnsiString Path = ForceCase(Dest);
    long Item = RootIndex;  // start at root


    // remove drive component of Path

    int Colon = Path.Pos(":");
    if (Colon > 0) {
        int Offset = (Path[Colon + 1] == '\\') ? 2 : 1;
        if ((Colon + Offset) >= Path.Length())
           Path = "";
        else
           Path = Path.SubString(Colon + Offset, Path.Length() - (Colon + Offset) +1);
    }

    // do the walk
    for (int SlashPos = GetPos(Path, "\\"); Path.Length() > 0;
            SlashPos = GetPos(Path, "\\")) {
        AnsiString Dir = Path;

        if (SlashPos > 0) {
            // splice out the first directory
            Dir = Path.SubString(1, SlashPos - 1);
            Path = Path.SubString(SlashPos + 1, Path.Length() - (SlashPos + 1) + 1);
        }
        else {
            Dir = Path;
            Path = "";
        }

        Item = GetChildNamed(Dir, Item);
    }

    SelectedItem = Item;
}
#include "s3e.h"
#include "s3eSocket.h"
#include "MessageBox.h"
#include "tinyxml.h"
#include "Utils.h"

SelectGameGameState::SelectGameGameState(IGameHandler* pGameHandler)
{
	IW_UI_CREATE_VIEW_SLOT1(this, "SelectGameGameState", SelectGameGameState, OnClickStartMulti, CIwUIElement*)
	IW_UI_CREATE_VIEW_SLOT1(this, "SelectGameGameState", SelectGameGameState, OnClickStartSingle, CIwUIElement*)
	IW_UI_CREATE_VIEW_SLOT1(this, "SelectGameGameState", SelectGameGameState, OnClickBack, CIwUIElement*)
	IW_UI_CREATE_VIEW_SLOT1(this, "SelectGameGameState", SelectGameGameState, OnClickUser, CIwUIElement*)
	IW_UI_CREATE_VIEW_SLOT1(this, "SelectGameGameState", SelectGameGameState, OnClickDelete, CIwUIElement*)

	g_pDialogMain = (CIwUIElement*)IwGetResManager()->GetResNamed("selectgame\\panel", "CIwUIElement");
	g_pCreateButton = (CIwUIButton*)g_pDialogMain->GetChildNamed("Button_Create");
	g_pStartButton = (CIwUIButton*)g_pDialogMain->GetChildNamed("Button_Start");

	g_pDialogMain->SetVisible(false);
	IwGetUIView()->AddElement(g_pDialogMain);
	IwGetUIView()->AddElementToLayout(g_pDialogMain);

	g_bWaitingOnGps = true;
	IwGetMultiplayerHandler()->RegisterModeChangedCallback(MultiplayerModeChanged, this);

	g_pUserTexture = new CIwTexture;
	g_pUserTexture->LoadFromFile("images/fireflies/user.png");
	g_pUserTexture->Upload();
	
	g_pUserTextureB = new CIwTexture;
	g_pUserTextureB->LoadFromFile("images/fireflies/userB.png");
bool MessageBox::Show(char* szTitle, char* szDescription, char* szOption1, char* szOption2, RenderDelegate pfnRender, void* pParam)
{
	if (NULL == g_pMessageBox)
	{
		g_pMessageBox = new MessageBox();
	}
	return g_pMessageBox->ShowInternal(szTitle, szDescription, szOption1, szOption2, pfnRender, pParam);
}

MessageBox::MessageBox(void)
{
	IW_UI_CREATE_VIEW_SLOT1(this, "MessageBox", MessageBox, OnOption1, CIwUIElement*)
	IW_UI_CREATE_VIEW_SLOT1(this, "MessageBox", MessageBox, OnOption2, CIwUIElement*)
	g_pDialog = ((CIwUIElement*)IwGetResManager()->GetResNamed("MessageBox", "CIwUIElement"))->Clone();
	g_pTitle = (CIwUILabel*)g_pDialog->GetChildNamed("Title");
	g_pDescription = (CIwUILabel*)g_pDialog->GetChildNamed("Description");
	g_pOption1 = (CIwUIButton*)g_pDialog->GetChildNamed("Option1");
	g_pOption2 = (CIwUIButton*)g_pDialog->GetChildNamed("Option2");
	
	g_pDialog->SetVisible(false);
	IwGetUIView()->AddElement(g_pDialog);
	IwGetUIView()->AddElementToLayout(g_pDialog);
}

MessageBox::~MessageBox(void)
{
	//
}

bool MessageBox::ShowInternal(char* szTitle, char* szDescription, char* szOption1, char* szOption2, RenderDelegate pfnRender, void* pParam)
TextEntryBox* TextEntryBox::g_pTextEntryBox = NULL;

void TextEntryBox::Show(char* szTitle, char* szDescription, char* szOption1, RenderDelegate pfnRender, TextEntryBoxButtonClick onClicked, void* pParam)
{
	if (NULL == g_pTextEntryBox)
	{
		g_pTextEntryBox = new TextEntryBox();
	}
	g_pTextEntryBox->ShowInternal(szTitle, szDescription, szOption1, pfnRender, onClicked, pParam);
}

TextEntryBox::TextEntryBox(void)
{
	IW_UI_CREATE_VIEW_SLOT1(this, "TextEntryBox", TextEntryBox, OnOption1, CIwUIElement*)
	g_pDialog = ((CIwUIElement*)IwGetResManager()->GetResNamed("TextEntryBox", "CIwUIElement"))->Clone();
	g_pTitle = (CIwUILabel*)g_pDialog->GetChildNamed("Title");
	g_pDescription = (CIwUILabel*)g_pDialog->GetChildNamed("Description");
	g_pOption1 = (CIwUIButton*)g_pDialog->GetChildNamed("Option1");
	g_pTextEntryField = (CIwUITextField*)g_pDialog->GetChildNamed("TextEntryField");
	
	g_pDialog->SetVisible(false);
	IwGetUIView()->AddElement(g_pDialog);
	IwGetUIView()->AddElementToLayout(g_pDialog);
	g_textinput.CreateSoftKeyboard();
	//g_textinput.SetEditorMode(CIwUITextInput::EDITOR_KEYBOARD);
	g_textinput.SetEditorMode(CIwUITextInput::EDITOR_OS);
}

TextEntryBox::~TextEntryBox(void)
{
	//