clearFlatBorder() replace now a double flatline with a single flatline

This commit is contained in:
Markus Gans 2016-09-03 15:17:48 +02:00
parent 817e033d57
commit 3d0f046de9
6 changed files with 105 additions and 16 deletions

View File

@ -1,3 +1,9 @@
2016-09-03 Markus Gans <guru.mail@muenster.de>
* The method clearFlatBorder() replace now a double flatline
with a single flatline
* Add the possibility to set the double_flatline_mask for
every position on all sides
2016-09-02 Markus Gans <guru.mail@muenster.de>
* Method setGeometry assigns now the full widget size to
the double_flatline_mask (previously, it was the adjust size)

View File

@ -172,7 +172,7 @@ void FButton::draw()
// noshadow + indent one character to the right
if ( is_Flat )
clearFlatBorder();
else
clearShadow();
if ( parent_widget )

View File

@ -94,6 +94,7 @@ static uInt character[][fc::NUM_OF_ENCODINGS] =
{0x1ad9, 0, 0xd9, 0}, // ( - NF_radio_button1
{0x1ada, 0, 0xda, 0}, // ⎡ - NF_border_corner_upper_left
{0x1adc, 0, 0xdc, 0}, // ✓ - NF_shadow_box_checked
{0x1ae7, 0, 0xe7, 0}, // ║ - NF_rev_border_line_right_and_left
{0x1ae8, 0, 0xe8, 0}, // ◣ - NF_rev_up_pointing_triangle2
{0x1ae9, 0, 0xe9, 0}, // ◤ - NF_rev_down_pointing_triangle2
{0x1af4, 0, 0xf4, 0}, // ] - NF_rev_menu_button3

View File

@ -2260,30 +2260,53 @@ void FWidget::clearFlatBorder()
else
setColor (wc.dialog_fg, wc.dialog_bg);
// clear on left side
for (register int y=0; y < height; y++)
{
gotoxy (x1-1, y1+y+1);
print (' '); // clear on left side
if ( double_flatline_mask.left[uLong(y)] )
print (fc::NF_border_line_left);
else
print (' ');
}
gotoxy (x2, y1+1);
for (register int y=1; y <= height; y++)
// clear on right side
for (register int y=0; y < height; y++)
{
print (' '); // clear on right side
gotoxy (x2, y1+y+1);
if ( double_flatline_mask.right[uLong(y)] )
print (fc::NF_rev_border_line_right);
else
print (' ');
}
// clear at top
gotoxy (x1, y1);
for (register int x=0; x < width; x++)
print (' '); // clear at bottom
gotoxy (x1, y2);
for (register int x=0; x < width; x++)
print (' '); // clear at top
{
if ( double_flatline_mask.top[uLong(x)] )
print (fc::NF_border_line_upper);
else
print (' ');
}
// clear at bottom
gotoxy (x1, y2);
for (register int x=0; x < width; x++)
{
if ( double_flatline_mask.bottom[uLong(x)] )
print (fc::NF_border_line_bottom);
else
print (' ');
}
}
//----------------------------------------------------------------------
void FWidget::setDoubleFlatLine(int side, bool bit)
void FWidget::setDoubleFlatLine (int side, bool bit)
{
uLong size;
@ -2320,7 +2343,60 @@ void FWidget::setDoubleFlatLine(int side, bool bit)
}
//----------------------------------------------------------------------
std::vector<bool>& FWidget::doubleFlatLine_ref(int side)
void FWidget::setDoubleFlatLine (int side, int pos, bool bit)
{
uLong size, index;
assert ( side == fc::top
|| side == fc::right
|| side == fc::bottom
|| side == fc::left );
assert ( pos >= 1 );
index = uLong(pos - 1);
switch ( side )
{
case fc::top:
size = double_flatline_mask.top.size();
if ( index < size )
double_flatline_mask.top[index] = bit;
break;
case fc::right:
size = double_flatline_mask.right.size();
if ( index < size )
double_flatline_mask.right[index] = bit;
break;
case fc::bottom:
size = double_flatline_mask.bottom.size();
if ( index < size )
double_flatline_mask.bottom[index] = bit;
break;
case fc::left:
size = double_flatline_mask.left.size();
if ( index < size )
double_flatline_mask.left[index] = bit;
break;
default:
break;
}
}
//----------------------------------------------------------------------
std::vector<bool>& FWidget::doubleFlatLine_ref (int side)
{
assert ( side == fc::top
|| side == fc::right

View File

@ -532,9 +532,11 @@ class FWidget : public FObject, public FTerm
void clearShadow();
void drawFlatBorder();
void clearFlatBorder();
void setDoubleFlatLine(int, bool = true);
void unsetDoubleFlatLine(int);
std::vector<bool>& doubleFlatLine_ref(int);
void setDoubleFlatLine (int, bool = true);
void unsetDoubleFlatLine (int);
void setDoubleFlatLine (int, int, bool = true);
void unsetDoubleFlatLine (int, int);
std::vector<bool>& doubleFlatLine_ref (int);
virtual void drawBorder();
static void quit();
@ -1096,6 +1098,10 @@ inline bool FWidget::isInheritBackground()
inline void FWidget::unsetDoubleFlatLine(int side)
{ setDoubleFlatLine(side, false); }
//----------------------------------------------------------------------
inline void FWidget::unsetDoubleFlatLine(int side, int pos)
{ setDoubleFlatLine(side, pos, false); }
// NewFont elements
//----------------------------------------------------------------------

View File

@ -347,7 +347,7 @@ MyDialog::MyDialog (FWidget* parent)
MyButton2->setStatusbarMessage ("Cosine function");
MyButton2->setNoUnderline();
MyButton2->setFlat();
MyButton2->setDoubleFlatLine(fc::top);
MyButton2->setDoubleFlatLine (fc::top);
FButton* MyButton3 = new FButton (this);
MyButton3->setGeometry(10, 3, 5, 3);