Propagate set_ui_color() up to the DesktopSettingsPrivate class.

Still needs code to save the values.
Also needs a way to access them from Decorator::UIColor(), but the DesktopSettings passed to the ctor can't be cached.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23024 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
François Revol 2007-11-30 01:21:19 +00:00
parent fef10c612a
commit 2e3233d74e
4 changed files with 64 additions and 0 deletions

View File

@ -478,6 +478,29 @@ DesktopSettingsPrivate::WorkspacesMessage(int32 index) const
}
void
DesktopSettingsPrivate::SetUIColor(color_which which, const rgb_color color)
{
//
int32 index = color_which_to_index(which);
if (index < 0 || index >= kNumColors)
return;
fShared.colors[index] = color;
Save(kAppearanceSettings);
}
rgb_color
DesktopSettingsPrivate::UIColor(color_which which) const
{
static const rgb_color invalidColor = {0, 0, 0, 0};
int32 index = color_which_to_index(which);
if (index < 0 || index >= kNumColors)
return invalidColor;
return fShared.colors[index];
}
// #pragma mark - read access
@ -563,6 +586,13 @@ DesktopSettings::WorkspacesMessage(int32 index) const
}
rgb_color
DesktopSettings::UIColor(color_which which) const
{
return fSettings->UIColor(which);
}
// #pragma mark - write access
@ -633,3 +663,11 @@ LockedDesktopSettings::SetShowAllDraggers(bool show)
fSettings->SetShowAllDraggers(show);
}
void
LockedDesktopSettings::SetUIColor(color_which which, const rgb_color color)
{
fSettings->SetUIColor(which, color);
}

View File

@ -50,6 +50,8 @@ class DesktopSettings {
int32 WorkspacesCount() const;
const BMessage* WorkspacesMessage(int32 index) const;
rgb_color UIColor(color_which which) const;
protected:
DesktopSettingsPrivate* fSettings;
};
@ -70,6 +72,8 @@ class LockedDesktopSettings : public DesktopSettings {
void SetShowAllDraggers(bool show);
void SetUIColor(color_which which, const rgb_color color);
private:
Desktop* fDesktop;
};

View File

@ -52,6 +52,8 @@ class DesktopSettingsPrivate {
void SetWorkspacesMessage(int32 index, BMessage& message);
const BMessage* WorkspacesMessage(int32 index) const;
void SetUIColor(color_which which, const rgb_color color);
rgb_color UIColor(color_which which) const;
private:
void _SetDefaults();
status_t _Load();

View File

@ -2274,6 +2274,26 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
break;
}
case AS_SET_UI_COLOR:
{
STRACE(("ServerApp %s: Set UI Color\n", Signature()));
// Attached Data:
// 1) color_which which
// 2) rgb_color color
color_which which;
rgb_color color;
link.Read<color_which>(&which);
if (link.Read<rgb_color>(&color) == B_OK) {
LockedDesktopSettings settings(fDesktop);
settings.SetUIColor(which, color);
}
fLink.StartMessage(B_OK);
fLink.Flush();
break;
}
case AS_GET_ACCELERANT_INFO:
{
STRACE(("ServerApp %s: get accelerant info\n", Signature()));