2011-06-16 15:53:39 -06:00
|
|
|
/*
|
|
|
|
https://github.com/peterix/dfhack
|
|
|
|
Copyright (c) 2009-2011 Petr Mrázek (peterix@gmail.com)
|
|
|
|
|
|
|
|
This software is provided 'as-is', without any express or implied
|
|
|
|
warranty. In no event will the authors be held liable for any
|
|
|
|
damages arising from the use of this software.
|
|
|
|
|
|
|
|
Permission is granted to anyone to use this software for any
|
|
|
|
purpose, including commercial applications, and to alter it and
|
|
|
|
redistribute it freely, subject to the following restrictions:
|
|
|
|
|
|
|
|
1. The origin of this software must not be misrepresented; you must
|
|
|
|
not claim that you wrote the original software. If you use this
|
|
|
|
software in a product, an acknowledgment in the product documentation
|
|
|
|
would be appreciated but is not required.
|
|
|
|
|
|
|
|
2. Altered source versions must be plainly marked as such, and
|
|
|
|
must not be misrepresented as being the original software.
|
|
|
|
|
|
|
|
3. This notice may not be removed or altered from any source
|
|
|
|
distribution.
|
|
|
|
*/
|
|
|
|
|
2011-04-10 05:12:28 -06:00
|
|
|
#pragma once
|
2011-12-31 04:48:42 -07:00
|
|
|
#include "Export.h"
|
|
|
|
#include "Module.h"
|
|
|
|
#include "BitArray.h"
|
2012-03-10 04:55:42 -07:00
|
|
|
#include "ColorText.h"
|
2011-07-09 03:33:58 -06:00
|
|
|
#include <string>
|
2010-04-04 16:48:19 -06:00
|
|
|
|
2012-01-24 21:18:21 -07:00
|
|
|
#include "DataDefs.h"
|
|
|
|
#include "df/init.h"
|
|
|
|
#include "df/ui.h"
|
|
|
|
|
2012-01-07 08:21:07 -07:00
|
|
|
namespace df {
|
|
|
|
struct viewscreen;
|
|
|
|
struct job;
|
2012-01-14 08:31:43 -07:00
|
|
|
struct unit;
|
|
|
|
struct item;
|
2012-01-07 08:21:07 -07:00
|
|
|
};
|
|
|
|
|
2011-03-18 04:09:26 -06:00
|
|
|
/**
|
2012-03-03 06:38:24 -07:00
|
|
|
* \defgroup grp_gui utility code that helps dealing with DF's user interface
|
2011-03-18 04:09:26 -06:00
|
|
|
* @ingroup grp_modules
|
|
|
|
*/
|
|
|
|
|
2010-04-04 16:48:19 -06:00
|
|
|
namespace DFHack
|
|
|
|
{
|
2012-01-07 08:21:07 -07:00
|
|
|
class Core;
|
2011-03-18 04:09:26 -06:00
|
|
|
/**
|
|
|
|
* The Gui module
|
|
|
|
* \ingroup grp_modules
|
|
|
|
* \ingroup grp_gui
|
|
|
|
*/
|
2012-03-03 06:38:24 -07:00
|
|
|
namespace Gui
|
2010-04-04 16:48:19 -06:00
|
|
|
{
|
2012-03-03 06:38:24 -07:00
|
|
|
// Full-screen item details view
|
2012-03-10 04:55:42 -07:00
|
|
|
DFHACK_EXPORT bool item_details_hotkey(df::viewscreen *top);
|
2012-03-03 06:38:24 -07:00
|
|
|
// 'u'nits or 'j'obs full-screen view
|
2012-03-10 04:55:42 -07:00
|
|
|
DFHACK_EXPORT bool unitjobs_hotkey(df::viewscreen *top);
|
2012-03-03 06:38:24 -07:00
|
|
|
|
|
|
|
// A job is selected in a workshop
|
2012-03-10 04:55:42 -07:00
|
|
|
DFHACK_EXPORT bool workshop_job_hotkey(df::viewscreen *top);
|
2012-03-03 06:38:24 -07:00
|
|
|
// Building material selection mode
|
2012-03-10 04:55:42 -07:00
|
|
|
DFHACK_EXPORT bool build_selector_hotkey(df::viewscreen *top);
|
2012-03-03 06:38:24 -07:00
|
|
|
// A unit is selected in the 'v' mode
|
2012-03-10 04:55:42 -07:00
|
|
|
DFHACK_EXPORT bool view_unit_hotkey(df::viewscreen *top);
|
2012-03-03 06:38:24 -07:00
|
|
|
// Above + the inventory page is selected.
|
2012-03-10 04:55:42 -07:00
|
|
|
DFHACK_EXPORT bool unit_inventory_hotkey(df::viewscreen *top);
|
2012-03-03 06:38:24 -07:00
|
|
|
|
|
|
|
// In workshop_job_hotkey, returns the job
|
2012-03-10 04:55:42 -07:00
|
|
|
DFHACK_EXPORT df::job *getSelectedWorkshopJob(color_ostream &out, bool quiet = false);
|
2012-03-03 06:38:24 -07:00
|
|
|
|
|
|
|
// A job is selected in a workshop, or unitjobs
|
2012-03-10 04:55:42 -07:00
|
|
|
DFHACK_EXPORT bool any_job_hotkey(df::viewscreen *top);
|
|
|
|
DFHACK_EXPORT df::job *getSelectedJob(color_ostream &out, bool quiet = false);
|
2012-03-03 06:38:24 -07:00
|
|
|
|
|
|
|
// A unit is selected via 'v', 'k', unitjobs, or
|
|
|
|
// a full-screen item view of a cage or suchlike
|
2012-03-10 04:55:42 -07:00
|
|
|
DFHACK_EXPORT bool any_unit_hotkey(df::viewscreen *top);
|
|
|
|
DFHACK_EXPORT df::unit *getSelectedUnit(color_ostream &out, bool quiet = false);
|
2012-03-03 06:38:24 -07:00
|
|
|
|
|
|
|
// An item is selected via 'v'->inventory, 'k', 't', or
|
|
|
|
// a full-screen item view of a container. Note that in the
|
|
|
|
// last case, the highlighted contained item is returned, not
|
|
|
|
// the container itself.
|
2012-03-10 04:55:42 -07:00
|
|
|
DFHACK_EXPORT bool any_item_hotkey(df::viewscreen *top);
|
|
|
|
DFHACK_EXPORT df::item *getSelectedItem(color_ostream &out, bool quiet = false);
|
2012-03-03 06:38:24 -07:00
|
|
|
|
|
|
|
// Show a plain announcement, or a titan-style popup message
|
|
|
|
DFHACK_EXPORT void showAnnouncement(std::string message, int color = 7, bool bright = true);
|
|
|
|
DFHACK_EXPORT void showPopupAnnouncement(std::string message, int color = 7, bool bright = true);
|
|
|
|
|
2011-03-18 04:09:26 -06:00
|
|
|
/*
|
|
|
|
* Cursor and window coords
|
|
|
|
*/
|
2012-03-03 06:38:24 -07:00
|
|
|
DFHACK_EXPORT bool getViewCoords (int32_t &x, int32_t &y, int32_t &z);
|
|
|
|
DFHACK_EXPORT bool setViewCoords (const int32_t x, const int32_t y, const int32_t z);
|
|
|
|
|
|
|
|
DFHACK_EXPORT bool getCursorCoords (int32_t &x, int32_t &y, int32_t &z);
|
|
|
|
DFHACK_EXPORT bool setCursorCoords (const int32_t x, const int32_t y, const int32_t z);
|
2011-09-25 19:39:27 -06:00
|
|
|
|
2012-03-03 06:38:24 -07:00
|
|
|
DFHACK_EXPORT bool getDesignationCoords (int32_t &x, int32_t &y, int32_t &z);
|
|
|
|
DFHACK_EXPORT bool setDesignationCoords (const int32_t x, const int32_t y, const int32_t z);
|
2011-09-25 19:39:27 -06:00
|
|
|
|
2012-03-03 06:38:24 -07:00
|
|
|
DFHACK_EXPORT bool getMousePos (int32_t & x, int32_t & y);
|
2011-07-09 03:33:58 -06:00
|
|
|
/*
|
|
|
|
* Gui screens
|
|
|
|
*/
|
|
|
|
/// Get the current top-level view-screen
|
2012-03-03 06:38:24 -07:00
|
|
|
DFHACK_EXPORT df::viewscreen * GetCurrentScreen();
|
2011-07-09 03:33:58 -06:00
|
|
|
|
2012-03-03 15:18:12 -07:00
|
|
|
/// get the size of the window buffer
|
2012-03-03 06:38:24 -07:00
|
|
|
DFHACK_EXPORT bool getWindowSize(int32_t & width, int32_t & height);
|
2012-02-22 00:30:44 -07:00
|
|
|
|
2012-03-03 15:18:12 -07:00
|
|
|
/**
|
2012-03-03 06:38:24 -07:00
|
|
|
*Menu width:
|
2012-02-22 00:30:44 -07:00
|
|
|
*3:3 - menu and area map closed
|
|
|
|
*2:3 - menu open single width
|
|
|
|
*1:3 - menu open double width
|
|
|
|
*1:2 - menu and area map open
|
|
|
|
*2:2 - area map open
|
|
|
|
*/
|
|
|
|
|
2012-03-03 06:38:24 -07:00
|
|
|
DFHACK_EXPORT bool getMenuWidth(uint8_t & menu_width, uint8_t & area_map_width);
|
|
|
|
DFHACK_EXPORT bool setMenuWidth(const uint8_t menu_width, const uint8_t area_map_width);
|
|
|
|
}
|
2010-04-04 16:48:19 -06:00
|
|
|
}
|