-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTextFileApp.h
More file actions
36 lines (29 loc) · 815 Bytes
/
Copy pathTextFileApp.h
File metadata and controls
36 lines (29 loc) · 815 Bytes
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
#ifndef TEXTFILEAPP_H
#define TEXTFILEAPP_H
#include <gtk/gtk.h>
#include <string>
class TextFileApp {
public:
TextFileApp();
~TextFileApp();
void run();
void setText(const std::string &text);
std::string getText() const;
void saveTextToFile(const std::string &filename);
void loadTextFromFile(const std::string &filename);
private:
GtkWidget *window;
GtkWidget *mainBox;
GtkWidget *textView;
GtkTextBuffer *buffer;
GtkWidget *saveButton;
std::string text; // Store text
bool textChanged; // Flag to track text changes
static void onSaveButtonClicked(GtkWidget *widget, gpointer data);
static void onTextChanged(GtkTextBuffer *buffer, gpointer data);
void setText();
void setButtonLabel(const char *label);
void loadText();
void saveText();
};
#endif // TEXTFILEAPP_H