Last active
December 12, 2020 18:23
-
-
Save anaselli/1ea412a4a6283b1d121fee7985f3ac0d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// g++ -I/usr/include/yui -lyui test-YTable.cc -o test-YTable | |
#include <sstream> | |
#include "YUI.h" | |
#include "YApplication.h" | |
#include "YWidgetFactory.h" | |
#include "YDialog.h" | |
#include "YLayoutBox.h" | |
#include "YEvent.h" | |
#include "YTable.h" | |
#include "YTableHeader.h" | |
#include "YCheckBoxFrame.h" | |
#include "YWidget.h" | |
#include "YTimeField.h" | |
#include "YAlignment.h" | |
int main( int argc, char **argv ) | |
{ | |
YDialog * dialog = YUI::widgetFactory()->createPopupDialog(); | |
YLayoutBox * vbox = YUI::widgetFactory()->createVBox( dialog ); | |
YAlignment * minSize = YUI::widgetFactory()->createMinSize( vbox, 60, 10 ); // minWidth, minHeight | |
YUI::widgetFactory()->createLabel ( vbox, "YTable test" ); | |
YTableItem *pItem; | |
YTableHeader* head = new YTableHeader; | |
head->addColumn( "Name", YAlignBegin ); | |
head->addColumn( "Description", YAlignBegin ); | |
head->addColumn( "Size", YAlignEnd ); | |
head->addColumn( "Size (KB)", YAlignEnd ); | |
YTable* table = YUI::widgetFactory()->createTable( YUI::widgetFactory()->createLeft(minSize), head ); | |
table->setNotify( true ); | |
YItemCollection items; | |
items.push_back( new YTableItem( "test", "A test object", "1234.5K", "1234.5") ); | |
items.push_back( new YTableItem( "good", "A good object", "100K", "100" ) ); | |
pItem = new YTableItem( "bad", "A bad object", "8.2K", "8.2" ); | |
items.push_back( pItem); | |
items.push_back( new YTableItem( "fun", "A fun object", "12K", "12" ) ); | |
items.push_back( new YTableItem( "awful", "An awful object", "3K", "3" ) ); | |
items.push_back( new YTableItem( "useless", "An useless object", "2430K", "2430" ) ); | |
table->addItems( items ); | |
YUI::widgetFactory()->createPushButton( vbox, "&OK" ); | |
dialog->waitForEvent(); | |
dialog->destroy(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment