Closed pavelvm5 closed 2 years ago
Widget colors
The fastest and easiest way to change the colors is to activate the dark color theme.
FStartOptions::getInstance().dark_theme = true;
You can also read the chapter on user themes, where I described how to create your own theme.
https://github.com/gansm/finalcut/wiki/User-Themes#user-themes
Escape key in dialogs
The escape key press event can be caught by overwriting the onKeyPress method.
Here is a small example:
#include <final/final.h>
using namespace finalcut;
class myDialog : public FDialog
{
public:
explicit myDialog (FWidget* parent = nullptr)
: FDialog{parent}
{
button.addCallback
(
"clicked",
[this] () { close(); }
);
}
void onKeyPress (FKeyEvent* ev) override
{
if ( ! ev->isAccepted() && isEscapeKey(ev->key()) )
{
ev->accept();
// Do nothing...
}
else
FDialog::onKeyPress(ev);
}
private:
void initLayout()
{
setText ("Dialog window");
setGeometry (FPoint{25, 5}, FSize{20, 6});
button.setGeometry (FPoint{5, 2}, FSize{10, 1});
FDialog::initLayout();
}
FButton button{"&Close", this};
};
int main (int argc, char* argv[])
{
// Enable dark theme
FStartOptions::getInstance().dark_theme = true;
FApplication app(argc, argv);
FMenuBar menubar{&app};
FMenuItem exit{"E&xit", &menubar};
exit.addCallback
(
"clicked",
finalcut::getFApplication(),
&finalcut::FApplication::cb_exitApp,
&menubar
);
myDialog* dialog = new myDialog(&menubar);
FWidget::setMainWidget(&menubar);
dialog->focusFirstChild();
menubar.show();
return app.exec();
}
Thanks, I am very grateful to you.
Good to know I could help.
Hello, it's me again)
I can't find any functions to change title, focus-button, and background (which is blue in app by default) colours in FDialogs, Fwidget in which I create new Fdialogs and in FApplication. For example, i want to make less contrasting theme Grey-Cyan-White, or smth like this. Can you tell me how to make it, or add this features if they aren't exist.
Can i disable esc-button from closing last fdialog or how to override Fclosing event only on this button.
I think, these one are last questions:)