JXTextCheckbox::JXTextCheckbox
	(
	const JCharacter*	label,
	JXContainer*		enclosure,
	const HSizingOption	hSizing,
	const VSizingOption	vSizing,
	const JCoordinate	x,
	const JCoordinate	y,
	const JCoordinate	w,
	const JCoordinate	h
	)
	:
	JXCheckbox(enclosure, hSizing, vSizing, x,y, w,h),
	itsLabel(label),
	itsFontName(JGetDefaultFontName())
{
	itsShortcuts = NULL;
	itsULIndex   = 0;

	itsFontSize = kJDefaultFontSize;
	// itsFontStyle already initialized to correct default

	JXColormap* colormap = GetColormap();
	itsNormalColor = colormap->GetDefaultBackColor();
	itsPushedColor = colormap->GetDefaultSelButtonColor();

	itsTrueLabelColor = itsFontStyle.color;

	if (!IsActive())
		{
		itsFontStyle.color = colormap->GetInactiveLabelColor();
		}
}
JX2DCurveNameList::JX2DCurveNameList
	(
	const JArray<J2DCurveInfo>&	curveInfo,
	const JIndex				startIndex,
	JXScrollbarSet*				scrollbarSet,
	JXContainer*				enclosure,
	const HSizingOption			hSizing,
	const VSizingOption			vSizing,
	const JCoordinate			x,
	const JCoordinate			y,
	const JCoordinate			w,
	const JCoordinate			h
	)
	:
	JXEditTable(1, kDefColWidth, scrollbarSet, enclosure, hSizing,vSizing, x,y, w,h),
	itsInput(NULL)
{
	itsMinColWidth = 1;

	const JFontManager* fontMgr = GetFontManager();
	const JSize rowHeight = 2*kVMarginWidth +
		fontMgr->GetDefaultFont().GetLineHeight();
	SetDefaultRowHeight(rowHeight);

	const JSize count = curveInfo.GetElementCount();

	itsNameList = jnew JPtrArray<JString>(JPtrArrayT::kForgetAll, count);
	assert(itsNameList != NULL);

	AppendRows(count);
	for (JIndex i=1; i<=count; i++)
		{
		const J2DCurveInfo info = curveInfo.GetElement(i);
		itsNameList->Append(info.name);

		const JCoordinate width = 2*kHMarginWidth +
			fontMgr->GetDefaultFont().GetStringWidth(*(info.name));
		if (width > itsMinColWidth)
			{
			itsMinColWidth = width;
			}
		}

	AppendCols(1);
	AdjustColWidth();

	JXColormap* colormap = GetColormap();
	SetRowBorderInfo(0, colormap->GetBlackColor());
	SetColBorderInfo(0, colormap->GetBlackColor());

	BeginEditing(JPoint(1, startIndex));
}
GLFitDescriptionList::GLFitDescriptionList
	(
	JXScrollbarSet*		scrollbarSet,
	JXContainer*		enclosure,
	const HSizingOption	hSizing,
	const VSizingOption	vSizing,
	const JCoordinate	x,
	const JCoordinate	y,
	const JCoordinate	w,
	const JCoordinate	h
	)
	:
	JXEditTable(1, kDefColWidth, scrollbarSet, enclosure, hSizing,vSizing, x,y, w,h),
	itsInput(NULL)
{
	itsMinColWidth = 1;

	const JFontManager* fontMgr = GetFontManager();
	const JSize rowHeight = 2*kVMarginWidth + fontMgr->GetDefaultFont().GetLineHeight();
	SetDefaultRowHeight(rowHeight);

	const JSize count = GetFitManager()->GetFitCount();

	itsNameList = jnew JPtrArray<JString>(JPtrArrayT::kDeleteAll);
	assert(itsNameList != NULL);

	AppendCols(1);
	SyncWithManager();

	JXColormap* colormap = GetColormap();
	SetRowBorderInfo(0, colormap->GetBlackColor());
	SetColBorderInfo(0, colormap->GetBlackColor());

	itsBuiltInIcon	= jnew JXImage(GetDisplay(), JXPM(glBuiltInFit));
	assert(itsBuiltInIcon != NULL);
	itsBuiltInIcon->ConvertToRemoteStorage();

	itsNonLinearIcon	= jnew JXImage(GetDisplay(), JXPM(glNonLinearFit));
	assert(itsNonLinearIcon != NULL);
	itsNonLinearIcon->ConvertToRemoteStorage();

	itsPolyIcon	= jnew JXImage(GetDisplay(), JXPM(glPolyFit));
	assert(itsPolyIcon != NULL);
	itsPolyIcon->ConvertToRemoteStorage();

	itsExecutableIcon = jnew JXImage(GetDisplay(), JXPM(jx_executable_small));
	assert( itsExecutableIcon != NULL );
	itsExecutableIcon->ConvertToRemoteStorage();

	ListenTo(GetFitManager());
}
Exemplo n.º 4
0
TestWidget::~TestWidget()
{
    JXColormap* colormap = GetColormap();
    const JSize count = itsAnimColorList->GetElementCount();
    for (JIndex i=1; i<=count; i++)
    {
        colormap->DeallocateColor( itsAnimColorList->GetElement(i) );
    }

    delete itsAnimColorList;
    delete itsAnimColorTask;

    delete itsXPMImage;
    delete itsPartialXPMImage;
    delete itsHomeImage;
    delete itsImageBuffer;
}
void
ScrollingWidget::Draw
	(
	JXWindowPainter& p, 
	const JRect& rect
	)
{
	JXColormap* cmap = GetColormap();

	// Drawing goes here
	// See JPainter.h for available functions
	
	p.SetPenColor(cmap->GetGreenColor());
	p.Rect(10, 10, 50, 50);
	
	p.SetFilling(kJTrue);
	p.SetPenColor(cmap->GetBlueColor());
	p.Rect(10, 70, 50, 50);
}
Exemplo n.º 6
0
void
Widget::Draw
	(
	JXWindowPainter& p, 
	const JRect&     rect
	)
{
	JXColormap* cmap = GetColormap();

	// This is where everything happens
	// See JPainter.h for available functions

	p.SetPenColor(cmap->GetGreenColor());
	p.Rect(10, 10, 50, 50);
	
	p.SetFilling(kJTrue);
	p.SetPenColor(cmap->GetBlueColor());
	p.Rect(10, 70, 50, 50);
}
GMAccountList::GMAccountList
	(
	GMAccountDialog*		dialog,
	JPtrArray<GMAccount>*	accounts,
	JXScrollbarSet*			scrollbarSet,
	JXContainer*			enclosure,
	const HSizingOption		hSizing,
	const VSizingOption		vSizing,
	const JCoordinate		x,
	const JCoordinate		y,
	const JCoordinate		w,
	const JCoordinate		h
	)
	:
   JXEditTable(1, kDefColWidth, scrollbarSet, enclosure, hSizing,vSizing, x,y, w,h),
   itsInput(NULL),
   itsDialog(dialog),
   itsAccountInfo(accounts)
{
	itsMinColWidth = 1;

	JXColormap* colormap         = GetColormap();
	const JColorIndex blackColor = colormap->GetBlackColor();
	SetRowBorderInfo(0, blackColor);
	SetColBorderInfo(0, blackColor);

	const JSize fontHeight =
		(GetFontManager())->GetLineHeight(JGetDefaultFontName(),
		kJDefaultFontSize, JFontStyle());
	const JCoordinate rowHeight = fontHeight + 2*kVMarginWidth;
	SetDefaultRowHeight(rowHeight);
	SetAllRowHeights(rowHeight);

	itsLineHeight =
		GetFontManager()->GetLineHeight(JGetDefaultFontName(),
		kJDefaultFontSize, JFontStyle()) + 2 * kVMarginWidth;

	ListenTo(itsAccountInfo);
}
void
CBEditTextPrefsDialog::SetReverseVideoColors()
{
	JXColormap* cmap = GetColormap();
	ChangeColor(CBPrefsManager::kTextColorIndex,        cmap->GetWhiteColor());
	ChangeColor(CBPrefsManager::kBackColorIndex,        cmap->GetBlackColor());
	ChangeColor(CBPrefsManager::kCaretColorIndex,       cmap->GetWhiteColor());
	ChangeColor(CBPrefsManager::kSelColorIndex,         cmap->GetBlueColor());
	ChangeColor(CBPrefsManager::kSelLineColorIndex,     cmap->GetCyanColor());
	ChangeColor(CBPrefsManager::kRightMarginColorIndex, cmap->GetGrayColor(80));
}
void
CBEditTextPrefsDialog::SetDefaultColors()
{
	JXColormap* cmap = GetColormap();
	ChangeColor(CBPrefsManager::kTextColorIndex,        cmap->GetBlackColor());
	ChangeColor(CBPrefsManager::kBackColorIndex,        cmap->GetWhiteColor());
	ChangeColor(CBPrefsManager::kCaretColorIndex,       cmap->GetRedColor());
	ChangeColor(CBPrefsManager::kSelColorIndex,         cmap->GetDefaultSelectionColor());
	ChangeColor(CBPrefsManager::kSelLineColorIndex,     cmap->GetBlueColor());
	ChangeColor(CBPrefsManager::kRightMarginColorIndex, cmap->GetGrayColor(70));
}
ClipboardWidget::ClipboardWidget
	(
	const JCharacter* 	text,
	JXMenuBar* 			menuBar,
	JXContainer* 		enclosure,
	const HSizingOption hSizing,
	const VSizingOption vSizing,
	const JCoordinate 	x,
	const JCoordinate 	y,
	const JCoordinate 	w,
	const JCoordinate 	h
	)
	:
	JXWidget(enclosure, hSizing, vSizing, x, y, w, h),
	itsText(text)
{
	// Set the background color.
	JXColormap* cmap = GetColormap();
	SetBackColor(cmap->GetWhiteColor());

    // Create the menu and attach it to the menu bar.
    itsEditMenu = menuBar->AppendTextMenu(kEditMenuTitleStr);

    // Set the menu items.
    itsEditMenu->SetMenuItems(kEditMenuStr);

    // The menu items don't need to be disabled
    itsEditMenu->SetUpdateAction(JXMenu::kDisableNone);

    // Listen for messages from the menu.
	ListenTo(itsEditMenu);

	// Register the data types that we support.  The atoms that we need
	// here, namely text atoms, are already defined, so we don't need to
	// define them again. If we had a special selection type we would use
	// GetDisplay()->RegisterXAtom(OurAtomString) to register it.
}
void
ClipboardWidget::Draw
	(
	JXWindowPainter& p,
	const JRect&     rect
	)
{
	// We need the colormap in order to specify colors.
	JXColormap* cmap = GetColormap();

	// This is where everything happens
	// See JPainter.h for available functions

	// This sets the color of the pen.
	p.SetPenColor(cmap->GetCyanColor());

	// This draws our rectangle.
	p.Rect(10, 10, 150, 50);

	// This draws itsText.
	p.String(20,20,itsText,
				130, JPainter::kHAlignCenter,
				30, JPainter::kVAlignCenter);
}
Exemplo n.º 12
0
void
TestWidget::DrawStuff
	(
	JPainter& p
	)
{
JIndex i;

	JXColormap* colormap = GetColormap();

	p.SetPenColor(colormap->GetGreenColor());
	JRect ellipseRect(100,50,150,300);
	p.Ellipse(ellipseRect);

	p.SetPenColor(colormap->GetBlackColor());

	if (itsFillFlag)
		{
		p.SetFilling(kJTrue);
		}

	JRect ap = GetAperture();
	p.Line(ap.topLeft(), ap.bottomRight());
	p.Line(ap.topRight(), ap.bottomLeft());

	p.SetLineWidth(2);
	p.SetFontName("Times");
	p.SetFontSize(18);

	p.Image(*itsHomeImage, itsHomeImage->GetBounds(), itsHomeRect);

	its2Rect = JRect(150, 5, 200, 30);
	p.SetPenColor(colormap->GetRedColor());
	p.Rect(its2Rect);
	p.SetFontStyle(colormap->GetRedColor());
	p.String(its2Rect.topLeft(), "2",
			 its2Rect.width(),  JPainter::kHAlignCenter,
			 its2Rect.height(), JPainter::kVAlignCenter);

	its3Rect = JRect(10, 150, 40, 200);
	p.SetPenColor(colormap->GetBlueColor());
	p.Rect(its3Rect);
	p.SetFontStyle(colormap->GetBlueColor());
	p.String(its3Rect.topLeft(), "3",
			 its3Rect.width(),  JPainter::kHAlignCenter,
			 its3Rect.height(), JPainter::kVAlignCenter);

	p.SetLineWidth(1);
	p.SetFont(GetFontManager()->GetDefaultFont());

	p.ShiftOrigin(10,10);

	p.Point(0,0);
	for (i=1; i<=itsRandPointCount; i++)
		{
		p.Point(itsRNG.UniformLong(0,200), itsRNG.UniformLong(0,200));
		}

	p.SetPenColor(colormap->GetRedColor());
	p.Line(10,0, 0,10);
	p.SetPenColor(colormap->GetGreenColor());
	p.LineTo(10,20);
	p.SetPenColor(colormap->GetBlueColor());
	p.LineTo(0,30);

	p.ShiftOrigin(2,0);

	JPoint textPt(40,30);
	p.String(  0.0, textPt, "Hello");
	p.String( 90.0, textPt, "Hello");
	p.String(180.0, textPt, "Hello");
	p.String(270.0, textPt, "Hello");

	p.ShiftOrigin(-2, 0);

	p.SetPenColor(colormap->GetBlueColor());
	JRect r(70, 290, 150, 390);
	p.Rect(r);
/*
	for (JCoordinate y=70; y<150; y++)
		{
		p.SetPenColor(colormap->GetGrayColor(y-50));
		p.Line(290,y, 390,y);
		}

	for (JCoordinate x=290; x<390; x++)
		{
		p.SetPenColor(colormap->GetGrayColor(x-290));
		p.Line(x,70, x,150);
		}

	p.SetLineWidth(2);
	for (JCoordinate y=70; y<150; y+=2)
		{
		p.SetPenColor(colormap->GetGrayColor(y%4 ? 40 : 60));
		p.Line(290,y, 390,y);
		}
	p.SetLineWidth(1);

	p.SetLineWidth(2);
	for (JCoordinate x=290; x<390; x+=2)
		{
		p.SetPenColor(colormap->GetGrayColor(x%4 ? 40 : 60));
		p.Line(x,70, x,150);
		}
	p.SetLineWidth(1);
*/
	p.String(  0.0, r, "Hello", JPainter::kHAlignCenter, JPainter::kVAlignCenter);
	p.String( 90.0, r, "Hello", JPainter::kHAlignCenter, JPainter::kVAlignCenter);
	p.String(180.0, r, "Hello", JPainter::kHAlignCenter, JPainter::kVAlignCenter);
	p.String(270.0, r, "Hello", JPainter::kHAlignCenter, JPainter::kVAlignCenter);

	p.String(  0.0, r, "Hello", JPainter::kHAlignRight, JPainter::kVAlignBottom);
	p.String( 90.0, r, "Hello", JPainter::kHAlignRight, JPainter::kVAlignBottom);
	p.String(180.0, r, "Hello", JPainter::kHAlignRight, JPainter::kVAlignBottom);
	p.String(270.0, r, "Hello", JPainter::kHAlignRight, JPainter::kVAlignBottom);

	p.SetPenColor(colormap->GetBlueColor());
	p.Rect(200, 10, 100, 50);
	p.String(200, 10, "Hello", 100, JPainter::kHAlignLeft);
	p.String(200, 10+p.GetLineHeight(), "Hello", 100, JPainter::kHAlignCenter);
	p.String(200, 10+2*p.GetLineHeight(), "Hello", 100, JPainter::kHAlignRight);

	p.SetPenColor(colormap->GetDarkGreenColor());
	p.SetFilling(kJTrue);
	p.Rect(290, 160, 100, 80);
	p.SetFilling(kJFalse);
/*
	for (JCoordinate y=160; y<240; y++)
		{
		p.SetPenColor(colormap->GetGrayColor(y-140));
		p.Line(290,y, 390,y);
		}

	for (JCoordinate x=290; x<390; x++)
		{
		p.SetPenColor(colormap->GetGrayColor(x-290));
		p.Line(x,160, x,240);
		}

	p.SetLineWidth(2);
	for (JCoordinate y=160; y<240; y+=2)
		{
		p.SetPenColor(colormap->GetGrayColor(y%4 ? 40 : 60));
		p.Line(290,y, 390,y);
		}
	p.SetLineWidth(1);

	p.SetLineWidth(2);
	for (JCoordinate x=290; x<390; x+=2)
		{
		p.SetPenColor(colormap->GetGrayColor(x%4 ? 40 : 60));
		p.Line(x,160, x,240);
		}
	p.SetLineWidth(1);
*/
	textPt.Set(340, 200);
	p.SetFontName("Times");
	p.SetFontStyle(colormap->GetBlueColor());
	p.String(  0.0, textPt, "Hello");
	p.String( 90.0, textPt, "Hello");
	p.SetFontStyle(colormap->GetYellowColor());
	p.String(180.0, textPt, "Hello");
	p.String(270.0, textPt, "Hello");

	p.SetPenColor(colormap->GetYellowColor());
	r.Set(0,11,80,91);
	p.Rect(r);
	r.Shrink(1,1);
	p.SetPenColor(colormap->GetBlueColor());
	p.Ellipse(r);
	r.Shrink(1,1);
	p.SetPenColor(colormap->GetRedColor());
	p.Arc(r, 270.0-45.0, -270.0);

	JPolygon poly;
	poly.AppendElement(JPoint(0,85));
	poly.AppendElement(JPoint(10,85));
	poly.AppendElement(JPoint(5,95));
	p.Polygon(poly);

	p.Line(0,100, 2,98);
	p.LineTo(4,100);
	p.LineTo(2,102);
	p.LineTo(0,100);

	poly.SetElement(1, JPoint(0,5));
	poly.SetElement(2, JPoint(2,0));
	poly.SetElement(3, JPoint(4,5));
	p.Polygon(2,105, poly);

	// test filling rule

	p.SetPenColor(colormap->GetRedColor());
	p.SetFilling(kJTrue);

	JPolygon fillRulePoly;
	fillRulePoly.AppendElement(JPoint(175,45));
	fillRulePoly.AppendElement(JPoint(165,65));
	fillRulePoly.AppendElement(JPoint(190,50));
	fillRulePoly.AppendElement(JPoint(160,50));
	fillRulePoly.AppendElement(JPoint(185,65));
	p.Polygon(fillRulePoly);

	p.SetFilling(kJFalse);

	// dashed lines

	p.DrawDashedLines(kJTrue);

	p.SetPenColor(colormap->GetBlackColor());

	JArray<JSize> dashList;			// pixel rulers
	dashList.AppendElement(1);
	dashList.AppendElement(1);
	p.SetDashList(dashList);
	p.Line(100,110, 200,110);
	p.Line(100,114, 200,114);
	p.Line(100,118, 200,118);

	dashList.SetElement(1, 2);		// simple pattern
	dashList.SetElement(2, 3);
	p.SetDashList(dashList);
	p.Line(100,112, 200,112);

	p.SetFontStyle(JFontStyle(kJFalse, kJFalse, 1, kJFalse));
	p.String(130,155, "underline without dashes");

	p.SetDashList(dashList, 3);		// test offset
	p.Line(100,116, 200,116);

	dashList.SetElement(1, 1);		// example with odd # of values from X manuals
	dashList.SetElement(2, 2);
	dashList.AppendElement(3);
	p.SetDashList(dashList);
	p.Line(100,120, 200,120);

	dashList.SetElement(1, 5);		// dash-dot pattern
	dashList.SetElement(2, 2);
	dashList.SetElement(3, 1);
	dashList.AppendElement(2);
	p.SetDashList(dashList);
	p.Line(100,122, 200,122);

	p.Ellipse(210,110, 20,20);
	p.DrawDashedLines(kJFalse);
	p.Ellipse(213,113, 14,14);
	p.Rect(207,107, 26,26);
	p.SetPenColor(colormap->GetYellowColor());
	p.DrawDashedLines(kJTrue);
	p.Ellipse(213,113, 14,14);

	// icons

	p.Image(*itsXPMImage, itsXPMImage->GetBounds(), 33,110);
	p.Image(*itsPartialXPMImage, itsXPMImage->GetBounds(), 50,121);
}
Exemplo n.º 13
0
TestWidget::TestWidget
	(
	const JBoolean		isMaster,
	const JBoolean		isImage,
	JXMenuBar*			menuBar,
	JXScrollbarSet*		scrollbarSet,
	JXContainer*		enclosure,
	const HSizingOption	hSizing,
	const VSizingOption	vSizing,
	const JCoordinate	x,
	const JCoordinate	y,
	const JCoordinate	w,
	const JCoordinate	h
	)
	:
	JXScrollableWidget(scrollbarSet, enclosure, hSizing, vSizing, x,y, w,h),
	itsRNG()
{
JIndex i;

	itsFillFlag       = kJFalse;
	itsRandPointCount = 10;
	itsResizeDialog   = NULL;

	SetBackColor(GetColormap()->GetDefaultBackColor());

	// cursors

	JXDisplay* display = GetDisplay();
	itsTrekCursor      = display->CreateBuiltInCursor("XC_trek",     XC_trek);
	itsGumbyCursor     = display->CreateBuiltInCursor("XC_gumby",    XC_gumby);
	itsBogosityCursor  = display->CreateBuiltInCursor("XC_bogosity", XC_bogosity);
	itsFleurCursor     = display->CreateBuiltInCursor("XC_fleur",    XC_fleur);
	SetDefaultCursor(itsTrekCursor);

	// menus

	itsActionsMenu = menuBar->AppendTextMenu(kActionsMenuTitleStr);
	itsActionsMenu->SetTitleFontStyle(GetColormap()->GetWhiteColor());
	itsActionsMenu->SetShortcuts(kActionsMenuShortcutStr);
	itsActionsMenu->SetMenuItems(kActionsMenuStr);
	itsActionsMenu->SetUpdateAction(JXMenu::kDisableNone);
	ListenTo(itsActionsMenu);

	itsPointMenu = jnew JXTextMenu(itsActionsMenu, kPointMenuCmd, menuBar);
	assert( itsPointMenu != NULL );
	itsPointMenu->SetMenuItems(kPointMenuStr);
	itsPointMenu->SetUpdateAction(JXMenu::kDisableNone);
	ListenTo(itsPointMenu);

	// This tests the JX response to an empty menu.
	JXTextMenu* emptyMenu = jnew JXTextMenu(itsActionsMenu, kEmptyMenuCmd, menuBar);
	assert( emptyMenu != NULL );

	JXMenu* prevMenu     = itsActionsMenu;
	JIndex prevMenuIndex = kAdviceMenuCmd;
	for (i=1; i<=kAdviceMenuCount; i++)
		{
		JXTextMenu* adviceMenu = jnew JXTextMenu(prevMenu, prevMenuIndex, menuBar);
		assert( adviceMenu != NULL );
		adviceMenu->SetMenuItems(kAdviceMenuStr[i-1]);
		adviceMenu->SetUpdateAction(JXMenu::kDisableNone);

		if (i == kAdviceBoldMenuIndex)
			{
			adviceMenu->SetItemFontStyle(2,
				JFontStyle(kJTrue, kJFalse, 0, kJFalse, GetColormap()->GetBlackColor()));
			}

		prevMenu      = adviceMenu;
		prevMenuIndex = 2;
		}

	BuildXlsfontsMenu(itsActionsMenu, menuBar);

	// secret menus are a bad idea because the user can't find them!

	itsSecretMenu = jnew JXTextMenu("", this, kFixedLeft, kFixedTop, 0,0, 10,10);
	assert( itsSecretMenu != NULL );
	itsSecretMenu->SetMenuItems(kSecretMenuStr);
	itsSecretMenu->SetUpdateAction(JXMenu::kDisableNone);
	itsSecretMenu->SetToHiddenPopupMenu(kJTrue);		// will assert() otherwise
	itsSecretMenu->Hide();
	ListenTo(itsSecretMenu);

	itsSecretSubmenu = jnew JXTextMenu(itsSecretMenu, kSecretSubmenuIndex, this);
	assert( itsSecretSubmenu != NULL );
	itsSecretSubmenu->SetMenuItems(kSecretSubmenuStr);
	itsSecretSubmenu->SetUpdateAction(JXMenu::kDisableNone);
	// we don't ListenTo() it because it's only there for show

	// image from xpm

	itsXPMImage = jnew JXImage(GetDisplay(), JXPM(macapp_xpm));
	assert( itsXPMImage != NULL );

	// partial image from image

	itsPartialXPMImage = jnew JXImage(*itsXPMImage, JRect(5,5,14,16));
	assert( itsPartialXPMImage != NULL );

	// home symbol

	itsHomeImage = jnew JXImage(GetDisplay(), JXPM(home_xpm));
	assert( itsHomeImage != NULL );

	itsHomeRect = itsHomeImage->GetBounds();
	itsHomeRect.Shift(120, 10);

	// buffer contents of Widget in JXImage

	itsImageBuffer = NULL;
	if (isImage)
		{
		CreateImageBuffer();
		}

	// initial size

	SetBounds(400,400);

	// enclosed objects

	itsAnimButton = 
		jnew JXTextButton("Start", this, JXWidget::kFixedLeft, JXWidget::kFixedTop,
						 37,175, 50,30);
	assert( itsAnimButton != NULL );
	itsAnimButton->SetShortcuts("#A");
	ListenTo(itsAnimButton);

	if (isMaster)
		{
		itsQuitButton = 
			jnew JXTextButton(JGetString("Quit::TestWidget"), this, JXWidget::kFixedRight, JXWidget::kFixedBottom,
							 x,y, 50,30);
		assert( itsQuitButton != NULL );

		JXColormap* colormap = GetColormap();
		itsQuitButton->CenterWithinEnclosure(kJTrue, kJTrue);
		itsQuitButton->SetFontStyle(JFontStyle(kJTrue, kJFalse, 0, kJFalse, colormap->GetRedColor()));
		itsQuitButton->SetNormalColor(colormap->GetCyanColor());
		itsQuitButton->SetPushedColor(colormap->GetBlueColor());

		ListenTo(itsQuitButton);
		}
	else
		{
		itsQuitButton = NULL;
		}

	ExpandToFitContent();

	// drops on iconfied window

	JXWindowIcon* windowIcon;
	const JBoolean hasIconWindow = GetWindow()->GetIconWidget(&windowIcon);
	assert( hasIconWindow );
	ListenTo(windowIcon);
}
Exemplo n.º 14
0
void
TestWidget::DrawStuff
(
    JPainter& p
)
{
    JIndex i;

    JXColormap* colormap = GetColormap();

    p.SetPenColor(colormap->GetGreenColor());
    JRect ellipseRect(100,50,150,300);
    p.Ellipse(ellipseRect);

    p.SetPenColor(colormap->GetBlackColor());

    if (itsFillFlag)
    {
        p.SetFilling(kJTrue);
    }

    JRect ap = GetAperture();
    p.Line(ap.topLeft(), ap.bottomRight());
    p.Line(ap.topRight(), ap.bottomLeft());

    p.SetLineWidth(2);
    p.SetFontName(JXGetTimesFontName());
    p.SetFontSize(18);

    p.Image(*itsHomeImage, itsHomeImage->GetBounds(), itsHomeRect);

    its2Rect = JRect(150, 5, 200, 30);
    p.SetPenColor(colormap->GetRedColor());
    p.Rect(its2Rect);
    p.SetFontStyle(colormap->GetRedColor());
    p.String(its2Rect.topLeft(), "2",
             its2Rect.width(),  JPainter::kHAlignCenter,
             its2Rect.height(), JPainter::kVAlignCenter);

    its3Rect = JRect(10, 150, 40, 200);
    p.SetPenColor(colormap->GetBlueColor());
    p.Rect(its3Rect);
    p.SetFontStyle(colormap->GetBlueColor());
    p.String(its3Rect.topLeft(), "3",
             its3Rect.width(),  JPainter::kHAlignCenter,
             its3Rect.height(), JPainter::kVAlignCenter);

    p.SetLineWidth(1);
    p.SetFont(JGetDefaultFontName(), kJXDefaultFontSize, colormap->GetBlackColor());

    p.ShiftOrigin(10,10);

    p.Point(0,0);
    for (i=1; i<=itsRandPointCount; i++)
    {
        p.Point(itsRNG.UniformLong(0,200), itsRNG.UniformLong(0,200));
    }

    p.SetPenColor(colormap->GetRedColor());
    p.Line(10,0, 0,10);
    p.SetPenColor(colormap->GetGreenColor());
    p.LineTo(10,20);
    p.SetPenColor(colormap->GetBlueColor());
    p.LineTo(0,30);

    p.ShiftOrigin(2,0);

    JPoint textPt(40,30);
    p.String(  0.0, textPt, "Hello");
    p.String( 90.0, textPt, "Hello");
    p.String(180.0, textPt, "Hello");
    p.String(270.0, textPt, "Hello");

    p.Rect(310, 70, 80, 80);
    p.String(  0.0, 310, 70, "Hello", 80, JPainter::kHAlignCenter,
               80, JPainter::kVAlignCenter);
    p.String( 90.0, 310,150, "Hello", 80, JPainter::kHAlignCenter,
              80, JPainter::kVAlignCenter);
    p.String(180.0, 390,150, "Hello", 80, JPainter::kHAlignCenter,
             80, JPainter::kVAlignCenter);
    p.String(270.0, 390, 70, "Hello", 80, JPainter::kHAlignCenter,
             80, JPainter::kVAlignCenter);

    p.Rect(200, 10, 100, 50);
    p.String(200, 10, "Hello", 100, JPainter::kHAlignLeft);
    p.String(200, 10+p.GetLineHeight(), "Hello", 100, JPainter::kHAlignCenter);
    p.String(200, 10+2*p.GetLineHeight(), "Hello", 100, JPainter::kHAlignRight);

    p.SetPenColor(colormap->GetYellowColor());
    JRect r(0,11,80,91);
    p.Rect(r);
    r.Shrink(1,1);
    p.SetPenColor(colormap->GetBlueColor());
    p.Ellipse(r);
    r.Shrink(1,1);
    p.SetPenColor(colormap->GetRedColor());
    p.Arc(r, 270.0-45.0, -270.0);

    JPolygon poly;
    poly.AppendElement(JPoint(0,85));
    poly.AppendElement(JPoint(10,85));
    poly.AppendElement(JPoint(5,95));
    p.Polygon(poly);

    p.Line(0,100, 2,98);
    p.LineTo(4,100);
    p.LineTo(2,102);
    p.LineTo(0,100);

    poly.SetElement(1, JPoint(0,5));
    poly.SetElement(2, JPoint(2,0));
    poly.SetElement(3, JPoint(4,5));
    p.Polygon(2,105, poly);

    // test filling rule

    p.SetPenColor(colormap->GetRedColor());
    p.SetFilling(kJTrue);

    JPolygon fillRulePoly;
    fillRulePoly.AppendElement(JPoint(175,45));
    fillRulePoly.AppendElement(JPoint(165,65));
    fillRulePoly.AppendElement(JPoint(190,50));
    fillRulePoly.AppendElement(JPoint(160,50));
    fillRulePoly.AppendElement(JPoint(185,65));
    p.Polygon(fillRulePoly);

    p.SetFilling(kJFalse);

    // dashed lines

    p.DrawDashedLines(kJTrue);

    p.SetPenColor(colormap->GetBlackColor());

    JArray<JSize> dashList;			// pixel rulers
    dashList.AppendElement(1);
    dashList.AppendElement(1);
    p.SetDashList(dashList);
    p.Line(100,110, 200,110);
    p.Line(100,114, 200,114);
    p.Line(100,118, 200,118);

    dashList.SetElement(1, 2);		// simple pattern
    dashList.SetElement(2, 3);
    p.SetDashList(dashList);
    p.Line(100,112, 200,112);

    p.SetFontStyle(JFontStyle(kJFalse, kJFalse, 1, kJFalse));
    p.String(130,155, "underline without dashes");

    p.SetDashList(dashList, 3);		// test offset
    p.Line(100,116, 200,116);

    dashList.SetElement(1, 1);		// example with odd # of values from X manuals
    dashList.SetElement(2, 2);
    dashList.AppendElement(3);
    p.SetDashList(dashList);
    p.Line(100,120, 200,120);

    dashList.SetElement(1, 5);		// dash-dot pattern
    dashList.SetElement(2, 2);
    dashList.SetElement(3, 1);
    dashList.AppendElement(2);
    p.SetDashList(dashList);
    p.Line(100,122, 200,122);

    p.Ellipse(210,110, 20,20);
    p.DrawDashedLines(kJFalse);
    p.Ellipse(213,113, 14,14);
    p.Rect(207,107, 26,26);
    p.SetPenColor(colormap->GetYellowColor());
    p.DrawDashedLines(kJTrue);
    p.Ellipse(213,113, 14,14);

    // animated colors

    p.SetFilling(kJTrue);

    JCoordinate x = 25;
    const JSize animColorCount = itsAnimColorList->GetElementCount();
    for (i=1; i<=animColorCount; i++)
    {
        p.SetPenColor(itsAnimColorList->GetElement(i));
        p.Rect(x, 150, 10, 10);
        x += 10;
    }

    // icons

    p.Image(*itsXPMImage, itsXPMImage->GetBounds(), 33,110);
    p.Image(*itsPartialXPMImage, itsXPMImage->GetBounds(), 50,121);

    // *NEVER* do this in your code!  I do it here ONLY to test JXColormap.
    // (Besides, look at how messy it is!)

    unsigned long xPixel;
    if (colormap->CalcPreallocatedXPixel(62720, 56832, 45824, &xPixel))
    {
        JXDisplay* display = GetDisplay();
        Display* xdisplay  = display->GetXDisplay();
        GC gc = DefaultGC(xdisplay, display->GetScreen());
        XSetForeground(xdisplay, gc, xPixel);
        XFillRectangle(xdisplay, (GetWindow())->GetXWindow(), gc, 110,40, 20,20);
    }
}
Exemplo n.º 15
0
void
JXColorWheel::Draw
	(
	JXWindowPainter&	p,
	const JRect&		rect
	)
{
	JXColormap* colormap    = GetColormap();
	const JColorIndex black = colormap->GetBlackColor();

	const JRect bounds       = GetBoundsGlobal();
	const JCoordinate max    = JMin(bounds.height(), bounds.width() - kSliderWidth - kSliderMargin);
	const JCoordinate size   = max - 2*kWheelMargin - 1;
	const JCoordinate center = size/2 + kWheelMargin;
	if (itsImage == NULL || itsImage->GetWidth() != max || itsColor.brightness != itsLastDrawBrightness)
		{
		p.SetFilling(kJTrue);
		p.SetPenColor(black);
		p.Ellipse(kWheelMargin, kWheelMargin, size, size);
		p.SetFilling(kJFalse);

		JRect r  = bounds;
		r.bottom = r.top  + max;
		r.right  = r.left + max;

		jdelete itsImage;
		itsImage = jnew JXImage(GetDisplay(), p.GetDrawable(), r);
		assert( itsImage != NULL );

		itsLastDrawBrightness = itsColor.brightness;
		for (JCoordinate x=0; x<max; x++)
			{
			const JCoordinate dx = - x + center;

			for (JCoordinate y=0; y<max; y++)
				{
				if (itsImage->GetColor(x,y) == black)
					{
					const JCoordinate dy = y - center;
					const JFloat r = sqrt(dx*dx + dy*dy) / center;
					const JFloat a = 0.5 + atan2(dy, dx) / (2.0 * kJPi);

					JHSB color(JRound(a * kJMaxHSBValue), JRound(r * kJMaxHSBValue), itsLastDrawBrightness);
					itsImage->SetColor(x,y, colormap->JColormap::GetColor(color));
					}
				}
			}

		itsImage->ConvertToRemoteStorage();
		}

	p.JPainter::Image(*itsImage, itsImage->GetBounds(), 0,0);

	const JFloat r = (itsColor.saturation / kJMaxHSBValueF) * size/2;
	const JFloat a = ((itsColor.hue / kJMaxHSBValueF) - 0.5) * 2.0 * kJPi;

	const JCoordinate x = center - JRound(r * cos(a));
	const JCoordinate y = center + JRound(r * sin(a));

	JRect mark(y-kWheelMargin, x-kWheelMargin, y+kWheelMargin+1, x+kWheelMargin+1);

	p.SetPenColor(colormap->GetWhiteColor());
	p.SetFilling(kJTrue);
	p.JPainter::Rect(mark);
	p.SetFilling(kJFalse);
	p.SetPenColor(black);
	p.JPainter::Rect(mark);
}
Exemplo n.º 16
0
void
TestWidget::HandleActionsMenu
(
    const JIndex index
)
{
    if (index == kChangeSizeCmd)
    {
        GetNewSize();
    }
    else if (index == kToggleFillCmd)
    {
        itsFillFlag = JNegate(itsFillFlag);
        Refresh();
    }

    else if (index == kShowHideCmd && IsVisible())
    {
        Hide();
        itsActionsMenu->SetItemText(kShowHideCmd, kShowStr);
    }
    else if (index == kShowHideCmd)
    {
        Show();
        itsActionsMenu->SetItemText(kShowHideCmd, kHideStr);
    }

    else if (index == kActDeactCmd && IsActive())
    {
        Deactivate();
        itsActionsMenu->SetItemText(kActDeactCmd, kActivateStr);
    }
    else if (index == kActDeactCmd)
    {
        Activate();
        itsActionsMenu->SetItemText(kActDeactCmd, kDeactivateStr);
    }

    else if (index == kRedGreenCmd)
    {
        JXColormap* colormap  = GetColormap();
        const JIndex redColor = colormap->GetRedColor();
        itsAnimButton->SetFontStyle(itsNextAnimColor);
        if (itsNextAnimColor == redColor)
        {
            itsNextAnimColor = colormap->GetGreenColor();
            itsActionsMenu->SetItemText(kRedGreenCmd, kGreenStr);
        }
        else
        {
            itsNextAnimColor = redColor;
            itsActionsMenu->SetItemText(kRedGreenCmd, kRedStr);
        }
    }

    else if (index == kShowHideQuitCmd && itsQuitButton != NULL &&
             itsQuitButton->WouldBeVisible())
    {
        itsQuitButton->Hide();
        itsActionsMenu->SetItemText(kShowHideQuitCmd, kShowQuitStr);
    }
    else if (index == kShowHideQuitCmd && itsQuitButton != NULL)
    {
        itsQuitButton->Show();
        itsActionsMenu->SetItemText(kShowHideQuitCmd, kHideQuitStr);
    }

    else if (index == kActDeactQuitCmd && itsQuitButton != NULL &&
             itsQuitButton->WouldBeActive())
    {
        itsQuitButton->Deactivate();
        itsActionsMenu->SetItemText(kActDeactQuitCmd, kActivateQuitStr);
    }
    else if (index == kActDeactQuitCmd && itsQuitButton != NULL)
    {
        itsQuitButton->Activate();
        itsActionsMenu->SetItemText(kActDeactQuitCmd, kDeactivateQuitStr);
    }

    else if (index == kPrintSelectionTargetsCmd)
    {
        PrintSelectionTargets(CurrentTime);
    }
    else if (index == kPrintOldSelectionTargetsCmd)
    {
        PrintSelectionTargets((GetDisplay())->GetLastEventTime() - 10000);
    }
}
Exemplo n.º 17
0
JError
JXImage::CreateFromXPM
	(
	JXDisplay*			display,
	const JCharacter*	fileName,
	JXImage**			image
	)
{
#ifdef _J_HAS_XPM

	JXColormap* colormap = display->GetColormap();

	Pixmap image_pixmap = None;
	Pixmap mask_pixmap  = None;

	XpmAttributes attr;
	attr.valuemask          = XpmVisual | XpmColormap | XpmDepth |
							  XpmExactColors | XpmCloseness |
							  XpmColorKey | XpmAllocCloseColors |
							  XpmReturnAllocPixels;
	attr.visual             = colormap->GetVisual();
	attr.colormap           = colormap->GetXColormap();
	attr.depth              = display->GetDepth();
	attr.color_key          = XPM_COLOR;
	attr.alloc_pixels       = NULL;
	attr.nalloc_pixels      = 0;
	attr.alloc_close_colors = kJTrue;	// so we can free all resulting pixels
	attr.exactColors        = 1;
	attr.closeness          = 0;

	const int xpmErr =
		XpmReadFileToPixmap(*display, display->GetRootWindow(),
							const_cast<JCharacter*>(fileName),
							&image_pixmap, &mask_pixmap, &attr);
	if (xpmErr == XpmOpenFailed && JFileExists(fileName))
		{
		return JAccessDenied(fileName);
		}
	else if (xpmErr == XpmOpenFailed)
		{
		return JDirEntryDoesNotExist(fileName);
		}
	else if (xpmErr == XpmFileInvalid)
		{
		return FileIsNotXPM(fileName);
		}
	else if (xpmErr == XpmNoMemory)
		{
		return JNoProcessMemory();
		}
	else if (xpmErr == XpmColorFailed || xpmErr == XpmColorError)
		{
		if (image_pixmap != None)
			{
			XFreePixmap(*display, image_pixmap);
			}
		if (mask_pixmap != None)
			{
			XFreePixmap(*display, mask_pixmap);
			}
		if (attr.alloc_pixels != NULL)
			{
			XFreeColors(*display, attr.colormap, attr.alloc_pixels, attr.nalloc_pixels, 0);
			}
		XpmFreeAttributes(&attr);
		return TooManyColors();
		}

	// create image and mask

	*image = new JXImage(display, image_pixmap);
	assert( *image != NULL );

	XFreePixmap(*display, image_pixmap);

	if (mask_pixmap != None)
		{
		JXImageMask* mask = new JXImageMask(display, mask_pixmap);
		assert( mask != NULL );
		(**image).SetMask(mask);

		XFreePixmap(*display, mask_pixmap);
		}

	// free pixels so X has usage count of 1

	XFreeColors(*display, attr.colormap, attr.alloc_pixels, attr.nalloc_pixels, 0);

	// clean up

	XpmFreeAttributes(&attr);
	return JNoError();

#else

	return XPMNotAvailable();

#endif
}
void
TestDirector::BuildWindow
	(
	const JBoolean isMaster,
	const JBoolean bufferTestWidget,
	const JBoolean testWidgetIsImage
	)
{
	JXDisplay* display   = (JXGetApplication())->GetCurrentDisplay();
	JXColormap* colormap = display->GetColormap();

// begin JXLayout

    JXWindow* window = new JXWindow(this, 400,330, "");
    assert( window != NULL );

    JXMenuBar* menuBar =
        new JXMenuBar(window,
                    JXWidget::kHElastic, JXWidget::kFixedTop, 0,0, 400,30);
    assert( menuBar != NULL );

    JXScrollbarSet* scrollbarSet =
        new JXScrollbarSet(window,
                    JXWidget::kHElastic, JXWidget::kVElastic, 0,30, 400,300);
    assert( scrollbarSet != NULL );

// end JXLayout

	window->SetTitle("Test Director");
	window->SetWMClass("testjx", "TestDirector");

	window->SetMinSize(150,150);
	if (isMaster)
		{
		window->SetCloseAction(JXWindow::kQuitApp);
		}
	else
		{
		window->SetCloseAction(JXWindow::kCloseDisplay);
		}

	itsAnimIconTask = new AnimateWindowIconTask(GetWindow());
	assert( itsAnimIconTask != NULL );
	ListenTo(window);		// for icon animation

	// menus

	JXImage* aboutTitleImage =
		new JXImage(display, kSmileyBitmap[ kHappySmileyIndex ], colormap->GetRedColor());
	assert( aboutTitleImage != NULL );
	itsAboutMenu = menuBar->AppendTextMenu(aboutTitleImage, kJTrue);
	itsAboutMenu->SetShortcuts(kAboutMenuShortcuts);
	itsAboutMenu->SetMenuItems(kAboutMenuStr, "TestDirector");
	itsAboutMenu->SetUpdateAction(JXMenu::kDisableNone);
	ListenTo(itsAboutMenu);

	itsAnimHelpTask = new AnimateHelpMenuTask(itsAboutMenu, kHelpCmd);
	assert( itsAnimHelpTask != NULL );

	itsPrintPSMenu = new JXTextMenu(itsAboutMenu, kPrintPSMenuCmd, menuBar);
	assert( itsPrintPSMenu != NULL );
	itsPrintPSMenu->SetMenuItems(kPrintPSMenuStr);
	itsPrintPSMenu->SetUpdateAction(JXMenu::kDisableNone);
	ListenTo(itsPrintPSMenu);

	itsTestMenu = menuBar->AppendTextMenu(kTestMenuTitleStr);
	itsTestMenu->SetMenuItems(kTestMenuStr);
	itsTestMenu->SetUpdateAction(JXMenu::kDisableNone);
	ListenTo(itsTestMenu);

	itsUNMenu = new JXTextMenu(itsTestMenu, kTestUserNotifyMenuCmd, menuBar);
	assert( itsUNMenu != NULL );
	itsUNMenu->SetMenuItems(kUserNotificationMenuStr);
	itsUNMenu->SetUpdateAction(JXMenu::kDisableNone);
	ListenTo(itsUNMenu);

	itsCSFMenu = new JXTextMenu(itsTestMenu, kTestChooseSaveFileMenuCmd, menuBar);
	assert( itsCSFMenu != NULL );
	itsCSFMenu->SetMenuItems(kChooseSaveFileMenuStr);
	itsCSFMenu->SetUpdateAction(JXMenu::kDisableNone);
	ListenTo(itsCSFMenu);

	itsPGMenu = new JXTextMenu(itsTestMenu, kTestPGMenuCmd, menuBar);
	assert( itsPGMenu != NULL );
	itsPGMenu->SetMenuItems(kProgressDisplayMenuStr);
	itsPGMenu->SetUpdateAction(JXMenu::kDisableNone);
	ListenTo(itsPGMenu);

	if (isMaster)
		{
		itsDisplayMenu =
			new JXDisplayMenu(kDisplayMenuName, menuBar,
							  JXWidget::kFixedLeft, JXWidget::kFixedTop,
							  0,0, 10,10);
		assert( itsDisplayMenu != NULL );
		menuBar->AppendMenu(itsDisplayMenu);
		}
	else
		{
		itsDisplayMenu = NULL;
		}

	itsWidget =
		new TestWidget(isMaster, testWidgetIsImage,
					   menuBar, scrollbarSet,
					   scrollbarSet->GetScrollEnclosure(),
					   JXWidget::kHElastic, JXWidget::kVElastic,
					   0,0, 10,10);
	assert( itsWidget != NULL );
	itsWidget->FitToEnclosure(kJTrue, kJTrue);
	itsWidget->SetSingleFocusWidget();

	BuildIconMenus(window, menuBar);

	// do this -after- constructing JXScrollableWidget

	(GetWindow())->BufferDrawing(bufferTestWidget);
}
Exemplo n.º 19
0
void
JXStyleMenu::JXStyleMenuX()
{
	itsChooseColorDialog = NULL;

	if (JXMenu::GetDefaultStyle() == kMacintoshStyle)
		{
		SetMenuItems(kMacMenuStr);
		}
	else
		{
		SetShortcuts(kStyleMenuShortcutStr);
		SetMenuItems(kWinMenuStr);
		}

	JXColormap* colormap = GetColormap();
	const JColorIndex blackColor = colormap->GetBlackColor();

	SetItemFontStyle(
		kBoldStyleCmd,         JFontStyle(kJTrue, kJFalse, 0, kJFalse, blackColor));
	SetItemFontStyle(
		kItalicStyleCmd,       JFontStyle(kJFalse, kJTrue, 0, kJFalse, blackColor));
	SetItemFontStyle(
		kUnderlineStyleCmd,    JFontStyle(kJFalse, kJFalse, 1, kJFalse, blackColor));
	SetItemFontStyle(
		kDblUnderlineStyleCmd, JFontStyle(kJFalse, kJFalse, 2, kJFalse, blackColor));
	SetItemFontStyle(
		kStrikeStyleCmd,       JFontStyle(kJFalse, kJFalse, 0, kJTrue, blackColor));

	assert( kColorCount == 11 );
	itsColorList[ 0] = blackColor;
	itsColorList[ 1] = colormap->GetGray60Color();
	itsColorList[ 2] = colormap->GetBrownColor();
	itsColorList[ 3] = colormap->GetOrangeColor();
	itsColorList[ 4] = colormap->GetRedColor();
	itsColorList[ 5] = colormap->GetDarkRedColor();
	itsColorList[ 6] = colormap->GetDarkGreenColor();
	itsColorList[ 7] = colormap->GetBlueColor();
	itsColorList[ 8] = colormap->GetLightBlueColor();
	itsColorList[ 9] = colormap->GetPinkColor();
	itsColorList[10] = colormap->GetDefaultBackColor();

	ListenTo(this);
}
void
TestDirector::BuildIconMenus
	(
	JXWindow*	window,
	JXMenuBar*	menuBar
	)
{
JIndex i;

	// create icons

	JXDisplay* display   = window->GetDisplay();
	JXColormap* colormap = window->GetColormap();

	const JColorIndex kSmileyColor[] =
	{
		colormap->GetWhiteColor(),
		colormap->GetRedColor(),
		colormap->GetBlueColor(),
		colormap->GetBlackColor()
	};

	JXImage* image[kSmileyBitmapCount];
	for (i=0; i<kSmileyBitmapCount; i++)
		{
		image[i] = new JXImage(display, kSmileyBitmap[i], kSmileyColor[i]);
		assert( image[i] != NULL );
		}

	// create 1x6 menu in menu bar -- this owns the icons

	itsSmileyMenu =
		new JXImageMenu(kIconMenuTitleStr, 6, menuBar,
						JXWidget::kFixedLeft, JXWidget::kVElastic, 0,0, 10,10);
	assert( itsSmileyMenu != NULL );
	itsSmileyMenu->SetUpdateAction(JXMenu::kDisableNone);
	menuBar->AppendMenu(itsSmileyMenu);

	for (i=0; i<kSmileyBitmapCount; i++)
		{
		itsSmileyMenu->AppendItem(image[i], kJTrue);
		}

	// create 2x2 submenu of radio buttons

	itsIconMenu = new JXImageMenu(2, itsSmileyMenu, 2, menuBar);
	assert( itsIconMenu != NULL );
	itsIconMenu->SetUpdateAction(JXMenu::kDisableNone);

	for (i=0; i<kSmileyBitmapCount; i++)
		{
		itsIconMenu->AppendItem(image[i], kJFalse, JXMenu::kRadioType);
		}

	itsIconMenuItem = 1;
	ListenTo(itsIconMenu);

	// create 3x5 submenu that has a few unused cells

	JXImageMenu* submenu = new JXImageMenu(5, itsSmileyMenu, 4, menuBar);
	assert( submenu != NULL );
	submenu->SetUpdateAction(JXMenu::kDisableNone);

	for (JIndex j=1; j<=3; j++)
		{
		for (i=0; i<kSmileyBitmapCount; i++)
			{
			submenu->AppendItem(image[i], kJFalse);
			}
		}
}