Major code reorganization
This commit only updates the XCode project for the changes. A later commit each will update it for scons and MSVC. A few actual changes are mixed in: - Add a prefix header for a handful of common definitions - Moved current_cursor into the Cursor class as a static member - Removed the make_cursor_sword and make_cursor_watch functions - Include tests in the All target - Remove redundant -l flags for Common and Common-Party (since they're included in the Link phases anyway)
This commit is contained in:
76
src/dialogxml/dialogs/3choice.hpp
Normal file
76
src/dialogxml/dialogs/3choice.hpp
Normal file
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* dlogutil.h
|
||||
* BoE
|
||||
*
|
||||
* Created by Celtic Minstrel on 11/05/09.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef DIALOG_3CHOICE_H
|
||||
#define DIALOG_3CHOICE_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <array>
|
||||
#include <boost/optional.hpp>
|
||||
|
||||
#include "dialog.keys.hpp"
|
||||
#include "choicedlog.hpp"
|
||||
#include "button.hpp"
|
||||
#include "pictypes.hpp"
|
||||
|
||||
/// Basic button type template
|
||||
struct bbtt {
|
||||
eBtnType type; ///< The type of the preset button.
|
||||
std::string label; ///< The preset button's label, if any.
|
||||
cKey defaultKey; ///< The preset button's default key shortcut, if any.
|
||||
std::string name; ///< (optional) A more descriptive name for the button.
|
||||
};
|
||||
|
||||
/// Represents a preset button for use with cThreeChoice.
|
||||
typedef boost::optional<bbtt> cBasicButtonType;
|
||||
|
||||
namespace {cBasicButtonType null_btn = boost::none;}
|
||||
#ifndef BTNS_DEFINED
|
||||
extern bbtt basic_buttons[71];
|
||||
#endif
|
||||
|
||||
/// A choice dialog with several strings and up to three buttons.
|
||||
/// This is the class used for dialogs generated by special nodes.
|
||||
/// It generates the dialog dynamically from the given input.
|
||||
/// Note that the dialog is not limited to six strings.
|
||||
class cThreeChoice : public cChoiceDlog {
|
||||
cBasicButtonType btns[3];
|
||||
unsigned short buttons_right, buttons_top;
|
||||
void init_strings(std::vector<std::string>& strings, unsigned short left);
|
||||
void init_buttons(cBasicButtonType btn1, cBasicButtonType btn2, cBasicButtonType btn3);
|
||||
void init_pict(pic_num_t pic);
|
||||
const ePicType type;
|
||||
public:
|
||||
/// Create a dialog with just one button.
|
||||
/// @param strings A list of the strings to place in the dialog.
|
||||
/// @param button The specification of the button.
|
||||
/// @param pic The icon to show at the top left.
|
||||
/// @param t The type of the icon.
|
||||
/// @param parent Optionally, a parent dialog.
|
||||
cThreeChoice(std::vector<std::string>& strings, cBasicButtonType button, pic_num_t pic, ePicType t, cDialog* parent = nullptr);
|
||||
/// Create a dialog with up to three buttons.
|
||||
/// @param strings A list of the strings to place in the dialog.
|
||||
/// @param buttons A list of the button specifications.
|
||||
/// @param pic The icon to show at the top left.
|
||||
/// @param t The type of the icon.
|
||||
/// @param parent Optionally, a parent dialog.
|
||||
cThreeChoice(std::vector<std::string>& strings, std::array<cBasicButtonType, 3>& buttons, pic_num_t pic, ePicType t, cDialog* parent = nullptr);
|
||||
/// Create a dialog with up to three buttons.
|
||||
/// @param strings A list of the strings to place in the dialog.
|
||||
/// @param buttons A list of the index of the button; this is an index into available_btns which is in turn used to index basic_buttons.
|
||||
/// @param pic The icon to show at the top left.
|
||||
/// @param t The type of the icon.
|
||||
/// @param parent Optionally, a parent dialog.
|
||||
cThreeChoice(std::vector<std::string>& strings, std::array<short, 3>& buttons, pic_num_t pic, ePicType t, cDialog* parent = nullptr);
|
||||
/// @copydoc cChoiceDlog::show()
|
||||
/// @note The unique key in this case is the label specified in the button specification.
|
||||
std::string show();
|
||||
};
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user