- Subject: Re: [slang-users] SLtt_set_color_object help
- From: "John E. Davis" <davis@xxxxxxxxxxxxx>
- Date: Sat, 25 Sep 2004 12:06:06 -0400
Ben Duncan <ben@xxxxxxxxxxxxxxxxxx> wrote:
>Ok, I have RTFM and have found no help other than passing remarks
>on Setting attributes such as BOLD, BLINK, etc...
>
>I see several "SLtt_" color and attribute routines.
The function SLsmg_set_color is used to set the "color" used for
subsequent SLsmg calls. The term "color" in this context does not
refer to an actual color, rather it refers to an abstract object that
may have color attributes. Perhaps if I were to do it over again, I
would not have used the word color but something else such as "brush".
This "object" may have attributes attached to it in several ways using
the appropriate SLtt functions:
extern SLtt_Char_Type SLtt_get_color_object (int);
void SLtt_set_color_object (color_obj, attr);
void SLtt_set_color (color_obj, NULL, fg_color_name, bg_color_name);
void SLtt_set_mono (color_obj, NULL, attr);
void SLtt_add_color_attribute (color_obj, attr);
Here, "color_obj" refers to to the abstract object that SLsmg deals
with, and "attr" represents specific properties of this object that
only the SLtt interface understands. slang.h contains these constants that
may be used to specifiy attr:
#define SLTT_BOLD_MASK 0x01000000UL
#define SLTT_BLINK_MASK 0x02000000UL
#define SLTT_ULINE_MASK 0x04000000UL
#define SLTT_REV_MASK 0x08000000UL
I recommend that you use these values as follows:
1. In your code, identify objects that you would like to give
specific visual properties, e.g., "menu_shadow". Then choose a
number in the range 1-128 to repesent this object:
#define MENU_SHADOW_COLOR 10
2. Assign a color to the object using SLtt_set_color:
SLtt_set_color (MENU_SHADOW_COLOR, "blue", "black");
If you want this object to blink or be underlined (probably not
a good idea for a shadow), you may attach such attributes to the
object via SLtt_add_color_attribute:
SLtt_add_color_attribute (MENU_SHADOW_COLOR,
SLTT_ULINE_ATTRIBUTE|SLTT_BLINK_ATTRIBUTE);
3. Prior to drawing the menu shadow, use
SLsmg_set_color (MENU_SHADOW_COLOR);
Then when the lower-level SLtt interface renders this object, it
will try to do so using a blue foreground, black background, and
issue the appropriate escape sequences to the terminal to cause
it to underline and blink the characters.
I hope this clarifies things a bit.
Thanks,
--John
_______________________________________________
To unsubscribe, visit http://jedsoft.org/slang/mailinglists.html
[2004 date index]
[2004 thread index]
[Thread Prev] [Thread Next]
[Date Prev] [Date Next]