1 | // Aseprite |
---|---|
2 | // Copyright (C) 2001-2017 David Capello |
3 | // |
4 | // This program is distributed under the terms of |
5 | // the End-User License Agreement for Aseprite. |
6 | |
7 | #ifdef HAVE_CONFIG_H |
8 | #include "config.h" |
9 | #endif |
10 | |
11 | #include "app/app.h" |
12 | #include "app/commands/command.h" |
13 | #include "app/ui/main_window.h" |
14 | |
15 | namespace app { |
16 | |
17 | using namespace ui; |
18 | |
19 | class HomeCommand : public Command { |
20 | public: |
21 | HomeCommand(); |
22 | ~HomeCommand(); |
23 | |
24 | protected: |
25 | void onExecute(Context* context) override; |
26 | bool onEnabled(Context* context) override; |
27 | }; |
28 | |
29 | HomeCommand::HomeCommand() |
30 | : Command(CommandId::Home(), CmdUIOnlyFlag) |
31 | { |
32 | } |
33 | |
34 | HomeCommand::~HomeCommand() |
35 | { |
36 | } |
37 | |
38 | void HomeCommand::onExecute(Context* context) |
39 | { |
40 | App::instance()->mainWindow()->showHome(); |
41 | } |
42 | |
43 | bool HomeCommand::onEnabled(Context* context) |
44 | { |
45 | return !App::instance()->mainWindow()->isHomeSelected(); |
46 | } |
47 | |
48 | Command* CommandFactory::createHomeCommand() |
49 | { |
50 | return new HomeCommand; |
51 | } |
52 | |
53 | } // namespace app |
54 |