void CLuaWidget::CoreSetTitle()
{
    if (!GetTitle().empty())
    {
        const char *tr = GetTranslation(GetTitle().c_str());
        gchar *t = g_markup_escape_text(tr, strlen(tr)); // glib BUG?: -1 doesn't work as auto size
        const char *markup = t;
        
        // Update style
        if (LabelBold())
            markup = CreateText("<b>%s</b>", markup);
        
        if (LabelItalic())
            markup = CreateText("<i>%s</i>", markup);
        
        // Update size
        switch (LabelSize())
        {
            case LABEL_SMALL: markup = CreateText("<small>%s</small>", markup); break;
            case LABEL_BIG: markup = CreateText("<big>%s</big>", markup); break;
            default: break; // Go away warning
        }
        
        gtk_label_set_markup(GTK_LABEL(m_pTitle), markup);
        g_free(t);

        SetMaxWidth(m_iMaxWidth); // Need to update this with new text
        gtk_widget_show(m_pTitle);
        UpdateScreenLayout();
    }
}
void CLuaDepScreen::CoreUpdateList()
{
    if (!Enabled())
    {
        Enable(true);
        NNCurses::TUI.ActivateGroup(this);
    }
        
    m_pTextField->ClearText();
    
    for (TDepList::const_iterator it=GetDepList().begin(); it!=GetDepList().end(); it++)
    {
        m_pTextField->AddText(CreateText("%s: %s\n", GetTranslation("Name"),
                              GetTranslation(it->name).c_str()));
                              
        if (!it->description.empty())
            m_pTextField->AddText(CreateText("%s: %s\n", GetTranslation("Description"),
                                  GetTranslation(it->description).c_str()));
                                  
        m_pTextField->AddText(CreateText("%s: %s\n\n", GetTranslation("Problem"),
                              GetTranslation(it->problem).c_str()));
    }
    
    if (GetDepList().empty())
        m_bClose = true;
}
bool CLuaCFGMenu::CoreHandleEvent(NNCurses::CWidget *emitter, int event)
{
    if (CLuaWidget::CoreHandleEvent(emitter, event))
        return true;
    
    if (m_pMenu->Empty())
        return false;

    if (emitter == m_pMenu)
    {
        if (event == EVENT_DATACHANGED)
        {
            UpdateDesc();
            return true;
        }
        else if (event == EVENT_CALLBACK)
        {
            SEntry *entry = GetCurEntry();
            std::string item = m_pMenu->Value();
    
            if (entry)
            {
                switch (entry->type)
                {
                    case TYPE_STRING:
                    {
                        std::string ret = NNCurses::InputBox(CreateText(GetTranslation("Please enter a new value for %s"),
                                                             GetTranslation(item.c_str())), entry->val);
                        if (!ret.empty())
                            entry->val = ret;
                        break;
                    }
                    case TYPE_DIR:
                    {
                        std::string ret = NNCurses::DirectoryBox(CreateText(GetTranslation("Please choose a new value for %s"),
                                                             GetTranslation(item.c_str())), entry->val);
                        if (!ret.empty())
                            entry->val = ret;
                        break;
                    }
                    case TYPE_LIST:
                    case TYPE_BOOL:
                        ShowChoiceMenu();
                        break;
                }
                
                LuaDataChanged();
                return true;
            }
        }
    }
    
    return false;
}
Beispiel #4
0
// initialize initializes the general display design coordinator, creates the 
// primitive sets, textures, objects, lights, sounds, cameras, and text items
//
void Design::initialize() {

       // general display design
    //
   Reflectivity redish = Reflectivity(red);
   Reflectivity greenish = Reflectivity(green);
   Reflectivity bluish = Reflectivity(blue);
   Reflectivity whitish = Reflectivity(white);
   setProjection(0.9f, 1.0f, 1000.0f);
   setAmbientLight(1, 1, 1);
   // camera at a distance - in lhs coordinates
    // camera at a distance - in lhs coordinates
   iCamera* camera = CreateCamera();
   camera->translate(0, 190,-500);
   camera->setRadius(17.8f);
   
    lastUpdate = now;	

    hud = CreateHUD(0.72f, 0.01f, 0.27f, 0.99f, CreateTexture(HUD_IMAGE));
    // cameras ----------------------------------------------------------------

   velocitytxt_=CreateText(Rectf(0.05f,0.27f,0.95f,0.37f),hud,L"",TEXT_HEIGHT,TEXT_TYPEFACE,TEXT_LEFT);
   deltatxt_=CreateText(Rectf(0.05f,0.17f,0.95f,0.27f),hud,L"",TEXT_HEIGHT,TEXT_TYPEFACE,TEXT_LEFT);
   positiontxt_=CreateText(Rectf(0.05f,0.38f,0.95f,0.48f),hud,L"",TEXT_HEIGHT,TEXT_TYPEFACE,TEXT_LEFT);

   lasttextupdate=now;

   // game ----------------------------------------------------------------------
   setBackground(CreateTexture(L"farm.png"));
   catcher = CreatePhysicsBox(-40, -5, 0, 40, 5, 0, &bluish, 1, PHYS_Floating, true);
   iAPIWindow* win = getWindow();
   catcher->translate(0, -70, 0);

   truck = CreatePhysicsBox(-100, -2, 0, 100, 2, 0, &redish, 1, PHYS_Floating, true);
   truck->translate(300, -50, 0);

   Reflectivity yellowish = Reflectivity(yellow);

   iPhysics* fallingBox = CreatePhysicsBox(-10, -10, -10, 10, 10, 10, &yellowish, 1, PHYS_Falling, true);
   fallingBox->translate(-350, 350, 0);
   fallingBox->setVelocity(Vector(5, 20, 0));
   fallingBox->addBodyForce(Vector(0, -10, 0));
   fallingBox->setCollision(CreateCSphere(fallingBox, 5));
   objects.insert(objects.end(), fallingBox);

   wchar_t str[MAX_DESC + 1];
   StringCbPrintfW(str, MAX_DESC, L"Score: 0");
   velocitytxt_->set(str);

   StringCbPrintfW(str, MAX_DESC, L"Life left: 5"); 
   deltatxt_->set(str);
}
bool FinishInstall()
{
    char *file = CreateText("%s/config/finish", InstallInfo.own_dir.c_str());
    if (FileExists(file))
    {
        char *title = CreateText("<C></B/29>%s<!29!B>", GetTranslation("Please read the following text"));
        char *buttons[1] = { GetTranslation("OK") };
        ViewFile(file, buttons, 1, title);
        return true;
    }
    
    return true;
}
void CInstaller::CoreUpdateLanguage(void)
{
    CBaseInstall::CoreUpdateLanguage();
    CFLTKBase::CoreUpdateLanguage();

    CInstallScreen *screen = GetScreen(m_pWizard->value());
    if (screen)
        SetTitle(GetTranslation(screen->GetTitle()));
    
    m_pAboutBox->label(GetTranslation("About"));
    m_pCancelButton->label(GetTranslation("Cancel"));
    m_pBackButton->label(CreateText("@<-    %s", GetTranslation("Back")));
    m_pNextButton->label(CreateText("%s    @->", GetTranslation("Next")));
}
void CInstaller::UpdateButtons(void)
{
    CInstallScreen *curscreen = GetScreen(m_pWizard->value());
    
    if (FirstValidScreen() && !curscreen->HasPrevWidgets())
        m_pBackButton->deactivate();
    else if (!m_bPrevButtonLocked)
        m_pBackButton->activate();
    
    if (LastValidScreen() && !curscreen->HasNextWidgets())
        m_pNextButton->label(CreateText("%s    @->|", GetTranslation("Finish")));
    else
        m_pNextButton->label(CreateText("%s    @->", GetTranslation("Next")));
}
Beispiel #8
0
Weapon* CreateWeapon(char* weaponName, char* weaponTexture, int weaponType, int weaponRarity, int collisionGroup, float width, float height)
{
	Weapon *CurrentWeapon = AddWeapon();
	Vec3 TextTint;
	int nameLen, statsLen;
	Vec3Set(&TextTint, 0, 0, 0);
	CurrentWeapon->WeaponFOF = PlayerWeapon; // Friend or Foe tag
	CurrentWeapon->objID = GetObjectID();
	CurrentWeapon->WeaponRarity = weaponRarity;
	CurrentWeapon->WeaponType = weaponType;
	CurrentWeapon->WeaponName = (char *) CallocMyAlloc(MAX_NAME_LENGTH, sizeof(char));
	CurrentWeapon->WeaponStatsString = (char *) CallocMyAlloc(MAX_NAME_LENGTH, sizeof(char));
	
	SetWeaponStats(CurrentWeapon, 0, 0, 0);
	if(CurrentWeapon->WeaponName)
		strcpy(CurrentWeapon->WeaponName, weaponName);
	else
		CurrentWeapon->WeaponName = "Error: Memory Allocation Failed!";

	CurrentWeapon->WeaponGlyphs = CreateText(CurrentWeapon->WeaponName, CurrentWeapon->WeaponPickup.Position.x, CurrentWeapon->WeaponPickup.Position.y + CurrentWeapon->WeaponPickup.height * 1.5f + 25, 50, TextTint, Center, Plain);
	CreateStatsString(CurrentWeapon->WeaponStatsString, CurrentWeapon->BonusStrength, CurrentWeapon->BonusAgility, CurrentWeapon->BonusDefense);
	CurrentWeapon->WeaponStatsGlyphs = CreateText(CurrentWeapon->WeaponStatsString, CurrentWeapon->WeaponPickup.Position.x, (CurrentWeapon->WeaponPickup.Position.y + CurrentWeapon->WeaponPickup.height * 1.5f - 25), 50, TextTint, Center, Plain);
	
	ChangeTextZIndex(CurrentWeapon->WeaponGlyphs, 451);
	ChangeTextZIndex(CurrentWeapon->WeaponStatsGlyphs, 451);

	CurrentWeapon->WeaponSprite = (Sprite *) CreateSprite(weaponTexture, 256, 256, 22, 1, 1, 0, 0);
	CreateCollisionBox(&CurrentWeapon->WeaponPickup, &CurrentWeapon->Position, WeaponDrop, width / 2, height, CurrentWeapon->objID);
	CreateCollisionBox(&CurrentWeapon->WeaponAttack, &CurrentWeapon->Position, collisionGroup, height / 4, height / 4, CurrentWeapon->objID);
	CurrentWeapon->WeaponLength = 80.0f;

	nameLen = strlen(CurrentWeapon->WeaponName);
	statsLen = strlen(CurrentWeapon->WeaponStatsString);
	if(nameLen >= statsLen)
	{
		CurrentWeapon->WeaponHoverBackground = (Sprite *) CreateSprite("TextureFiles/WeaponHoverBackground.png", nameLen * 25.0f, 180, 450, 1, 1, CurrentWeapon->WeaponPickup.Position.x, (CurrentWeapon->WeaponPickup.Position.y + CurrentWeapon->WeaponPickup.height * 1.5f - 2 * CurrentWeapon->WeaponGlyphs->Glyph->Height));
	}
	else
	{
		CurrentWeapon->WeaponHoverBackground = (Sprite *) CreateSprite("TextureFiles/WeaponHoverBackground.png", statsLen * 25.0f, 180, 450, 1, 1, CurrentWeapon->WeaponPickup.Position.x, (CurrentWeapon->WeaponPickup.Position.y + CurrentWeapon->WeaponPickup.height * 1.5f - 2 * CurrentWeapon->WeaponGlyphs->Glyph->Height));
	}
	CurrentWeapon->WeaponHoverBackground->Visible = FALSE;

	//Start off shopless
	CurrentWeapon->CurrentShop = NULL;
	CurrentWeapon->WeaponFalling = FALSE;

	return CurrentWeapon;
}
Beispiel #9
0
void GSNewOrContinue::OnActive()
{
  GSText::OnActive();

  CreateText("");

  m_gui = WWLoadGui("gui-neworcontinue.txt");
  Assert(m_gui);

  // TODO Set focus element, cancel element, command handlers
  GuiButton* cont = (GuiButton*)m_gui->GetElementByName("continue-button");
  cont->SetCommand(OnContinue);
  cont->SetIsFocusButton(true);
  cont->SetShowIfFocus(true);

  m_gui->GetElementByName("more-button")->SetCommand(OnMore);
  m_gui->GetElementByName("hiscores-button")->SetCommand(OnHiScores);
  m_gui->GetElementByName("back-button")->SetCommand(OnBack);

  TheSoundManager::Instance()->PlaySong("sound/piano.it");

  // If no continue info, go directly to new game.
  GameConfigFile* gcf = TheGameConfigFile::Instance();
  if (!gcf->Exists(CONTINUE_LEVEL_KEY))
  {
    // New game
    TheLevelManager::Instance()->SetLevelId(1);
    GameConfigFile* gcf = TheGameConfigFile::Instance();
    gcf->SetInt(CONTINUE_LEVEL_KEY, 1);
    StartGame(1, AMJU_MAIN_GAME_MODE);

    return;
  }
}
void CLuaCFGMenu::ShowChoiceMenu()
{
    SEntry *entry = GetCurEntry();
    std::string item = m_pMenu->Value();
    NNCurses::TColorPair fc(COLOR_GREEN, COLOR_BLUE), dfc(COLOR_WHITE, COLOR_BLUE);
    const char *msg = CreateText(GetTranslation("Please choose a new value for %s"), GetTranslation(item.c_str()));
    NNCurses::CDialog *dialog = NNCurses::CreateBaseDialog(fc, dfc, 20, 0, msg);
    
    NNCurses::CMenu *menu = new NNCurses::CMenu(15, 8);
    
    for (TOptionsType::const_iterator it=entry->options.begin(); it!=entry->options.end(); it++)
        menu->AddEntry(*it, GetTranslation(*it));
    
    if (!entry->val.empty())
        menu->Select(entry->val);
    
    dialog->AddWidget(menu);
    
    dialog->AddButton(new NNCurses::CButton(GetTranslation("OK")), true, false);
    
    NNCurses::CButton *cancelbutton = new NNCurses::CButton(GetTranslation("Cancel"));
    dialog->AddButton(cancelbutton, true, false);
    
    NNCurses::TUI.AddGroup(dialog, true);
    
    while (dialog->Run())
        ;
    
    if (dialog->ActivatedWidget() != cancelbutton)
        entry->val = menu->Value();
    
    delete dialog;
}
void CKSSplashScreenPane::Init()
{
	// Create the main pane
	mpPane = ge::IPane::Create();
//	mpPane->SetSize(ge::SSize(100, 100));

	// Backdrop
	CreateBitmap(ge::IControl::giNoID, IDB_Back_Splash_Screen, ge::SPos(0, 0));
	
	/*
	char psz[128] = "hello world";
	//sprintf(psz, "%d", iNumber);
	*/
	ge::IText* pText;
	
	pText = CreateText(		giControlIDSplashText, 
							ge::SPos(200, 311), 
							ge::SSize(220, 16), 
							CreateFont(Generic128, IDF_Fuxley_712, ge::SRGB(230, 230, 230)), 
							"Setting Up Windows...", 
							ge::IText::HorzAlignCenter, 
							ge::IText::VertAlignCenter);
	
		
}
void CUninstallWindow::AddOutput(const std::string &file)
{
    m_pBuffer->append(CreateText("Removing %s\n", file.c_str()));
    // Move cursor to last line and last word
    m_pDisplay->scroll(m_pBuffer->length(), m_pDisplay->word_end(m_pBuffer->length()));
    Fl::wait(0.0); // Update screen
}
void CFLTKDirDialog::MKDirCB(Fl_Widget *w, void *p)
{
    CFLTKDirDialog *dialog = static_cast<CFLTKDirDialog *>(p);
    const char *newdir = fl_input(GetTranslation("Enter name of new directory"));
        
    if (!newdir || !newdir[0])
        return;
        
    newdir = CreateText("%s/%s", dialog->m_pDirChooser->directory(), newdir);
    
    try
    {
        if (MKDirNeedsRoot(newdir))
        {
            LIBSU::CLibSU suhandler;
            const char *passwd = dialog->AskPassword(suhandler);
            MKDirRecRoot(newdir, suhandler, passwd);
        }
        else
            MKDirRec(newdir);
            
        dialog->m_pDirChooser->directory(newdir);
    }
    catch(Exceptions::CExIO &e)
    {
        fl_alert(e.what());
    }
}
Beispiel #14
0
void TextCtrlTestCase::ReadOnly()
{
#if wxUSE_UIACTIONSIMULATOR
    // we need a read only control for this test so recreate it
    delete m_text;
    CreateText(wxTE_READONLY);

    EventCounter updated(m_text, wxEVT_TEXT);

    m_text->SetFocus();

    wxUIActionSimulator sim;
    sim.Text("abcdef");
    wxYield();

    CPPUNIT_ASSERT_EQUAL("", m_text->GetValue());
    CPPUNIT_ASSERT_EQUAL(0, updated.GetCount());

    // SetEditable() is supposed to override wxTE_READONLY
    m_text->SetEditable(true);
    
#ifdef __WXOSX__
    // a ready only text field might not have been focusable at all
    m_text->SetFocus();
#endif

    sim.Text("abcdef");
    wxYield();

    CPPUNIT_ASSERT_EQUAL("abcdef", m_text->GetValue());
    CPPUNIT_ASSERT_EQUAL(6, updated.GetCount());
#endif
}
Beispiel #15
0
void TextCtrlTestCase::ProcessEnter()
{
#if wxUSE_UIACTIONSIMULATOR
    wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
                                          wxTestableFrame);

    EventCounter count(m_text, wxEVT_TEXT_ENTER);

    m_text->SetFocus();

    wxUIActionSimulator sim;
    sim.Char(WXK_RETURN);
    wxYield();

    CPPUNIT_ASSERT_EQUAL(0, frame->GetEventCount(wxEVT_TEXT_ENTER));

    // we need a text control with wxTE_PROCESS_ENTER for this test
    delete m_text;
    CreateText(wxTE_PROCESS_ENTER);

    m_text->SetFocus();

    sim.Char(WXK_RETURN);
    wxYield();

    CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_TEXT_ENTER));
