// $Revision: 1.7 $ // Copyright (c) 1995 Taligent, Inc. All Rights Reserved. #ifndef TaligentSamples_COLORSOURCEVIEW #include "ColorSourceView.h" #endif #ifndef TaligentSamples_SAMPLEWINDOWPROGRAM #include "SampleWindowProgram.h" #endif #ifndef Taligent_STANDARDTEXT #include #endif void main(int argc, char* argv[]) { const TGPoint wellExtent(50, 50); const TGPoint wellOffset(10, 10); const TGPoint wellShift = wellExtent + wellOffset; const int wellsPerRow = 3; const TRGBColor colors[] = { TRGBColor(1, 0, 0), TRGBColor(0, 1, 0), TRGBColor(0, 0, 1), TRGBColor(0, 0, 0), TRGBColor(0.5, 0.5, 0.5), TRGBColor(1, 1, 1) }; const int numColors = sizeof(colors)/sizeof(TRGBColor); const int numRows = (numColors + wellsPerRow - 1) / wellsPerRow; const int numColumns = (numColors > wellsPerRow) ? wellsPerRow : numColors; TContentView* rootView = new TContentView(wellOffset + wellShift * TGPoint(numColumns, numRows)); TGPoint location = wellOffset; for (int i = 0; i < numColors; i++) { rootView->AdoptChild(new TColorSourceView(wellExtent, location, colors[i])); if ((i+1) % wellsPerRow == 0) { location = TGPoint(wellOffset.fX, location.fY + wellShift.fY); } else { location = TGPoint(location.fX + wellShift.fX, location.fY); } } TSampleWindowProgram program(rootView, TStandardText(argv[0])); program.Run(); }