本文整理汇总了C++中TrackerSettings::SetUsedSpaceColor方法的典型用法代码示例。如果您正苦于以下问题:C++ TrackerSettings::SetUsedSpaceColor方法的具体用法?C++ TrackerSettings::SetUsedSpaceColor怎么用?C++ TrackerSettings::SetUsedSpaceColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TrackerSettings
的用法示例。
在下文中一共展示了TrackerSettings::SetUsedSpaceColor方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
SpaceBarSettingsView::SetDefaults()
{
TTracker* tracker = dynamic_cast<TTracker*>(be_app);
if (tracker == NULL)
return;
TrackerSettings settings;
if (!settings.ShowVolumeSpaceBar()) {
settings.SetShowVolumeSpaceBar(true);
send_bool_notices(kShowVolumeSpaceBar, "ShowVolumeSpaceBar", true);
}
if (settings.UsedSpaceColor() != kDefaultUsedSpaceColor
|| settings.FreeSpaceColor() != kDefaultFreeSpaceColor
|| settings.WarningSpaceColor() != kDefaultWarningSpaceColor) {
settings.SetUsedSpaceColor(kDefaultUsedSpaceColor);
settings.SetFreeSpaceColor(kDefaultFreeSpaceColor);
settings.SetWarningSpaceColor(kDefaultWarningSpaceColor);
tracker->SendNotices(kSpaceBarColorChanged);
}
ShowCurrentSettings();
}
示例2: Window
void
SpaceBarSettingsView::MessageReceived(BMessage* message)
{
TTracker* tracker = dynamic_cast<TTracker*>(be_app);
if (tracker == NULL)
return;
TrackerSettings settings;
switch (message->what) {
case kUpdateVolumeSpaceBar:
{
settings.SetShowVolumeSpaceBar(
fSpaceBarShowCheckBox->Value() == 1);
Window()->PostMessage(kSettingsContentsModified);
tracker->PostMessage(kShowVolumeSpaceBar);
break;
}
case kSpaceBarSwitchColor:
{
fCurrentColor = message->FindInt32("index");
switch (fCurrentColor) {
case 0:
fColorControl->SetValue(settings.UsedSpaceColor());
break;
case 1:
fColorControl->SetValue(settings.FreeSpaceColor());
break;
case 2:
fColorControl->SetValue(settings.WarningSpaceColor());
break;
}
break;
}
case kSpaceBarColorChanged:
{
rgb_color color = fColorControl->ValueAsColor();
color.alpha = kSpaceBarAlpha;
// alpha is ignored by BColorControl but is checked
// in equalities
switch (fCurrentColor) {
case 0:
settings.SetUsedSpaceColor(color);
break;
case 1:
settings.SetFreeSpaceColor(color);
break;
case 2:
settings.SetWarningSpaceColor(color);
break;
}
BWindow* window = Window();
if (window != NULL)
window->PostMessage(kSettingsContentsModified);
tracker->PostMessage(kSpaceBarColorChanged);
break;
}
default:
_inherited::MessageReceived(message);
break;
}
}