#endif
}
int main(int argc, char *argv[])
{
    if (!MainInit(argc, argv))
    {
        printf("Error: %s\n", GetTranslation("Init failed, aborting"));
        return 1;
    }
    
    // Init
    if (!(MainWin = initscr())) throwerror(false, "Could not init ncurses");
    if (!(CDKScreen = initCDKScreen(MainWin))) throwerror(false, "Could not init CDK");
    initCDKColor();

    if ((InstallInfo.dest_dir_type == DEST_DEFAULT) && !ReadAccess(InstallInfo.dest_dir))
        throwerror(true, CreateText("This installer will install files to the following directory:\n%s\n"
                                    "However you don't have read permissions to this directory\n"
                                    "Please restart the installer as a user who does or as the root user",
                                    InstallInfo.dest_dir.c_str()));
    
    int i=0;
    while(Functions[i])
    {
        if (Functions[i]()) i++;
        else
        {
            if (YesNoBox(GetTranslation("This will abort the installation\nAre you sure?")))
                break;
        }
    }

    EndProg();
    return 0;
}
void CPlugin_Toolbar::Init()
{
    // Create the main pane
    mpPane = ge::IPane::Create();
    mpPane->SetSize(ge::SSize(397,24));
    mpPane->SetBackgroundColour(ge::SRGB(0, 0, 0));

    // Top label
    CreateBitmap(ge::IControl::giNoID, IDB_Back_Plugin_Toolbar, ge::SPos(0, 0));
    ge::IBitmap*  pBmp = CreateBitmap(ge::IControl::giNoID, IDB_Back_Toolbar_Right, ge::SPos(397, 0));
    pBmp->SetAutomaticResize(true, ge::IControl::ResizeAbsoluteX);
    //

    mpText = CreateText(ge::IControl::giNoID, ge::SPos(78, 9), ge::SSize(200, 12),
                        CreateFont(Generic128, IDB_Font_Axel_Tight, ge::SRGB(0, 255, 0)),
                        "");


    //-------------------------------
    // AB

    /*	ge::IRadioButtons* pABRadioButton = CreateRadioButtonsGroup(ge::IControl::giNoID, ge::SPos(0, 0));*/

    tint32 iX	=	4;
    Create2StateButton(giControlBypass, IDB_Button_Power, ge::SPos(4, 4), true);
    iX += 73;
    /*	CreateButton(ge::IControl::giNoID, IDB_Button_AB, ge::SPos(iX,4), false);				iX += 35;
    	CreateButton(ge::IControl::giNoID, IDB_Button_BA, ge::SPos(iX,4), false);				iX += 34;
    	CreateRadioButton(ge::IControl::giNoID, IDB_Button_A, ge::SPos(iX, 4), pABRadioButton, true);	iX	+= 18;
    	CreateRadioButton(ge::IControl::giNoID, IDB_Button_B, ge::SPos(iX, 4), pABRadioButton, true);	iX	+= 17;*/
}
Beispiel #18
0
int main(int argc, char *argv[])
{
	parent_t		*window;
	gui_text_data_t	txtdata;
	gui_text_t		*text;

	//load libGUI library
	LoadLibGUI(NULL);//load from default system path to library
	//create main window
	window=CreateWindow();
	//change size of window
	SetWindowSizeRequest(window,92,46);
	//set callback function for button close window
	SetCallbackFunction(window,DELETE_EVENT,&callback_func_delete_window,NULL);
	//create control text
	txtdata.x=5;
	txtdata.y=5;
	txtdata.font=NULL;//use default system libGUI font
	txtdata.background=TRUE;//use background for text
	txtdata.color=0xffffff;//text color
	txtdata.background_color=0xff8000;//background color
	txtdata.text="Hello world!";
	text=CreateText(&txtdata);
	
	//pack control text in window
	PackControls(window,text);

	//start libGUI main loop
	LibGUImain(window);
}
bool CUninstallWindow::Start(app_entry_s *pApp)
{
    if (!fl_choice(CreateText(GetTranslation("This will remove %s from your computer\nContinue?"),
         pApp->name.c_str()), GetTranslation("No"), GetTranslation("Yes"), NULL))
        return false;
    
    bool checksums = false;
    if (!m_pOwner->CheckSums(pApp->name.c_str()))
    {
        int ret = fl_choice(GetTranslation("Some files have been modified after installation.\n"
                "This can happen if you installed another package which uses one or\n"
                "more files with the same name or you installed another version."),
                GetTranslation("Cancel"), GetTranslation("Continue anyway"),
                GetTranslation("Only remove unchanged"));
        if (ret == 0)
            return false;
        
        checksums = (ret == 2);
    }
    
    // Clear previous contents
    m_pBuffer->select(0, m_pBuffer->length());
    m_pBuffer->remove_selection();
    
    m_pProgress->value(0);
    
    m_pWindow->show();
    
    m_pOwner->Uninstall(pApp, checksums);
    
    m_pProgress->value(100);
    m_pOKButton->activate();
    return true;
}
Beispiel #20
0
void TextCtrlTestCase::LongText()
{
    delete m_text;
    CreateText(wxTE_MULTILINE|wxTE_DONTWRAP);

    const int numLines = 1000;
    const int lenPattern = 100;
    int i;

    // Pattern for the line.
    wxChar linePattern[lenPattern+1];
    for (i = 0; i < lenPattern - 1; i++)
    {
        linePattern[i] = wxChar('0' + i % 10);
    }
    linePattern[WXSIZEOF(linePattern) - 1] = wxChar('\0');

    // Fill the control.
    m_text->SetMaxLength(15000);
    for (i = 0; i < numLines; i++)
    {
        m_text->AppendText(wxString::Format(wxT("[%3d] %s\n"), i, linePattern));
    }

    // Check the content.
    for (i = 0; i < numLines; i++)
    {
        wxString pattern = wxString::Format(wxT("[%3d] %s"), i, linePattern);
        wxString line = m_text->GetLineText(i);
        CPPUNIT_ASSERT_EQUAL( line, pattern );
    }
}
bool ShowWelcome()
{
    char *title = CreateText("<C></B/29>%s<!29!B>", GetTranslation("Welcome"));
    char filename[] = "config/welcome";
    char *buttons[2] = { GetTranslation("OK"), GetTranslation("Cancel") };
    int ret = ViewFile(filename, buttons, 2, title);
    return (ret==NO_FILE || ret==0);
}
Beispiel #22
0
// Helpers for GUI (Creating ribbon elements to edit props)
void CNodePropertyUI::CreateUI()
{
	// mHasUI = true;
	DestroyUI();
	if (mTargetNode)
	{
		mNameCtrl = CreateText("Name");
		mNameCtrl->SetValue(mTargetNode->GetName().c_str());
		mCtrlList.clear();
		for (TPropTable::iterator iter = mTargetNode->mPropTable.begin();
			iter != mTargetNode->mPropTable.end(); iter++)
		{
			if ((*iter).mType == std::string("T"))
			{
				wxTextCtrl* control = CreateText((*iter).mName);
				control->SetValue((*iter).mValue);
				
				TControlPair tCtrlPair;
				tCtrlPair.first = (*iter).mName;
				tCtrlPair.second = control;
				mCtrlList.push_back(tCtrlPair);
			}
			else if ((*iter).mType == std::string("D"))
			{
				// UNIMPLEMENTED!!!!!!!!!
				//wxTextCtrl* control = CreateText((*iter).mName);
				//control->SetValue((*iter).mValue);
			}
			else if ((*iter).mType == std::string("C"))
			{
				wxCheckBox* control = CreateCheckBox((*iter).mName);
				if ((*iter).mValue == std::string("T"))
					control->SetValue(true);
				else
					control->SetValue(false);

				TControlPair tCtrlPair;
				tCtrlPair.first = (*iter).mName;
				tCtrlPair.second = control;
				mCtrlList.push_back(tCtrlPair);
			}
		}
	}
	gEnv->MainFrame->mPropertyPage->Realize();
}
bool ShowLicense()
{
    char *title = CreateText("<C></B/29>%s<!29!B>", GetTranslation("License agreement"));
    char filename[] = "config/license";
    char *buttons[2] = { GetTranslation("Agree"), GetTranslation("Decline") };
    
    int ret = ViewFile(filename, buttons, 2, title);
    return (ret==NO_FILE || ret==0);
}
Beispiel #24
0
void TextCtrlTestCase::Style()
{
#ifndef __WXOSX__
    delete m_text;
    // We need wxTE_RICH under windows for style support
    CreateText(wxTE_RICH);

    // Red text on a white background
    m_text->SetDefaultStyle(wxTextAttr(*wxRED, *wxWHITE));

    CPPUNIT_ASSERT_EQUAL(m_text->GetDefaultStyle().GetTextColour(), *wxRED);
    CPPUNIT_ASSERT_EQUAL(m_text->GetDefaultStyle().GetBackgroundColour(),
                         *wxWHITE);

    m_text->AppendText("red on white ");

    // Red text on a grey background
    m_text->SetDefaultStyle(wxTextAttr(wxNullColour, *wxLIGHT_GREY));

    CPPUNIT_ASSERT_EQUAL(m_text->GetDefaultStyle().GetTextColour(), *wxRED);
    CPPUNIT_ASSERT_EQUAL(m_text->GetDefaultStyle().GetBackgroundColour(),
                         *wxLIGHT_GREY);

    m_text->AppendText("red on grey ");

    // Blue text on a grey background
    m_text->SetDefaultStyle(wxTextAttr(*wxBLUE));


    CPPUNIT_ASSERT_EQUAL(m_text->GetDefaultStyle().GetTextColour(), *wxBLUE);
    CPPUNIT_ASSERT_EQUAL(m_text->GetDefaultStyle().GetBackgroundColour(),
                         *wxLIGHT_GREY);

    m_text->AppendText("blue on grey");

    // Get getting the style at a specific location
    wxTextAttr style;

    // We have to check that styles are supported
    if(m_text->GetStyle(3, style))
    {
        CPPUNIT_ASSERT_EQUAL(style.GetTextColour(), *wxRED);
        CPPUNIT_ASSERT_EQUAL(style.GetBackgroundColour(), *wxWHITE);
    }

    // And then setting the style
    if(m_text->SetStyle(15, 18, style))
    {
        m_text->GetStyle(17, style);

        CPPUNIT_ASSERT_EQUAL(style.GetTextColour(), *wxRED);
        CPPUNIT_ASSERT_EQUAL(style.GetBackgroundColour(), *wxWHITE);
    }
#endif
}
Beispiel #25
0
void TextCtrlTestCase::FontStyle()
{
    // We need wxTE_RICH under MSW and wxTE_MULTILINE under GTK for style
    // support so recreate the control with these styles.
    delete m_text;
    CreateText(wxTE_RICH);

    // Check that we get back the same font from GetStyle() after setting it
    // with SetDefaultStyle().
    wxFont fontIn(14,
                  wxFONTFAMILY_DEFAULT,
                  wxFONTSTYLE_NORMAL,
                  wxFONTWEIGHT_NORMAL);
    wxTextAttr attrIn;
    attrIn.SetFont(fontIn);
    if ( !m_text->SetDefaultStyle(attrIn) )
    {
        // Skip the test if the styles are not supported.
        return;
    }

    m_text->AppendText("Default font size 14");

    wxTextAttr attrOut;
    m_text->GetStyle(5, attrOut);

    CPPUNIT_ASSERT( attrOut.HasFont() );

    wxFont fontOut = attrOut.GetFont();
#ifdef __WXMSW__
    // Under MSW we get back an encoding in the font even though we hadn't
    // specified it originally. It's not really a problem but we need this hack
    // to prevent the assert below from failing because of it.
    fontOut.SetEncoding(fontIn.GetEncoding());
#endif
    CPPUNIT_ASSERT_EQUAL( fontIn, fontOut );


    // Also check the same for SetStyle().
    fontIn.SetPointSize(10);
    fontIn.SetWeight(wxFONTWEIGHT_BOLD);
    attrIn.SetFont(fontIn);
    m_text->SetStyle(0, 6, attrIn);

    m_text->GetStyle(4, attrOut);
    CPPUNIT_ASSERT( attrOut.HasFont() );

    fontOut = attrOut.GetFont();
#ifdef __WXMSW__
    fontOut.SetEncoding(fontIn.GetEncoding());
#endif
    CPPUNIT_ASSERT_EQUAL( fontIn, fontOut );
}
Beispiel #26
0
void MyGame::Start(){
    // Execute System class startup
    GameSystem::Start();
    
    // Create the message
    CreateText();
    
    // Finally subscribe to the update event. Note that by subscribing events at this point we have already missed some events
    // like the ScreenMode event sent by the Graphics subsystem when opening the application window. To catch those as well we
    // could subscribe in the constructor instead.
    SubscribeToEvents();
}
LRESULT CALLBACK WinProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam){
	PAINTSTRUCT	ps;
	HDC			hdc;
	HFONT       hf;

	switch(msg) {
		case WM_CREATE: {
			static_label1 = CreateWindow("Static", "Click the button -->", WS_CHILD | WS_VISIBLE ,60,30,125,18,hwnd,0, g_hInst,0);
			input_text1   = CreateWindow("Edit",  NULL, WS_BORDER | NULL | WS_CHILD | WS_VISIBLE | NULL | NULL ,35,75,175,20,hwnd,(HMENU)ID_EDIT,g_hInst,0);
            input_text2   = CreateWindow("Edit",  NULL,WS_BORDER | NULL | WS_CHILD | WS_VISIBLE | NULL | NULL ,35,105,175,20,hwnd,(HMENU)ID_EDIT,g_hInst,0);
			button0       = CreateWindow("Button","0",BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE ,220,75,25,50,hwnd,(HMENU)ID_BUTTON0,g_hInst,0);
			button1       = CreateWindow("Button","Rand Advice",BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE ,200,30,100,18,hwnd,(HMENU)ID_BUTTON1,g_hInst,0);
		}break;
		case WM_PAINT: {

			HFONT hFont;
			RECT rect;
            LPCSTR a = ("Get a free advice");

            hdc = BeginPaint(hwnd, &ps);
                CreateText(hdc, hFont, rect, a, 20, 15, 100, 50, 0, RGB(123,123,123));
			EndPaint(hwnd, &ps);
        }break;
		case WM_COMMAND: //Command from Child windows and menus are under this message
            switch(wParam) {
                case ID_BUTTON0: {
						SetWindowText(input_text1,"SEE YA");
						SetWindowText(input_text2, "ON NEXT LAB");
						break;
					}
				case ID_BUTTON1:  {
                        int v1 = rand() % 7;
                        switch(v1) {
                            case 0:{SetWindowText(static_label1, "Be patient");}break;
                            case 1:{SetWindowText(static_label1, "Be perseverent");}break;
                            case 2:{SetWindowText(static_label1, "Listen to others");}break;
                            case 3:{SetWindowText(static_label1, "Do your best");}break;
                            case 4:{SetWindowText(static_label1, "Give free Hugs");}break;
                            case 5:{SetWindowText(static_label1, "Love your family");}break;
                            case 6:{SetWindowText(static_label1, "Never stop");}break;
                        }
						break;
					}
				}//switch.
			break;
		case WM_DESTROY:
			PostQuitMessage(0);
			break; // pass to DefWindowProc(...) as well
		case WM_CLOSE:
			DestroyWindow(hwnd);
			break;
	}return DefWindowProc(hwnd, msg, wParam, lParam);}
