Kage Studio 0.7.230612
A Simple Free and Open Source 2D Animation Software
Loading...
Searching...
No Matches
asset.h
Go to the documentation of this file.
1/*
2 * Kage Studio - a simple free and open source vector-based 2D animation software
3 * Copyright (C) 2011~2023 Mj Mendoza IV
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18 * MA 02110-1301, USA. Or, see <https://www.gnu.org/licenses/>.
19 *
20 */
21
22#ifndef GTKMM_KAGE_ASSET_H
23 #define GTKMM_KAGE_ASSET_H
24
25 #include <gtkmm/drawingarea.h>
26 #include <gtkmm/entry.h>
27 #include <time.h>
28 #include "../../util/string/stringhelper.h"
29
30 class KageAssetManager;
31
32 class KageAsset : public Gtk::DrawingArea {
33 public:
34 enum AssetType {
38 };
39
40 static bool mouseIsDown;
41 static Glib::RefPtr<Gdk::Pixbuf> iconASSET_IMAGE;
42 static Glib::RefPtr<Gdk::Pixbuf> iconASSET_KAGE;
43 static Glib::RefPtr<Gdk::Pixbuf> iconASSET_VIDEO;
44
45 Glib::RefPtr<Gdk::Window> window;
46
47 KageAsset(KageAssetManager *p_assetManager, unsigned p_assetID);
48 virtual ~KageAsset();
49
50 void setAssetHash(string p_assetHash);
51 string getAssetHash();
52
53 void setFilePath(string p_filePath);
54 string getFilePath();
55 void setFileName(string p_fileName);
56 string getFileName();
57
58 void setLabel(string p_label);
59 string getLabel();
60 void setSelected(bool p_selected);
61 bool isSelected();
62 void setFocus();
63
64 void setAssetType(KageAsset::AssetType p_assetType);
66
67 unsigned int assetID;
68
69 void forceRender();
70 virtual bool invalidateToRender();
71 Gtk::Entry _txtLabel;
72 void txtLabel_onEnter();
73
74 void addEventsListener();
75
76 void render(unsigned int p_assetID);
77 protected:
78 string _assetHash;
79
80 //Override default signal handler:
81 virtual bool on_expose_event(GdkEventExpose *e);
82 virtual bool on_key_press_event(GdkEventKey *e) override;
83 virtual bool on_key_release_event(GdkEventKey *e) override;
84 virtual bool on_event(GdkEvent *e) override;
85
86 bool on_draw(const Cairo::RefPtr<Cairo::Context>& cr) override;
89 string _label;
90
92 string _filePath;
93 string _fileName;
94
95 unsigned int _renderAssetID;
96 bool _CTRL;
97 };
98#endif // GTKMM_KAGE_ASSET_H
forward declaration
Definition: asset.h:32
KageAsset::AssetType getAssetType()
Definition: asset.cpp:301
virtual bool on_key_release_event(GdkEventKey *e) override
Definition: asset.cpp:91
bool _CTRL
Definition: asset.h:96
AssetType
Definition: asset.h:34
@ ASSET_KAGE
Definition: asset.h:36
@ ASSET_IMAGE
Definition: asset.h:35
@ ASSET_VIDEO
Definition: asset.h:37
Gtk::Entry _txtLabel
Definition: asset.h:71
void setFileName(string p_fileName)
Set the original File Name where this ASSET was loaded.
Definition: asset.cpp:271
void setFilePath(string p_filePath)
Definition: asset.cpp:260
void setFocus()
Definition: asset.cpp:293
void setAssetType(KageAsset::AssetType p_assetType)
Definition: asset.cpp:297
string getLabel()
Definition: asset.cpp:282
bool _selected
Definition: asset.h:87
string _label
Definition: asset.h:89
static bool mouseIsDown
Definition: asset.h:40
KageAsset::AssetType _assetType
Definition: asset.h:88
void addEventsListener()
Definition: asset.cpp:68
void render(unsigned int p_assetID)
Definition: asset.cpp:305
bool isSelected()
Definition: asset.cpp:289
void setAssetHash(string p_assetHash)
When User imports a file, the original file is copied inside project file; the copied file name will ...
Definition: asset.cpp:253
unsigned int _renderAssetID
Definition: asset.h:95
virtual bool invalidateToRender()
Definition: asset.cpp:168
static Glib::RefPtr< Gdk::Pixbuf > iconASSET_VIDEO
Definition: asset.h:43
virtual bool on_key_press_event(GdkEventKey *e) override
Definition: asset.cpp:82
void setSelected(bool p_selected)
Definition: asset.cpp:285
virtual bool on_event(GdkEvent *e) override
Definition: asset.cpp:111
void txtLabel_onEnter()
Definition: asset.cpp:77
string _filePath
Definition: asset.h:92
virtual ~KageAsset()
Definition: asset.cpp:64
bool on_draw(const Cairo::RefPtr< Cairo::Context > &cr) override
Definition: asset.cpp:192
string getFilePath()
Definition: asset.cpp:263
void forceRender()
Definition: asset.cpp:160
string _fileName
Definition: asset.h:93
Glib::RefPtr< Gdk::Window > window
Definition: asset.h:45
string _assetHash
Definition: asset.h:78
string getAssetHash()
Definition: asset.cpp:256
static Glib::RefPtr< Gdk::Pixbuf > iconASSET_IMAGE
Definition: asset.h:41
void setLabel(string p_label)
Definition: asset.cpp:278
KageAssetManager * _assetManager
Definition: asset.h:91
string getFileName()
Definition: asset.cpp:274
unsigned int assetID
Definition: asset.h:67
static Glib::RefPtr< Gdk::Pixbuf > iconASSET_KAGE
Definition: asset.h:42
virtual bool on_expose_event(GdkEventExpose *e)
Definition: asset.cpp:100
Definition: assetmanager.h:34