标签:style blog ar io color sp for on div
1 //Tables.cpp 2 3 /* 4 Copyright 2000-2004 The VCF Project. 5 Please see License.txt in the top level directory 6 where you installed the VCF. 7 */ 8 9 10 #include "vcf/ApplicationKit/ApplicationKit.h" 11 #include "vcf/ApplicationKit/ControlsKit.h" 12 13 14 using namespace VCF; 15 16 17 18 class TablesWindow : public Window { 19 public: 20 TablesWindow() { 21 setCaption( "Tables" ); 22 23 24 TableControl* table = new TableControl(); 25 26 add( table, AlignClient ); 27 28 TableModel* model = table->getTableModel(); 29 30 model->empty(); 31 32 table->setDefaultTableCellFont( &Font("Tahoma") ); 33 34 model->addColumns( 12 ); 35 model->addRows(130); 36 model->setFixedRowsCount( 1 ); 37 model->setFixedColumnsCount( 1 ); 38 39 for (int y=0;y<model->getRowCount();y++ ){ 40 for ( int x=0;x<model->getColumnCount();x++ ) { 41 if ( table->getItem( y, x )->isFixed() ) { 42 table->getItem( y, x )->setCaption( Format( "Cell [%d,%d]" ) % y % x ); 43 } 44 else { 45 model->setValue( y, x, 1.0 * x * y ); 46 } 47 48 if ( y == 10 && x == 5 ) { 49 Font font = *table->getDefaultTableCellFont(); 50 font.setName( "Times New Roman" ); 51 font.setPointSize( 12.6 ); 52 font.setBold( true ); 53 table->getItem( y, x )->setFont( &font ); 54 table->getItem( y, x )->setColor( Color::getColor("yellow") ); 55 } 56 } 57 } 58 59 60 61 /******************************************* 62 --------------------------------------------- 63 | Hey there!!!! Yes you! The following line 64 | turns *OFF* row selection!! :) 65 --------------------------------------------- 66 ********************************************/ 67 table->setAllowFixedRowSelection( false ); 68 69 } 70 71 virtual ~TablesWindow(){}; 72 73 }; 74 75 76 77 78 class TablesApplication : public Application { 79 public: 80 81 TablesApplication( int argc, char** argv ) : Application(argc, argv) { 82 83 } 84 85 virtual bool initRunningApplication(){ 86 bool result = Application::initRunningApplication(); 87 88 Window* mainWindow = new TablesWindow(); 89 setMainWindow(mainWindow); 90 mainWindow->setBounds( &Rect( 100.0, 100.0, 500.0, 500.0 ) ); 91 mainWindow->show(); 92 93 return result; 94 } 95 96 }; 97 98 99 100 int main(int argc, char *argv[]) 101 { 102 return ApplicationKitMain<TablesApplication>(argc,argv); 103 } 104 105 106 /** 107 $Id: Tables.cpp 3420 2008-03-31 04:02:58Z ddiego $ 108 */
标签:style blog ar io color sp for on div
原文地址:http://www.cnblogs.com/elitiwin/p/4171816.html