From cd0ea6ff0fe476f59da696583d5a0daaa7c42596 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Tue, 18 Apr 2006 12:14:59 +0000 Subject: [PATCH] * Added some of the rgb_color methods from Dano/Zeta. * The private general_info structure is now setup - that fixes a part of bug #502; NetPositive's bar remains black, though. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17160 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/os/interface/GraphicsDefs.h | 19 +++++++++++++++++++ src/kits/interface/InterfaceDefs.cpp | 17 ++++++++++------- 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/headers/os/interface/GraphicsDefs.h b/headers/os/interface/GraphicsDefs.h index 012cf6a864..4b56d4aebf 100644 --- a/headers/os/interface/GraphicsDefs.h +++ b/headers/os/interface/GraphicsDefs.h @@ -80,6 +80,16 @@ typedef struct rgb_color { #if defined(__cplusplus) // some convenient additions + inline rgb_color& + set_to(uint8 r, uint8 g, uint8 b, uint8 a = 255) + { + red = r; + green = g; + blue = b; + alpha = a; + return *this; + } + inline bool operator==(const rgb_color& other) const { @@ -94,6 +104,15 @@ typedef struct rgb_color { #endif } rgb_color; +#if defined(__cplusplus) +inline rgb_color +make_color(uint8 red, uint8 green, uint8 blue, uint8 alpha = 255) +{ + rgb_color color = {red, green, blue, alpha}; + return color; +} +#endif + //------------------------------------------------------------------------------ extern _IMPEXP_BE const rgb_color B_TRANSPARENT_COLOR; diff --git a/src/kits/interface/InterfaceDefs.cpp b/src/kits/interface/InterfaceDefs.cpp index 822d370bad..40204953b5 100644 --- a/src/kits/interface/InterfaceDefs.cpp +++ b/src/kits/interface/InterfaceDefs.cpp @@ -29,7 +29,6 @@ #include #include #include -#include #include "moreUTF8.h" #include "truncate_string.h" @@ -687,20 +686,19 @@ mouse_mode() _IMPEXP_BE rgb_color ui_color(color_which which) { - if(be_app) { - + if (be_app) { rgb_color color; BPrivate::AppServerLink link; link.StartMessage(AS_GET_UI_COLOR); link.Attach(which); - + int32 code; if (link.FlushWithReply(code) == B_OK && code == B_OK) { link.Read(&color); return color; } } - + switch (which) { case B_PANEL_BACKGROUND_COLOR: return make_color(216,216,216); @@ -783,8 +781,7 @@ rgb_color shift_color(rgb_color color, float shift); rgb_color shift_color(rgb_color color, float shift) { - // TODO: dunno what this is supposed to do, but BeIDE expects it to be there... - return color; + return tint_color(color, shift); } @@ -823,6 +820,12 @@ _init_interface_kit_() _menu_info_ptr_ = &BMenu::sMenuInfo; status_t status = load_menu_settings(BMenu::sMenuInfo); + general_info.background_color = ui_color(B_PANEL_BACKGROUND_COLOR); + general_info.mark_color.set_to(0, 0, 0); + general_info.highlight_color = ui_color(B_CONTROL_HIGHLIGHT_COLOR); + general_info.window_frame_color = ui_color(B_WINDOW_TAB_COLOR); + general_info.color_frame = true; + // TODO: fill the other static members return status;