1// Aseprite
2// Copyright (C) 2019 Igara Studio S.A.
3// Copyright (C) 2017 David Capello
4//
5// This program is distributed under the terms of
6// the End-User License Agreement for Aseprite.
7
8#ifndef APP_UI_EDITOR_MOVING_SELECTION_STATE_H_INCLUDED
9#define APP_UI_EDITOR_MOVING_SELECTION_STATE_H_INCLUDED
10#pragma once
11
12#include "app/context.h"
13#include "app/ui/editor/standby_state.h"
14#include "obs/connection.h"
15
16namespace app {
17 class MovingSelectionState : public StandbyState {
18 public:
19 MovingSelectionState(Editor* editor, ui::MouseMessage* msg);
20
21 // EditorState
22 virtual void onEnterState(Editor* editor) override;
23 virtual LeaveAction onLeaveState(Editor* editor, EditorState* newState) override;
24 virtual bool onMouseDown(Editor* editor, ui::MouseMessage* msg) override;
25 virtual bool onMouseUp(Editor* editor, ui::MouseMessage* msg) override;
26 virtual bool onMouseMove(Editor* editor, ui::MouseMessage* msg) override;
27 virtual bool onSetCursor(Editor* editor, const gfx::Point& mouseScreenPos) override;
28 virtual bool onUpdateStatusBar(Editor* editor) override;
29 virtual void onBeforePopState(Editor* editor) override;
30 virtual bool requireBrushPreview() override { return false; }
31
32 private:
33 // ContextObserver
34 void onBeforeCommandExecution(CommandExecutionEvent& ev);
35
36 Editor* m_editor;
37 gfx::Point m_cursorStart;
38 gfx::Point m_selOrigin;
39 gfx::Point m_delta;
40 obs::scoped_connection m_ctxConn;
41 bool m_selectionCanceled;
42 };
43
44} // namespace app
45
46#endif // APP_UI_EDITOR_MOVING_PIXELS_STATE_H_INCLUDED
47