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
15namespace app {
16
17using namespace ui;
18
19class HomeCommand : public Command {
20public:
21 HomeCommand();
22 ~HomeCommand();
23
24protected:
25 void onExecute(Context* context) override;
26 bool onEnabled(Context* context) override;
27};
28
29HomeCommand::HomeCommand()
30 : Command(CommandId::Home(), CmdUIOnlyFlag)
31{
32}
33
34HomeCommand::~HomeCommand()
35{
36}
37
38void HomeCommand::onExecute(Context* context)
39{
40 App::instance()->mainWindow()->showHome();
41}
42
43bool HomeCommand::onEnabled(Context* context)
44{
45 return !App::instance()->mainWindow()->isHomeSelected();
46}
47
48Command* CommandFactory::createHomeCommand()
49{
50 return new HomeCommand;
51}
52
53} // namespace app
54