本文整理汇总了C++中JXColormap::GetRedColor方法的典型用法代码示例。如果您正苦于以下问题:C++ JXColormap::GetRedColor方法的具体用法?C++ JXColormap::GetRedColor怎么用?C++ JXColormap::GetRedColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JXColormap
的用法示例。
在下文中一共展示了JXColormap::GetRedColor方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetColormap
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));
}
示例2: GetColormap
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);
}
示例3: ellipseRect
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);
//.........这里部分代码省略.........
示例4: JXTextButton
//.........这里部分代码省略.........
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);
}
示例5: ellipseRect
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));
//.........这里部分代码省略.........
示例6: if
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);
}
}
示例7: JXImageMenu
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);
}
}
}
示例8: JXMenuBar
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;
//.........这里部分代码省略.........