-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFileItem.h
More file actions
72 lines (53 loc) · 1.67 KB
/
FileItem.h
File metadata and controls
72 lines (53 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
//
// Created by Kristal Hong on 11/21/23.
//
#ifndef CS8_FILETREE_FILEITEM_H
#define CS8_FILETREE_FILEITEM_H
#include <SFML/Graphics.hpp>
#include <iostream>
#include "Image.h"
#include "Item.h"
#include "States.h"
#include "ItemList.h"
class FileItem : public Item
{
public:
//Constructors
FileItem();
FileItem(std::string text, sf::Vector2f size, sf::Vector2f position);
//GUIComponent pure virtual functions, refer to the TextInput Project for Info
virtual void draw(sf::RenderTarget& window, sf::RenderStates states) const;
//I use this function to highlight the item when clicked, and unhighlight when something
//else is clicked
virtual void addEventHandler(sf::RenderWindow& window, sf::Event event);
// //Returns the bounds of the item
// sf::FloatRect getGlobalBounds() const;
//
// //returns the size of the item
// sf::Vector2f getSize() const;
//
// //returns the size of the item
// sf::Vector2f getPosition() const;
//sets the position of the item
void setPosition(sf::Vector2f position);
//uses an enum to change the icon to a folder or file
void setIcon(const std::string& filename);
// Set the file path
void setFilePath(const std::string& path);
// Get the file path
std::string getFilePath() const;
void setPNGImage(const std::string& filename);
private:
void setIconPosition();
void resizeIcon();
void setPNGPosition();
//this is the folder or file icon
sf::Sprite icon;
sf::Sprite imagePNG;
float padding = 5;
sf::Texture texturePNG;
sf::Texture texture;
sf::RectangleShape shape;
sf::Text labelText;
};
#endif //CS8_FILETREE_FILEITEM_H