Dialogs can now be displayed without a border
This commit is contained in:
parent
53d2f04e77
commit
20c3cf218e
|
@ -1,3 +1,7 @@
|
|||
2020-04-09 Markus Gans <guru.mail@muenster.de>
|
||||
* A dialog can now be displayed without a framing border.
|
||||
Many thanks to basedtho for this tip
|
||||
|
||||
2020-03-22 Markus Gans <guru.mail@muenster.de>
|
||||
* A small benchmakt test was added to the Rotozoomer example
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ class RotoZoomer : public finalcut::FDialog
|
|||
int loops{0};
|
||||
int path{0};
|
||||
wchar_t data[256]{};
|
||||
finalcut::FString report;
|
||||
finalcut::FString report{};
|
||||
time_point<system_clock> start{};
|
||||
time_point<system_clock> end{};
|
||||
};
|
||||
|
|
|
@ -116,6 +116,28 @@ bool FDialog::setScrollable (bool enable)
|
|||
return (setFlags().scrollable = enable);
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FDialog::setBorder (bool enable)
|
||||
{
|
||||
if ( enable )
|
||||
{
|
||||
setTopPadding(2);
|
||||
setLeftPadding(1);
|
||||
setBottomPadding(1);
|
||||
setRightPadding(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
setTopPadding(1);
|
||||
setLeftPadding(0);
|
||||
setBottomPadding(0);
|
||||
setRightPadding(0);
|
||||
}
|
||||
|
||||
return (setFlags().no_border = ! enable);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FDialog::setResizeable (bool enable)
|
||||
{
|
||||
|
@ -906,6 +928,9 @@ void FDialog::initCloseMenuItem (FMenu* menu)
|
|||
//----------------------------------------------------------------------
|
||||
void FDialog::drawBorder()
|
||||
{
|
||||
if ( ! hasBorder() )
|
||||
return;
|
||||
|
||||
if ( (getMoveSizeWidget() == this || ! resize_click_pos.isOrigin() )
|
||||
&& ! isZoomed() )
|
||||
{
|
||||
|
|
|
@ -75,6 +75,14 @@ void FToolTip::setText (const FString& txt)
|
|||
calculateDimensions();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FToolTip::setBorder (bool enable)
|
||||
{
|
||||
setFlags().no_border = ! enable;
|
||||
calculateDimensions();
|
||||
return hasBorder();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FToolTip::show()
|
||||
{
|
||||
|
@ -116,14 +124,18 @@ void FToolTip::init()
|
|||
//----------------------------------------------------------------------
|
||||
void FToolTip::draw()
|
||||
{
|
||||
int y{0};
|
||||
bool border = hasBorder();
|
||||
int y{( border ) ? 2 : 1};
|
||||
int x{( border ) ? 3 : 2};
|
||||
setColor();
|
||||
clearArea();
|
||||
drawBorder();
|
||||
|
||||
if ( border )
|
||||
drawBorder();
|
||||
|
||||
for (auto&& line : text_components)
|
||||
{
|
||||
print() << FPoint(3, 2 + y) << line;
|
||||
print() << FPoint(x, y) << line;
|
||||
y++;
|
||||
}
|
||||
}
|
||||
|
@ -147,8 +159,8 @@ void FToolTip::calculateDimensions()
|
|||
}
|
||||
|
||||
int x{}, y{};
|
||||
const std::size_t h = text_num_lines + 2;
|
||||
const std::size_t w = max_line_width + 4;
|
||||
const std::size_t h = ( hasBorder() ) ? text_num_lines + 2 : text_num_lines;
|
||||
const std::size_t w = ( hasBorder() ) ? max_line_width + 4 : max_line_width + 2;
|
||||
const auto& r = getRootWidget();
|
||||
|
||||
if ( r )
|
||||
|
|
|
@ -105,11 +105,15 @@ class FDialog : public FWindow
|
|||
bool setScrollable (bool);
|
||||
bool setScrollable();
|
||||
bool unsetScrollable();
|
||||
bool setBorder (bool);
|
||||
bool setBorder();
|
||||
bool unsetBorder();
|
||||
void setText (const FString&);
|
||||
|
||||
// Inquiries
|
||||
bool isModal() const;
|
||||
bool isScrollable() const;
|
||||
bool hasBorder() const;
|
||||
|
||||
// Methods
|
||||
void show() override;
|
||||
|
@ -264,6 +268,14 @@ inline bool FDialog::setScrollable()
|
|||
inline bool FDialog::unsetScrollable()
|
||||
{ return setScrollable(false); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FDialog::setBorder()
|
||||
{ return setBorder(true); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FDialog::unsetBorder()
|
||||
{ return setBorder(false); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FDialog::setText (const FString& txt)
|
||||
{ tb_text.setString(txt); }
|
||||
|
@ -276,6 +288,10 @@ inline bool FDialog::isModal() const
|
|||
inline bool FDialog::isScrollable() const
|
||||
{ return getFlags().scrollable; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FDialog::hasBorder() const
|
||||
{ return ! getFlags().no_border; }
|
||||
|
||||
} // namespace finalcut
|
||||
|
||||
#endif // FDIALOG_H
|
||||
|
|
|
@ -85,6 +85,12 @@ class FToolTip : public FWindow
|
|||
|
||||
// Mutators
|
||||
void setText (const FString&);
|
||||
bool setBorder (bool);
|
||||
bool setBorder();
|
||||
bool unsetBorder();
|
||||
|
||||
// Inquiries
|
||||
bool hasBorder() const;
|
||||
|
||||
// Methods
|
||||
void show() override;
|
||||
|
@ -113,6 +119,18 @@ class FToolTip : public FWindow
|
|||
inline const FString FToolTip::getClassName() const
|
||||
{ return "FToolTip"; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FToolTip::setBorder()
|
||||
{ return setBorder(true); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FToolTip::unsetBorder()
|
||||
{ return setBorder(false); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FToolTip::hasBorder() const
|
||||
{ return ! getFlags().no_border; }
|
||||
|
||||
} // namespace finalcut
|
||||
|
||||
#endif // FTOOLTIP_H
|
||||
|
|
|
@ -166,8 +166,9 @@ class FWidget : public FVTerm, public FObject
|
|||
uInt32 menu_widget : 1;
|
||||
uInt32 always_on_top : 1;
|
||||
uInt32 flat : 1;
|
||||
uInt32 no_border : 1;
|
||||
uInt32 no_underline : 1;
|
||||
uInt32 : 14; // padding bits
|
||||
uInt32 : 13; // padding bits
|
||||
};
|
||||
|
||||
// Constructor
|
||||
|
|
Loading…
Reference in New Issue