TButton without shadow #209
Replies: 1 comment
-
|
Hola, Jordi! There is not a explicit way of doing this, but you can change the color palette so that the window's color is used both as the foreground and background color of shadow characters, so that they look the same as the window background. Otherwise, you would have to re-implement the If you want all // Palette indexes as documented in the header files.
const int appGrayDialogPaletteIndex = 32;
const int appBlueDialogPaletteIndex = 64;
const int appCyanDialogPaletteIndex = 96;
const int dialogButtonShadowPaletteIndex = 15;
TPalette& TMyApp::getPalette() const
{
static char cp[] = cpAppColor;
// Make foreground and background colors the same in TButton shadows.
cp[appGrayDialogPaletteIndex-1 + dialogButtonShadowPaletteIndex-1] = '\x77'; // Gray
cp[appBlueDialogPaletteIndex-1 + dialogButtonShadowPaletteIndex-1] = '\x11'; // Blue
cp[appCyanDialogPaletteIndex-1 + dialogButtonShadowPaletteIndex-1] = '\x33'; // Cyan
static TPalette palette(cp, sizeof(cp));
return palette;
}Otherwise, you can create a custom class TButtonWithoutShadow : public TButton
{
public:
using TButton::TButton;
TColorAttr mapColor(uchar index) override;
};
const int buttonShadowPaletteIndex = 8;
TColorAttr TButtonWithoutShadow::mapColor(uchar index)
{
TColorAttr original = TButton::mapColor(index);
if (index == buttonShadowPaletteIndex)
// Use the background color for both foreground and background, so that shadows are not visible.
return (original >> 4) | (original & 0xF0);
return original;
} |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Is possible to have some TButton without the shadow?
Beta Was this translation helpful? Give feedback.
All reactions