mirror of
https://github.com/RGBCube/serenity
synced 2025-05-18 20:45:08 +00:00

This patch adds basic keyboard access to the search box. We also yield focus back gracefully to the text document when the search box is no longer wanted. Focus should probably move automatically when an ancestor of the currently focused widget if made invisible..
36 lines
869 B
C++
36 lines
869 B
C++
#pragma once
|
|
|
|
#include <AK/FileSystemPath.h>
|
|
#include <AK/Function.h>
|
|
#include <LibGUI/GApplication.h>
|
|
#include <LibGUI/GTextEditor.h>
|
|
#include <LibGUI/GWidget.h>
|
|
#include <LibGUI/GWindow.h>
|
|
|
|
class GButton;
|
|
class GTextBox;
|
|
class GTextEditor;
|
|
|
|
class TextEditorWidget final : public GWidget {
|
|
public:
|
|
TextEditorWidget();
|
|
virtual ~TextEditorWidget() override;
|
|
void open_sesame(const String& path);
|
|
|
|
private:
|
|
void set_path(const FileSystemPath& file);
|
|
|
|
GTextEditor* m_editor { nullptr };
|
|
String m_path;
|
|
String m_name;
|
|
String m_extension;
|
|
RefPtr<GAction> m_new_action;
|
|
RefPtr<GAction> m_open_action;
|
|
RefPtr<GAction> m_save_action;
|
|
RefPtr<GAction> m_save_as_action;
|
|
RefPtr<GAction> m_find_action;
|
|
|
|
GTextBox* m_find_textbox { nullptr };
|
|
GButton* m_find_button { nullptr };
|
|
GWidget* m_find_widget { nullptr };
|
|
};
|