272b14759e
* BUG: Do not print included component information files. [GB.CAIRO] * NEW: The CairoMatrix class was completed. * NEW: The CairoPattern class got its Matrix and Filter properties. [GB.IMAGE] * BUG: When a component takes ownership of an image, the image format is correctly set now. * NEW: Most of the Color class was moved to this component. [GB.IMAGE.IO] * BUG: Use the right RGBA image format when loading images. [GB.V4L] * BUG: Fix the *.component file. git-svn-id: svn://localhost/gambas/trunk@1822 867c0c6c-44f3-4631-809d-bfa615b0a4ec
121 lines
3 KiB
C++
121 lines
3 KiB
C++
/***************************************************************************
|
|
|
|
CColor.cpp
|
|
|
|
(c) 2004-2006 - Daniel Campos Fernández <dcamposf@gmail.com>
|
|
|
|
GTK+ component
|
|
|
|
Realizado para la Junta de Extremadura.
|
|
Consejería de Educación Ciencia y Tecnología.
|
|
Proyecto gnuLinEx
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 1, or (at your option)
|
|
any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program; if not, write to the Free Software
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
***************************************************************************/
|
|
|
|
#define __CCOLOR_CPP
|
|
|
|
#include <math.h>
|
|
|
|
#include "CColor.h"
|
|
#include "gdesktop.h"
|
|
#include "gcolor.h"
|
|
|
|
BEGIN_PROPERTY(CCOLOR_background)
|
|
|
|
GB.ReturnInteger(gDesktop::bgColor());
|
|
|
|
END_PROPERTY
|
|
|
|
BEGIN_PROPERTY(CCOLOR_foreground)
|
|
|
|
GB.ReturnInteger(gDesktop::fgColor());
|
|
|
|
END_PROPERTY
|
|
|
|
BEGIN_PROPERTY(CCOLOR_text_background)
|
|
|
|
GB.ReturnInteger(gDesktop::textbgColor());
|
|
|
|
END_PROPERTY
|
|
|
|
BEGIN_PROPERTY(CCOLOR_text_foreground)
|
|
|
|
GB.ReturnInteger(gDesktop::textfgColor());
|
|
|
|
END_PROPERTY
|
|
|
|
BEGIN_PROPERTY(CCOLOR_selected_background)
|
|
|
|
GB.ReturnInteger(gDesktop::selbgColor());
|
|
|
|
END_PROPERTY
|
|
|
|
BEGIN_PROPERTY(CCOLOR_light_background)
|
|
|
|
int h, s, v;
|
|
int h2, s2, v2;
|
|
int r, g, b;
|
|
|
|
gt_color_to_rgb(gDesktop::selbgColor(), &r, &g, &b);
|
|
gt_rgb_to_hsv(r, g, b, &h, &s, &v);
|
|
|
|
gt_color_to_rgb(gDesktop::textbgColor(), &r, &g, &b);
|
|
gt_rgb_to_hsv(r, g, b, &h2, &s2, &v2);
|
|
|
|
gt_hsv_to_rgb(h, (s2 * 3 + s) / 4, (v2 * 3 + v) / 4, &r, &g, &b);
|
|
|
|
GB.ReturnInteger(gt_rgb_to_color(r, g, b));
|
|
|
|
END_PROPERTY
|
|
|
|
BEGIN_PROPERTY(CCOLOR_selected_foreground)
|
|
|
|
GB.ReturnInteger(gDesktop::selfgColor());
|
|
|
|
END_PROPERTY
|
|
|
|
BEGIN_PROPERTY(CCOLOR_button_background)
|
|
|
|
GB.ReturnInteger(gDesktop::buttonbgColor());
|
|
|
|
END_PROPERTY
|
|
|
|
BEGIN_PROPERTY(CCOLOR_button_foreground)
|
|
|
|
GB.ReturnInteger(gDesktop::buttonfgColor());
|
|
|
|
END_PROPERTY
|
|
|
|
GB_DESC CColorDesc[] =
|
|
{
|
|
GB_DECLARE("Color", 0), GB_VIRTUAL_CLASS(),
|
|
|
|
GB_STATIC_PROPERTY("Background", "i", CCOLOR_background),
|
|
GB_STATIC_PROPERTY("SelectedBackground", "i", CCOLOR_selected_background),
|
|
GB_STATIC_PROPERTY("LightBackground", "i", CCOLOR_light_background),
|
|
GB_STATIC_PROPERTY("TextBackground", "i", CCOLOR_text_background),
|
|
GB_STATIC_PROPERTY("ButtonBackground", "i", CCOLOR_button_background),
|
|
|
|
GB_STATIC_PROPERTY("Foreground", "i", CCOLOR_foreground),
|
|
GB_STATIC_PROPERTY("SelectedForeground", "i", CCOLOR_selected_foreground),
|
|
GB_STATIC_PROPERTY("TextForeground", "i", CCOLOR_text_foreground),
|
|
GB_STATIC_PROPERTY("ButtonForeground", "i", CCOLOR_button_foreground),
|
|
|
|
GB_END_DECLARE
|
|
};
|
|
|
|
|