MCPcopy Create free account
hub / github.com/LemonOSProject/LemonOS / FileButton

Class FileButton

LibLemon/src/gui/fileview.cpp:105–132  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

103 }
104
105 class FileButton : public Button{
106 public:
107 std::string file;
108 int icon = 0;
109 FileButton(const char* _label, rect_t _bounds) : Button(_label, _bounds){
110 drawText = false;
111 }
112
113 void Paint(surface_t* surface){
114 surface_t* iconS = nullptr;
115 switch(icon){
116 case 1:
117 iconS = &FileView::diskIconSml;
118 break;
119 case 2:
120 iconS = &FileView::diskIconSml;//ramIcon;
121 break;
122 default:
123 iconS = &FileView::folderIconSml;
124 break;
125 }
126
127 if(iconS && iconS->buffer)
128 Graphics::surfacecpyTransparent(surface, iconS, bounds.pos + (vector2i_t){2, 2});
129
130 Graphics::DrawString(label.c_str(), bounds.pos.x + 20, bounds.pos.y + bounds.size.y / 2 - 8, colours[Colour::Text], surface);
131 }
132 };
133
134 void OnFileButtonPress(Button* b){
135 FileView* fv = ((FileView*)b->GetParent());

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected