summaryrefslogtreecommitdiff
path: root/Userland/Applications/HexEditor/GoToOffsetDialog.h
blob: 358b04bf6db9bfad1d44b1b608d61b9af0e3abfc (plain)
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
/*
 * Copyright (c) 2021, the SerenityOS developers.
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include <AK/Result.h>
#include <AK/Vector.h>
#include <LibGUI/Dialog.h>

class GoToOffsetDialog : public GUI::Dialog {
    C_OBJECT(GoToOffsetDialog);

public:
    static int show(GUI::Window* parent_window, int& history_offset, int& out_offset, int selection_offset, int end);

private:
    GoToOffsetDialog();
    virtual ~GoToOffsetDialog() override;
    void update_statusbar();
    int process_input();
    int calculate_new_offset(int offset);
    int m_selection_offset { 0 };
    int m_buffer_size { 0 };
    Vector<String> m_offset_type;
    Vector<String> m_offset_from;

    RefPtr<GUI::TextEditor> m_text_editor;
    RefPtr<GUI::Button> m_go_button;
    RefPtr<GUI::ComboBox> m_offset_type_box;
    RefPtr<GUI::ComboBox> m_offset_from_box;
    RefPtr<GUI::Statusbar> m_statusbar;
};