Beispiel #28
0
void LoadFile(const char *name)
{
    if (luaL_dofile(LuaState, name))
    {
        const char *errmsg = lua_tostring(LuaState, -1);
        if (!errmsg)
            errmsg = "Unknown error!";
        else if (!strcmp(errmsg, "CExUser"))
            throw Exceptions::CExUser();

        throw Exceptions::CExLua(CreateText("While parsing %s: %s\n", name, errmsg));
    }
}
CXFA_Node* CXFA_FFWidgetHandler::CreateWidgetFormItem(
    XFA_WIDGETTYPE eType,
    CXFA_Node* pParent,
    CXFA_Node* pBefore) const {
  switch (eType) {
    case XFA_WIDGETTYPE_Barcode:
      return NULL;
    case XFA_WIDGETTYPE_PushButton:
      return CreatePushButton(pParent, pBefore);
    case XFA_WIDGETTYPE_CheckButton:
      return CreateCheckButton(pParent, pBefore);
    case XFA_WIDGETTYPE_ExcludeGroup:
      return CreateExclGroup(pParent, pBefore);
    case XFA_WIDGETTYPE_RadioButton:
      return CreateRadioButton(pParent, pBefore);
    case XFA_WIDGETTYPE_Arc:
      return CreateArc(pParent, pBefore);
    case XFA_WIDGETTYPE_Rectangle:
      return CreateRectangle(pParent, pBefore);
    case XFA_WIDGETTYPE_Image:
      return CreateImage(pParent, pBefore);
    case XFA_WIDGETTYPE_Line:
      return CreateLine(pParent, pBefore);
    case XFA_WIDGETTYPE_Text:
      return CreateText(pParent, pBefore);
    case XFA_WIDGETTYPE_DatetimeEdit:
      return CreateDatetimeEdit(pParent, pBefore);
    case XFA_WIDGETTYPE_DecimalField:
      return CreateDecimalField(pParent, pBefore);
    case XFA_WIDGETTYPE_NumericField:
      return CreateNumericField(pParent, pBefore);
    case XFA_WIDGETTYPE_Signature:
      return CreateSignature(pParent, pBefore);
    case XFA_WIDGETTYPE_TextEdit:
      return CreateTextEdit(pParent, pBefore);
    case XFA_WIDGETTYPE_DropdownList:
      return CreateDropdownList(pParent, pBefore);
    case XFA_WIDGETTYPE_ListBox:
      return CreateListBox(pParent, pBefore);
    case XFA_WIDGETTYPE_ImageField:
      return CreateImageField(pParent, pBefore);
    case XFA_WIDGETTYPE_PasswordEdit:
      return CreatePasswordEdit(pParent, pBefore);
    case XFA_WIDGETTYPE_Subform:
      return CreateSubform(pParent, pBefore);
    default:
      break;
  }
  return NULL;
}
Beispiel #30
0
//GMOK: enables and sets the text report of current value
//GMOK: (progress bar)
void  HUDTexture::enableReport(bool b)
{
	showText = b;

	if (showText)
	{
		if (rCValue)
			delete rCValue;
		else
			rCValue = NULL;

		rCValue = CreateText(tlx, tly, brx, 1.0f, TXT_CENTER, L"ProgressValue");
	}
}