1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-16 02:49:55 +00:00
openmw-tes3mp/apps/openmw/mwmp/GUIDialogList.hpp
Koncord adb49b7c7d Add New GUI dialog: ListBox
Example:

local GUI_LISTBOX = 42

function OnPlayerSendMessage(pid, message)
    if message == "/lb" then
        local items = "consectetur adipiscing elit\nsed do eiusmod tempor incididunt ut labore\net dolore magna aliqua." -- items can be separated through newline
        local label = "Lorem ipsum dolor sit amet"
        tes3mp.ListBox(pid, GUI_LISTBOX, label, items)
    end
end

function OnGUIAction(pid, idGui, data)
    if idGui == GUI_LISTBOX then
        print("ID: " .. idGui .. " data: " .. tostring(data)) -- if value higher than last item id
    end
end
2016-11-04 00:24:16 +08:00

27 lines
612 B
C++

//
// Created by koncord on 03.11.16.
//
#ifndef OPENMW_GUIDIALOGLIST_HPP
#define OPENMW_GUIDIALOGLIST_HPP
#include <apps/openmw/mwgui/windowbase.hpp>
namespace mwmp
{
class GUIDialogList : public MWGui::WindowModal
{
public:
GUIDialogList(const std::string &message, const std::vector<std::string> &list);
void mousePressed(MyGUI::Widget *_widget);
void onFrame(float frameDuration);
private:
bool mMarkedToDelete;
MyGUI::EditBox *mMessage;
MyGUI::ListBox *mListBox;
MyGUI::Button *mButton;
};
}
#endif //OPENMW_GUIDIALOGLIST_HPP