1// Aseprite
2// Copyright (C) 2019 Igara Studio S.A.
3//
4// This program is distributed under the terms of
5// the End-User License Agreement for Aseprite.
6
7#ifndef APP_UI_FILENAME_FIELD_H_INCLUDED
8#define APP_UI_FILENAME_FIELD_H_INCLUDED
9#pragma once
10
11#include "obs/signal.h"
12#include "ui/box.h"
13#include "ui/button.h"
14#include "ui/entry.h"
15
16#include <string>
17
18namespace app {
19
20 class FilenameField : public ui::HBox {
21 public:
22 enum Type { EntryAndButton, ButtonOnly };
23
24 FilenameField(const Type type,
25 const std::string& pathAndFilename);
26
27 std::string filename() const;
28 void setFilename(const std::string& fn);
29
30 obs::signal<std::string()> SelectFile;
31 obs::signal<void()> Change;
32
33 protected:
34 bool onProcessMessage(ui::Message* msg) override;
35 void onInitTheme(ui::InitThemeEvent& ev) override;
36
37 private:
38 void updateWidgets();
39
40 std::string m_path;
41 std::string m_file;
42 ui::Entry* m_entry;
43 ui::Button m_button;
44 };
45
46} // namespace app
47
48#endif
49