コード例 #1
0
ファイル: FileManager.cpp プロジェクト: ADVALAIN596/PanelDue
	// Refresh the list of files or macros in the Files popup window
	void FileSet::RefreshPopup()
	{
		if (which >= 0)
		{
			FileListIndex& fileIndex = fileIndices[which];
		
			// 1. Sort the file list
			fileIndex.sort(StringGreaterThan);
		
			// 2. Make sure the scroll position is still sensible
			if (scrollOffset < 0)
			{
				scrollOffset = 0;
			}
			else if ((unsigned int)scrollOffset >= fileIndex.size())
			{
				scrollOffset = ((fileIndex.size() - 1)/numFileRows) * numFileRows;
			}
		
			// 3. Display the scroll buttons if needed
			mgr.Show(scrollFilesLeftButton, scrollOffset != 0);
			mgr.Show(scrollFilesRightButton, scrollOffset + (numFileRows * numFileColumns) < fileIndex.size());
			mgr.Show(filesUpButton, IsInSubdir());
		
			// 4. Display the file list
			for (size_t i = 0; i < numDisplayedFiles; ++i)
			{
				TextButton *f = filenameButtons[i];
				if (i + scrollOffset < fileIndex.size())
				{
					const char *text = fileIndex[i + scrollOffset];
					f->SetText(text);
					f->SetEvent(fileEvent, text);
					mgr.Show(f, true);
				}
				else
				{
					f->SetText("");
					mgr.Show(f, false);
				}
			}
			displayedFileSet = this;
		}
		else
		{
			mgr.Show(scrollFilesLeftButton, false);
			mgr.Show(scrollFilesRightButton, false);
			for (size_t i = 0; i < numDisplayedFiles; ++i)
			{
				mgr.Show(filenameButtons[i], false);
			}
		}
	}
コード例 #2
0
ファイル: Button.cpp プロジェクト: Asqwel/TZOD-Modified
TextButton* TextButton::Create(Window *parent, float x, float y, const string_t &text, const char *font)
{
	TextButton *res = new TextButton(parent);
	res->Move(x, y);
	res->SetText(text);
	res->SetFont(font);
	return res;
}
コード例 #3
0
ファイル: main.cpp プロジェクト: Rachels-Courses/CPP-Course
int main()
{
    Label label;
    label.SetText( "This is a label" );

    Button button;
    button.SetDimensions( 10, 5 );

    TextButton textButton;
    textButton.SetText( "Click Me" );
    textButton.SetDimensions( 10, 5 );

    cout << endl << endl << "LABEL" << endl;
    label.Draw();

    cout << endl << endl << "BUTTON" << endl;
    button.Draw();

    cout << endl << endl << "TEXT BUTTON" << endl;
    textButton.Draw();

    return 0;
}