本文整理汇总了C++中JXColormap::AllocateDynamicColor方法的典型用法代码示例。如果您正苦于以下问题:C++ JXColormap::AllocateDynamicColor方法的具体用法?C++ JXColormap::AllocateDynamicColor怎么用?C++ JXColormap::AllocateDynamicColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JXColormap
的用法示例。
在下文中一共展示了JXColormap::AllocateDynamicColor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: JXTextButton
TestWidget::TestWidget
(
const JBoolean isMaster,
const JBoolean isImage,
const JBoolean allocDynamicColors,
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;
itsNextAnimColor = (GetColormap())->GetGreenColor();
itsRandPointCount = 10;
itsResizeDialog = NULL;
// 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);
// dynamic colors
itsAnimColorList = new JArray<JColorIndex>(kAnimColorCount);
assert( itsAnimColorList != NULL );
JArray<JDynamicColorInfo>* colorList =
new JArray<JDynamicColorInfo>(kAnimColorCount);
assert( colorList != NULL );
JXColormap* colormap = GetColormap();
if (allocDynamicColors)
{
for (i=1; i<=kAnimColorCount; i++)
{
JDynamicColorInfo info;
if (colormap->AllocateDynamicColor(0,0,0, &(info.index)))
{
colorList->AppendElement(info);
itsAnimColorList->AppendElement(info.index);
}
else
{
cerr << "Unable to allocate dynamic color " << i << endl;
break;
}
}
}
if (!colorList->IsEmpty())
{
itsAnimColorTask = new AnimateColorTask(colormap, colorList);
assert( itsAnimColorTask != NULL );
}
else
{
delete colorList;
itsAnimColorTask = NULL;
}
ListenTo(GetWindow()); // remove AnimateColorTask when iconified
// menus
itsActionsMenu = menuBar->AppendTextMenu(kActionsMenuTitleStr);
itsActionsMenu->SetTitleFontStyle((GetColormap())->GetWhiteColor());
itsActionsMenu->SetShortcuts(kActionsMenuShortcutStr);
itsActionsMenu->SetMenuItems(kActionsMenuStr);
itsActionsMenu->SetUpdateAction(JXMenu::kDisableNone);
ListenTo(itsActionsMenu);
itsPointMenu = new 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 = new JXTextMenu(itsActionsMenu, kEmptyMenuCmd, menuBar);
assert( emptyMenu != NULL );
JXMenu* prevMenu = itsActionsMenu;
JIndex prevMenuIndex = kAdviceMenuCmd;
for (i=1; i<=kAdviceMenuCount; i++)
{
JXTextMenu* adviceMenu = new JXTextMenu(prevMenu, prevMenuIndex, menuBar);
//.........这里部分代码省略.........