Update to v094r20 release.

byuu says:

Main reason for this WIP was because of all the added lines to hiro for
selective component disabling. May as well get all the diff-noise apart
from code changes.

It also merges something I've been talking to Cydrak about ... making
nall::string::(integer,decimal) do built-in binary,octal,hex decoding
instead of just failing on those. This will have fun little side effects
all over the place, like being able to view a topic on my forum via
"forum.byuu.org/topic/0b10010110", heh.

There are two small changes to higan itself, though. First up, I fixed
the resampler ratio when loading non-SNES games. Tested and I can play
Game Boy games fine now. Second, I hooked up menu option hiding for
reset and controller selection. Right now, this works like higan v094,
but I'm thinking I might want to show the "Device -> Controller" even if
that's all that's there. It kind of jives nicer with the input settings
window to see the labels there, I think. And if we ever do add more
stuff, it'll be nice that people already always expect that menu there.

Remaining issues:
* add slotted cart loader (SGB, BSX, ST)
* add DIP switch selection window (NSS)
* add timing configuration (video/audio sync)
This commit is contained in:
Tim Allen 2015-05-23 15:37:08 +10:00
parent 458775a481
commit 4e0223d590
195 changed files with 1118 additions and 53 deletions

View File

@ -3,7 +3,7 @@
namespace Emulator {
static const char Name[] = "higan";
static const char Version[] = "094.19";
static const char Version[] = "094.20";
static const char Author[] = "byuu";
static const char License[] = "GPLv3";
static const char Website[] = "http://byuu.org/";

81
hiro/components.hpp Normal file
View File

@ -0,0 +1,81 @@
/* hiro components
*
* By commenting out lines below, individual components of hiro can be disabled.)
* This can be useful to avoid dependencies (eg GTK+ relies on GtkSourceView for SourceEdit.)
* It's also very useful for porting hiro to new targets; or performing major core changes.
*
* Note that the core classes (Application, Window, Sizable, etc) have circular dependencies.
* Disabling only certain core pieces will result in compilation errors.
* As such, this file is really only meant for disabling individual widgets or menu items.
*/
#define Hiro_Application
#define Hiro_Color
#define Hiro_Position
#define Hiro_Size
#define Hiro_Geometry
#define Hiro_Font
#define Hiro_Desktop
#define Hiro_Monitor
#define Hiro_Keyboard
#define Hiro_Mouse
#define Hiro_BrowserWindow
#define Hiro_MessageWindow
#define Hiro_Object
#define Hiro_Hotkey
#define Hiro_Timer
#define Hiro_Window
#define Hiro_StatusBar
#define Hiro_MenuBar
#define Hiro_PopupMenu
#define Hiro_Action
#define Hiro_Menu
#define Hiro_MenuSeparator
#define Hiro_MenuItem
#define Hiro_MenuCheckItem
#define Hiro_MenuRadioItem
#define Hiro_Sizable
#define Hiro_Layout
#define Hiro_Widget
#define Hiro_Button
#define Hiro_Canvas
#define Hiro_CheckButton
#define Hiro_CheckLabel
#define Hiro_ComboButton
#define Hiro_Console
#define Hiro_Frame
#define Hiro_HexEdit
#define Hiro_HorizontalScroller
#define Hiro_HorizontalSlider
#define Hiro_IconView
#define Hiro_Label
#define Hiro_LineEdit
#define Hiro_ListView
#define Hiro_ProgressBar
#define Hiro_RadioButton
#define Hiro_RadioLabel
#define Hiro_SourceView
#define Hiro_TabFrame
#define Hiro_TextEdit
#define Hiro_TreeView
#define Hiro_VerticalScroller
#define Hiro_VerticalSlider
#define Hiro_Viewport
#define Hiro_FixedLayout
#define Hiro_HorizontalLayout
#define Hiro_VerticalLayout
#if defined(Hiro_Button) && defined(Hiro_Canvas) && defined(Hiro_Label)
#define Hiro_MessageDialog
#endif
#if defined(Hiro_Button) && defined(Hiro_ComboButton) && defined(Hiro_LineEdit) && defined(Hiro_ListView) && defined(Hiro_MessageDialog)
#define Hiro_BrowserDialog
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_Action)
auto mAction::allocate() -> pObject* {
return new pAction(*this);
}
@ -7,6 +9,10 @@ auto mAction::allocate() -> pObject* {
auto mAction::remove() -> type& {
if(auto menu = parentMenu()) menu->remove(*this);
if(auto menuBar = parentMenuBar()) menuBar->remove((mMenu&)*this);
#if defined(Hiro_PopupMenu)
if(auto popupMenu = parentPopupMenu()) popupMenu->remove(*this);
#endif
return *this;
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_MenuCheckItem)
auto mMenuCheckItem::allocate() -> pObject* {
return new pMenuCheckItem(*this);
}
@ -31,3 +33,5 @@ auto mMenuCheckItem::setText(const string& text) -> type& {
auto mMenuCheckItem::text() const -> string {
return state.text;
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_MenuItem)
auto mMenuItem::allocate() -> pObject* {
return new pMenuItem(*this);
}
@ -32,3 +34,5 @@ auto mMenuItem::setText(const string& text) -> type& {
auto mMenuItem::text() const -> string {
return state.text;
}
#endif

View File

@ -1,10 +1,12 @@
#if defined(Hiro_MenuRadioItem)
auto mMenuRadioItem::allocate() -> pObject* {
return new pMenuRadioItem(*this);
}
//
auto mMenuRadioItem::group(const vector<shared_pointer_weak<mMenuRadioItem>>& group) -> void {
auto mMenuRadioItem::group(const vector<wMenuRadioItem>& group) -> void {
for(auto& weak : group) {
if(auto item = weak.acquire()) item->state.group = group;
}
@ -49,3 +51,5 @@ auto mMenuRadioItem::setText(const string& text) -> type& {
auto mMenuRadioItem::text() const -> string {
return state.text;
}
#endif

View File

@ -1,3 +1,7 @@
#if defined(Hiro_MenuSeparator)
auto mMenuSeparator::allocate() -> pObject* {
return new pMenuSeparator(*this);
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_Menu)
auto mMenu::allocate() -> pObject* {
return new pMenu(*this);
}
@ -58,3 +60,5 @@ auto mMenu::setText(const string& text) -> type& {
auto mMenu::text() const -> string {
return state.text;
}
#endif

View File

@ -1,3 +1,7 @@
#if defined(Hiro_Application)
Application::State Application::state;
auto Application::doMain() -> void {
if(state.onMain) return state.onMain();
}
@ -95,3 +99,5 @@ auto Application::initialize() -> void {
return pApplication::initialize();
}
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_BrowserWindow)
auto BrowserWindow::directory() -> string {
return pBrowserWindow::directory(state);
}
@ -29,3 +31,5 @@ auto BrowserWindow::setTitle(const string& title) -> type& {
state.title = title;
return *this;
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_Color)
Color::Color() {
setColor(0, 0, 0, 0);
}
@ -81,3 +83,5 @@ auto Color::setRed(signed red) -> type& {
auto Color::value() const -> uint32_t {
return (state.alpha << 24) + (state.red << 16) + (state.green << 8) + (state.blue << 0);
}
#endif

View File

@ -15,11 +15,6 @@
#include "core.hpp"
using namespace nall;
namespace hiro {
Application::State Application::state;
Keyboard::State Keyboard::state;
}
#if defined(HIRO_WINDOWS)
#include "../windows/platform.cpp"
#elif defined(HIRO_QT)

View File

@ -83,6 +83,7 @@ enum class Edge : unsigned { Top, Bottom, Left, Right };
enum class Orientation : unsigned { Horizontal, Vertical };
#if defined(Hiro_Application)
struct Application {
Application() = delete;
@ -134,7 +135,9 @@ struct Application {
static State state;
static auto initialize() -> void;
};
#endif
#if defined(Hiro_Color)
struct Color {
using type = Color;
@ -168,7 +171,9 @@ struct Color {
signed blue;
} state;
};
#endif
#if defined(Hiro_Position)
struct Position {
using type = Position;
@ -191,7 +196,9 @@ struct Position {
signed y;
} state;
};
#endif
#if defined(Hiro_Size)
struct Size {
using type = Size;
@ -217,7 +224,9 @@ struct Size {
signed height;
} state;
};
#endif
#if defined(Hiro_Geometry)
struct Geometry {
using type = Geometry;
@ -256,7 +265,9 @@ struct Geometry {
signed height;
} state;
};
#endif
#if defined(Hiro_Font)
struct Font {
Font() = delete;
@ -265,14 +276,18 @@ struct Font {
static auto monospace(unsigned size = 0, const string& style = "") -> string;
static auto size(const string& font, const string& text = " ") -> Size;
};
#endif
#if defined(Hiro_Desktop)
struct Desktop {
Desktop() = delete;
static auto size() -> Size;
static auto workspace() -> Geometry;
};
#endif
#if defined(Hiro_Monitor)
struct Monitor {
Monitor() = delete;
@ -280,7 +295,9 @@ struct Monitor {
static auto geometry(unsigned monitor) -> Geometry;
static auto primary() -> unsigned;
};
#endif
#if defined(Hiro_Keyboard)
struct Keyboard {
Keyboard() = delete;
@ -300,7 +317,9 @@ struct Keyboard {
};
static State state;
};
#endif
#if defined(Hiro_Mouse)
struct Mouse {
enum class Button : unsigned { Left, Middle, Right };
@ -310,7 +329,9 @@ struct Mouse {
static auto pressed(Button) -> bool;
static auto released(Button) -> bool;
};
#endif
#if defined(Hiro_BrowserWindow)
struct BrowserWindow {
using type = BrowserWindow;
@ -330,7 +351,9 @@ struct BrowserWindow {
string title;
} state;
};
#endif
#if defined(Hiro_MessageWindow)
struct MessageWindow {
enum class Buttons : unsigned { Ok, OkCancel, YesNo, YesNoCancel };
enum class Response : unsigned { Ok, Cancel, Yes, No };
@ -355,6 +378,7 @@ struct MessageWindow {
string title;
} state;
};
#endif
#define Declare(Name) \
using type = m##Name; \
@ -372,6 +396,7 @@ struct MessageWindow {
} \
virtual auto allocate() -> pObject*; \
#if defined(Hiro_Object)
struct mObject {
Declare(Object)
@ -426,7 +451,9 @@ struct mObject {
virtual auto construct() -> void;
virtual auto destruct() -> void;
};
#endif
#if defined(Hiro_Hotkey)
struct mHotkey : mObject {
Declare(Hotkey)
@ -450,7 +477,9 @@ struct mHotkey : mObject {
string sequence;
} state;
};
#endif
#if defined(Hiro_Timer)
struct mTimer : mObject {
Declare(Timer)
@ -465,7 +494,9 @@ struct mTimer : mObject {
function<void ()> onActivate;
} state;
};
#endif
#if defined(Hiro_Window)
struct mWindow : mObject {
Declare(Window)
using mObject::remove;
@ -538,7 +569,9 @@ struct mWindow : mObject {
auto destruct() -> void;
};
#endif
#if defined(Hiro_StatusBar)
struct mStatusBar : mObject {
Declare(StatusBar)
@ -551,7 +584,9 @@ struct mStatusBar : mObject {
string text;
} state;
};
#endif
#if defined(Hiro_MenuBar)
struct mMenuBar : mObject {
Declare(MenuBar)
@ -569,7 +604,9 @@ struct mMenuBar : mObject {
auto destruct() -> void override;
};
#endif
#if defined(Hiro_PopupMenu)
struct mPopupMenu : mObject {
Declare(PopupMenu)
using mObject::remove;
@ -588,7 +625,9 @@ struct mPopupMenu : mObject {
auto destruct() -> void override;
};
#endif
#if defined(Hiro_Action)
struct mAction : mObject {
Declare(Action)
@ -598,7 +637,9 @@ struct mAction : mObject {
struct State {
} state;
};
#endif
#if defined(Hiro_Menu)
struct mMenu : mAction {
Declare(Menu)
using mObject::remove;
@ -622,7 +663,9 @@ struct mMenu : mAction {
auto destruct() -> void override;
};
#endif
#if defined(Hiro_MenuSeparator)
struct mMenuSeparator : mAction {
Declare(MenuSeparator)
@ -630,7 +673,9 @@ struct mMenuSeparator : mAction {
struct State {
} state;
};
#endif
#if defined(Hiro_MenuItem)
struct mMenuItem : mAction {
Declare(MenuItem)
@ -648,7 +693,9 @@ struct mMenuItem : mAction {
string text;
} state;
};
#endif
#if defined(Hiro_MenuCheckItem)
struct mMenuCheckItem : mAction {
Declare(MenuCheckItem)
@ -666,7 +713,9 @@ struct mMenuCheckItem : mAction {
string text;
} state;
};
#endif
#if defined(Hiro_MenuRadioItem)
struct mMenuRadioItem : mAction {
Declare(MenuRadioItem)
@ -687,7 +736,9 @@ struct mMenuRadioItem : mAction {
string text;
} state;
};
#endif
#if defined(Hiro_Sizable)
struct mSizable : mObject {
Declare(Sizable)
@ -700,7 +751,9 @@ struct mSizable : mObject {
Geometry geometry;
} state;
};
#endif
#if defined(Hiro_Layout)
struct mLayout : mSizable {
Declare(Layout)
@ -719,7 +772,9 @@ struct mLayout : mSizable {
auto destruct() -> void override;
};
#endif
#if defined(Hiro_Widget)
struct mWidget : mSizable {
Declare(Widget)
@ -732,7 +787,9 @@ struct mWidget : mSizable {
function<void ()> onSize;
} state;
};
#endif
#if defined(Hiro_Button)
struct mButton : mWidget {
Declare(Button)
@ -756,7 +813,9 @@ struct mButton : mWidget {
string text;
} state;
};
#endif
#if defined(Hiro_Canvas)
struct mCanvas : mWidget {
Declare(Canvas)
@ -800,7 +859,9 @@ struct mCanvas : mWidget {
Size size;
} state;
};
#endif
#if defined(Hiro_CheckButton)
struct mCheckButton : mWidget {
Declare(CheckButton)
@ -827,7 +888,9 @@ struct mCheckButton : mWidget {
string text;
} state;
};
#endif
#if defined(Hiro_CheckLabel)
struct mCheckLabel : mWidget {
Declare(CheckLabel)
@ -845,7 +908,9 @@ struct mCheckLabel : mWidget {
string text;
} state;
};
#endif
#if defined(Hiro_ComboButton)
struct mComboButton : mWidget {
Declare(ComboButton)
using mObject::remove;
@ -868,7 +933,9 @@ struct mComboButton : mWidget {
auto destruct() -> void override;
};
#endif
#if defined(Hiro_ComboButton)
struct mComboButtonItem : mObject {
Declare(ComboButtonItem)
@ -886,7 +953,9 @@ struct mComboButtonItem : mObject {
string text;
} state;
};
#endif
#if defined(Hiro_Console)
struct mConsole : mWidget {
Declare(Console)
@ -909,7 +978,9 @@ struct mConsole : mWidget {
string prompt;
} state;
};
#endif
#if defined(Hiro_Frame)
struct mFrame : mWidget {
Declare(Frame)
using mObject::remove;
@ -929,7 +1000,9 @@ struct mFrame : mWidget {
auto destruct() -> void override;
};
#endif
#if defined(Hiro_HexEdit)
struct mHexEdit : mWidget {
Declare(HexEdit)
@ -963,7 +1036,9 @@ struct mHexEdit : mWidget {
unsigned rows = 16;
} state;
};
#endif
#if defined(Hiro_HorizontalScroller)
struct mHorizontalScroller : mWidget {
Declare(HorizontalScroller)
@ -981,7 +1056,9 @@ struct mHorizontalScroller : mWidget {
unsigned position = 0;
} state;
};
#endif
#if defined(Hiro_HorizontalSlider)
struct mHorizontalSlider : mWidget {
Declare(HorizontalSlider)
@ -999,7 +1076,9 @@ struct mHorizontalSlider : mWidget {
unsigned position = 0;
} state;
};
#endif
#if defined(Hiro_IconView)
struct mIconView : mWidget {
Declare(IconView)
using mObject::remove;
@ -1044,7 +1123,9 @@ struct mIconView : mWidget {
auto destruct() -> void override;
};
#endif
#if defined(Hiro_IconView)
struct mIconViewItem : mObject {
Declare(IconViewItem)
@ -1063,7 +1144,9 @@ struct mIconViewItem : mObject {
string text;
} state;
};
#endif
#if defined(Hiro_Label)
struct mLabel : mWidget {
Declare(Label)
@ -1081,7 +1164,9 @@ struct mLabel : mWidget {
double verticalAlignment = 0.5;
} state;
};
#endif
#if defined(Hiro_LineEdit)
struct mLineEdit : mWidget {
Declare(LineEdit)
@ -1108,7 +1193,9 @@ struct mLineEdit : mWidget {
string text;
} state;
};
#endif
#if defined(Hiro_ListView)
struct mListView : mWidget {
Declare(ListView)
using mObject::remove;
@ -1174,7 +1261,9 @@ struct mListView : mWidget {
auto destruct() -> void override;
};
#endif
#if defined(Hiro_ListView)
struct mListViewColumn : mObject {
Declare(ListViewColumn)
@ -1220,7 +1309,9 @@ struct mListViewColumn : mObject {
signed width = 0;
} state;
};
#endif
#if defined(Hiro_ListView)
struct mListViewItem : mObject {
Declare(ListViewItem)
@ -1244,7 +1335,9 @@ struct mListViewItem : mObject {
lstring text;
} state;
};
#endif
#if defined(Hiro_ProgressBar)
struct mProgressBar : mWidget {
Declare(ProgressBar)
@ -1256,7 +1349,9 @@ struct mProgressBar : mWidget {
unsigned position = 0;
} state;
};
#endif
#if defined(Hiro_RadioButton)
struct mRadioButton : mWidget {
Declare(RadioButton)
@ -1286,7 +1381,9 @@ struct mRadioButton : mWidget {
string text;
} state;
};
#endif
#if defined(Hiro_RadioLabel)
struct mRadioLabel : mWidget {
Declare(RadioLabel)
@ -1307,7 +1404,9 @@ struct mRadioLabel : mWidget {
string text;
} state;
};
#endif
#if defined(Hiro_SourceEdit)
struct mSourceEdit : mWidget {
Declare(SourceEdit)
@ -1330,7 +1429,9 @@ struct mSourceEdit : mWidget {
string text;
} state;
};
#endif
#if defined(Hiro_TabFrame)
struct mTabFrame : mWidget {
Declare(TabFrame)
using mObject::remove;
@ -1364,7 +1465,9 @@ struct mTabFrame : mWidget {
auto destruct() -> void override;
};
#endif
#if defined(Hiro_TabFrame)
struct mTabFrameItem : mObject {
Declare(TabFrameItem)
@ -1396,7 +1499,9 @@ struct mTabFrameItem : mObject {
auto destruct() -> void override;
};
#endif
#if defined(Hiro_TextEdit)
struct mTextEdit : mWidget {
Declare(TextEdit)
@ -1429,7 +1534,9 @@ struct mTextEdit : mWidget {
bool wordWrap = true;
} state;
};
#endif
#if defined(Hiro_TreeView)
struct mTreeView : mWidget {
Declare(TreeView)
using mObject::remove;
@ -1472,7 +1579,9 @@ struct mTreeView : mWidget {
auto destruct() -> void override;
};
#endif
#if defined(Hiro_TreeView)
struct mTreeViewItem : mObject {
Declare(TreeViewItem)
@ -1502,7 +1611,9 @@ struct mTreeViewItem : mObject {
auto destruct() -> void override;
};
#endif
#if defined(Hiro_VerticalScroller)
struct mVerticalScroller : mWidget {
Declare(VerticalScroller)
@ -1520,7 +1631,9 @@ struct mVerticalScroller : mWidget {
unsigned position = 0;
} state;
};
#endif
#if defined(Hiro_VerticalSlider)
struct mVerticalSlider : mWidget {
Declare(VerticalSlider)
@ -1538,7 +1651,9 @@ struct mVerticalSlider : mWidget {
unsigned position = 0;
} state;
};
#endif
#if defined(Hiro_Viewport)
struct mViewport : mWidget {
Declare(Viewport)
@ -1566,6 +1681,7 @@ struct mViewport : mWidget {
function<void (Mouse::Button)> onMouseRelease;
} state;
};
#endif
#undef Declare

View File

@ -1,3 +1,5 @@
#if defined(Hiro_Desktop)
auto Desktop::size() -> Size {
return pDesktop::size();
}
@ -5,3 +7,5 @@ auto Desktop::size() -> Size {
auto Desktop::workspace() -> Geometry {
return pDesktop::workspace();
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_Font)
auto Font::serif(unsigned size, const string& style) -> string {
return pFont::serif(size, style);
}
@ -13,3 +15,5 @@ auto Font::monospace(unsigned size, const string& style) -> string {
auto Font::size(const string& font, const string& text) -> Size {
return pFont::size(font, text);
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_Geometry)
Geometry::Geometry() {
setGeometry(0, 0, 0, 0);
}
@ -110,3 +112,5 @@ auto Geometry::x() const -> signed {
auto Geometry::y() const -> signed {
return state.y;
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_Hotkey)
auto mHotkey::allocate() -> pObject* {
return new pHotkey(*this);
}
@ -51,3 +53,5 @@ auto mHotkey::setSequence(const string& sequence) -> type& {
}
return *this;
}
#endif

View File

@ -1,3 +1,7 @@
#if defined(Hiro_Keyboard)
Keyboard::State Keyboard::state;
const vector<string> Keyboard::keys = {
//physical keyboard buttons
"Escape", "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12",
@ -72,3 +76,5 @@ auto Keyboard::remove(sHotkey hotkey) -> void {
state.hotkeys.remove(*offset);
}
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_Layout)
auto mLayout::allocate() -> pObject* {
return new pLayout(*this);
}
@ -17,7 +19,9 @@ auto mLayout::append(shared_pointer<mSizable> sizable) -> type& {
}
auto mLayout::remove() -> type& {
#if defined(Hiro_TabFrame)
if(auto tabFrameItem = parentTabFrameItem()) tabFrameItem->remove(tabFrameItem->layout());
#endif
if(auto layout = parentLayout()) layout->remove(layout->sizable(offset()));
if(auto window = parentWindow()) window->remove(window->layout());
setParent();
@ -56,3 +60,5 @@ auto mLayout::sizable(unsigned position) const -> shared_pointer<mSizable> {
auto mLayout::sizables() const -> unsigned {
return state.sizables.size();
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_MenuBar)
auto mMenuBar::allocate() -> pObject* {
return new pMenuBar(*this);
}
@ -45,3 +47,5 @@ auto mMenuBar::reset() -> type& {
while(state.menus) remove(state.menus.last());
return *this;
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_MessageWindow)
MessageWindow::MessageWindow(const string& text) {
state.text = text;
}
@ -36,3 +38,5 @@ auto MessageWindow::warning(MessageWindow::Buttons buttons) -> Response {
state.buttons = buttons;
return pMessageWindow::warning(state);
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_Monitor)
auto Monitor::count() -> unsigned {
return pMonitor::count();
}
@ -9,3 +11,5 @@ auto Monitor::geometry(unsigned monitor) -> Geometry {
auto Monitor::primary() -> unsigned {
return pMonitor::primary();
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_Mouse)
auto Mouse::position() -> Position {
return pMouse::position();
}
@ -9,3 +11,5 @@ auto Mouse::pressed(Mouse::Button button) -> bool {
auto Mouse::released(Mouse::Button button) -> bool {
return !pressed(button);
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_Object)
mObject::mObject() {
Application::initialize();
}
@ -30,7 +32,9 @@ auto mObject::destruct() -> void {
//otherwise, the pObject is not allocated until it is attached to a non-abstract parent
auto mObject::abstract() const -> bool {
if(dynamic_cast<const mWindow*>(this)) return false;
#if defined(Hiro_PopupMenu)
if(dynamic_cast<const mPopupMenu*>(this)) return false;
#endif
if(auto object = parent()) return object->abstract();
return true;
}
@ -65,6 +69,7 @@ auto mObject::parent() const -> mObject* {
return state.parent;
}
#if defined(Hiro_ComboButton)
auto mObject::parentComboButton(bool recursive) const -> mComboButton* {
if(auto comboButton = dynamic_cast<mComboButton*>(parent())) return comboButton;
if(recursive) {
@ -72,7 +77,9 @@ auto mObject::parentComboButton(bool recursive) const -> mComboButton* {
}
return nullptr;
}
#endif
#if defined(Hiro_Frame)
auto mObject::parentFrame(bool recursive) const -> mFrame* {
if(auto frame = dynamic_cast<mFrame*>(parent())) return frame;
if(recursive) {
@ -80,7 +87,9 @@ auto mObject::parentFrame(bool recursive) const -> mFrame* {
}
return nullptr;
}
#endif
#if defined(Hiro_IconView)
auto mObject::parentIconView(bool recursive) const -> mIconView* {
if(auto iconView = dynamic_cast<mIconView*>(parent())) return iconView;
if(recursive) {
@ -88,7 +97,9 @@ auto mObject::parentIconView(bool recursive) const -> mIconView* {
}
return nullptr;
}
#endif
#if defined(Hiro_Layout)
auto mObject::parentLayout(bool recursive) const -> mLayout* {
if(auto layout = dynamic_cast<mLayout*>(parent())) return layout;
if(recursive) {
@ -96,7 +107,9 @@ auto mObject::parentLayout(bool recursive) const -> mLayout* {
}
return nullptr;
}
#endif
#if defined(Hiro_ListView)
auto mObject::parentListView(bool recursive) const -> mListView* {
if(auto listView = dynamic_cast<mListView*>(parent())) return listView;
if(recursive) {
@ -104,7 +117,9 @@ auto mObject::parentListView(bool recursive) const -> mListView* {
}
return nullptr;
}
#endif
#if defined(Hiro_Menu)
auto mObject::parentMenu(bool recursive) const -> mMenu* {
if(auto menu = dynamic_cast<mMenu*>(parent())) return menu;
if(recursive) {
@ -112,7 +127,9 @@ auto mObject::parentMenu(bool recursive) const -> mMenu* {
}
return nullptr;
}
#endif
#if defined(Hiro_MenuBar)
auto mObject::parentMenuBar(bool recursive) const -> mMenuBar* {
if(auto menuBar = dynamic_cast<mMenuBar*>(parent())) return menuBar;
if(recursive) {
@ -120,7 +137,9 @@ auto mObject::parentMenuBar(bool recursive) const -> mMenuBar* {
}
return nullptr;
}
#endif
#if defined(Hiro_PopupMenu)
auto mObject::parentPopupMenu(bool recursive) const -> mPopupMenu* {
if(auto popupMenu = dynamic_cast<mPopupMenu*>(parent())) return popupMenu;
if(recursive) {
@ -128,7 +147,9 @@ auto mObject::parentPopupMenu(bool recursive) const -> mPopupMenu* {
}
return nullptr;
}
#endif
#if defined(Hiro_Sizable)
auto mObject::parentSizable(bool recursive) const -> mSizable* {
if(auto sizable = dynamic_cast<mSizable*>(parent())) return sizable;
if(recursive) {
@ -136,7 +157,9 @@ auto mObject::parentSizable(bool recursive) const -> mSizable* {
}
return nullptr;
}
#endif
#if defined(Hiro_TabFrame)
auto mObject::parentTabFrame(bool recursive) const -> mTabFrame* {
if(auto tabFrame = dynamic_cast<mTabFrame*>(parent())) return tabFrame;
if(recursive) {
@ -144,7 +167,9 @@ auto mObject::parentTabFrame(bool recursive) const -> mTabFrame* {
}
return nullptr;
}
#endif
#if defined(Hiro_TabFrame)
auto mObject::parentTabFrameItem(bool recursive) const -> mTabFrameItem* {
if(auto tabFrameItem = dynamic_cast<mTabFrameItem*>(parent())) return tabFrameItem;
if(recursive) {
@ -152,7 +177,9 @@ auto mObject::parentTabFrameItem(bool recursive) const -> mTabFrameItem* {
}
return nullptr;
}
#endif
#if defined(Hiro_TreeView)
auto mObject::parentTreeView(bool recursive) const -> mTreeView* {
if(auto treeView = dynamic_cast<mTreeView*>(parent())) return treeView;
if(recursive) {
@ -160,7 +187,9 @@ auto mObject::parentTreeView(bool recursive) const -> mTreeView* {
}
return nullptr;
}
#endif
#if defined(Hiro_TreeView)
auto mObject::parentTreeViewItem(bool recursive) const -> mTreeViewItem* {
if(auto treeViewItem = dynamic_cast<mTreeViewItem*>(parent())) return treeViewItem;
if(recursive) {
@ -168,7 +197,9 @@ auto mObject::parentTreeViewItem(bool recursive) const -> mTreeViewItem* {
}
return nullptr;
}
#endif
#if defined(Hiro_Widget)
auto mObject::parentWidget(bool recursive) const -> mWidget* {
if(auto widget = dynamic_cast<mWidget*>(parent())) return widget;
if(recursive) {
@ -176,7 +207,9 @@ auto mObject::parentWidget(bool recursive) const -> mWidget* {
}
return nullptr;
}
#endif
#if defined(Hiro_Window)
auto mObject::parentWindow(bool recursive) const -> mWindow* {
if(auto window = dynamic_cast<mWindow*>(parent())) return window;
if(recursive) {
@ -184,6 +217,7 @@ auto mObject::parentWindow(bool recursive) const -> mWindow* {
}
return nullptr;
}
#endif
auto mObject::remove() -> type& {
signal(remove);
@ -231,3 +265,5 @@ auto mObject::visible(bool recursive) const -> bool {
if(auto object = parent()) return object->visible(true);
return true;
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_PopupMenu)
auto mPopupMenu::allocate() -> pObject* {
return new pPopupMenu(*this);
}
@ -45,3 +47,5 @@ auto mPopupMenu::setVisible(bool visible) -> type& {
signal(setVisible, visible);
return *this;
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_Position)
Position::Position() {
setPosition(0, 0);
}
@ -41,3 +43,5 @@ auto Position::x() const -> signed {
auto Position::y() const -> signed {
return state.y;
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_Sizable)
auto mSizable::allocate() -> pObject* {
return new pSizable(*this);
}
@ -15,3 +17,5 @@ auto mSizable::setGeometry(Geometry geometry) -> type& {
signal(setGeometry, geometry);
return *this;
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_Size)
Size::Size() {
setSize(0, 0);
}
@ -41,3 +43,5 @@ auto Size::setWidth(signed width) -> type& {
auto Size::width() const -> signed {
return state.width;
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_StatusBar)
auto mStatusBar::allocate() -> pObject* {
return new pStatusBar(*this);
}
@ -18,3 +20,5 @@ auto mStatusBar::setText(const string& text) -> type& {
auto mStatusBar::text() const -> string {
return state.text;
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_Timer)
auto mTimer::allocate() -> pObject* {
return new pTimer(*this);
}
@ -22,3 +24,5 @@ auto mTimer::setInterval(unsigned interval) -> type& {
signal(setInterval, interval);
return *this;
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_Button)
auto mButton::allocate() -> pObject* {
return new pButton(*this);
}
@ -52,3 +54,5 @@ auto mButton::setText(const string& text) -> type& {
auto mButton::text() const -> string {
return state.text;
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_Canvas)
auto mCanvas::allocate() -> pObject* {
return new pCanvas(*this);
}
@ -123,3 +125,5 @@ auto mCanvas::update() -> type& {
signal(update);
return *this;
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_CheckButton)
auto mCheckButton::allocate() -> pObject* {
return new pCheckButton(*this);
}
@ -62,3 +64,5 @@ auto mCheckButton::setText(const string& text) -> type& {
auto mCheckButton::text() const -> string {
return state.text;
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_CheckLabel)
auto mCheckLabel::allocate() -> pObject* {
return new pCheckLabel(*this);
}
@ -32,3 +34,5 @@ auto mCheckLabel::setText(const string& text) -> type& {
auto mCheckLabel::text() const -> string {
return state.text;
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_ComboButton)
auto mComboButtonItem::allocate() -> pObject* {
return new pComboButtonItem(*this);
}
@ -41,3 +43,5 @@ auto mComboButtonItem::setText(const string& text) -> type& {
auto mComboButtonItem::text() const -> string {
return state.text;
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_ComboButton)
auto mComboButton::allocate() -> pObject* {
return new pComboButton(*this);
}
@ -59,3 +61,5 @@ auto mComboButton::selected() const -> sComboButtonItem {
if(state.selected >= 0) return state.items[state.selected];
return {};
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_Console)
auto mConsole::allocate() -> pObject* {
return new pConsole(*this);
}
@ -52,3 +54,5 @@ auto mConsole::setPrompt(const string& prompt) -> type& {
signal(setPrompt, prompt);
return *this;
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_Frame)
auto mFrame::allocate() -> pObject* {
return new pFrame(*this);
}
@ -40,3 +42,5 @@ auto mFrame::setText(const string& text) -> type& {
auto mFrame::text() const -> string {
return state.text;
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_HexEdit)
auto mHexEdit::allocate() -> pObject* {
return new pHexEdit(*this);
}
@ -87,3 +89,5 @@ auto mHexEdit::update() -> type& {
signal(update);
return *this;
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_HorizontalScroller)
auto mHorizontalScroller::allocate() -> pObject* {
return new pHorizontalScroller(*this);
}
@ -32,3 +34,5 @@ auto mHorizontalScroller::setPosition(unsigned position) -> type& {
signal(setPosition, position);
return *this;
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_HorizontalSlider)
auto mHorizontalSlider::allocate() -> pObject* {
return new pHorizontalSlider(*this);
}
@ -32,3 +34,5 @@ auto mHorizontalSlider::setPosition(unsigned position) -> type& {
signal(setPosition, position);
return *this;
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_IconView)
auto mIconViewItem::allocate() -> pObject* {
return new pIconViewItem(*this);
}
@ -38,3 +40,5 @@ auto mIconViewItem::setText(const string& text) -> type& {
auto mIconViewItem::text() const -> string {
return state.text;
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_IconView)
auto mIconView::allocate() -> pObject* {
return new pIconView(*this);
}
@ -146,3 +148,5 @@ auto mIconView::setSelected(const vector<signed>& selections) -> type& {
signal(setItemSelected, selections);
return *this;
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_Label)
auto mLabel::allocate() -> pObject* {
return new pLabel(*this);
}
@ -35,3 +37,5 @@ auto mLabel::text() const -> string {
auto mLabel::verticalAlignment() const -> double {
return state.verticalAlignment;
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_LineEdit)
auto mLineEdit::allocate() -> pObject* {
return new pLineEdit(*this);
}
@ -61,3 +63,5 @@ auto mLineEdit::setText(const string& text) -> type& {
auto mLineEdit::text() const -> string {
return state.text;
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_ListView)
auto mListViewColumn::allocate() -> pObject* {
return new pListViewColumn(*this);
}
@ -133,3 +135,5 @@ auto mListViewColumn::verticalAlignment() const -> double {
auto mListViewColumn::width() const -> signed {
return state.width;
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_ListView)
auto mListViewItem::allocate() -> pObject* {
return new pListViewItem(*this);
}
@ -63,3 +65,5 @@ auto mListViewItem::setText(unsigned column, const string& text) -> type& {
auto mListViewItem::text(unsigned column) const -> string {
return state.text(column, "");
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_ListView)
auto mListView::allocate() -> pObject* {
return new pListView(*this);
}
@ -226,3 +228,5 @@ auto mListView::setSelected(bool selected) -> type& {
signal(setSelected, selected);
return *this;
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_ProgressBar)
auto mProgressBar::allocate() -> pObject* {
return new pProgressBar(*this);
}
@ -13,3 +15,5 @@ auto mProgressBar::setPosition(unsigned position) -> type& {
signal(setPosition, position);
return *this;
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_RadioButton)
auto mRadioButton::allocate() -> pObject* {
return new pRadioButton(*this);
}
@ -79,3 +81,5 @@ auto mRadioButton::setText(const string& text) -> type& {
auto mRadioButton::text() const -> string {
return state.text;
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_RadioLabel)
auto mRadioLabel::allocate() -> pObject* {
return new pRadioLabel(*this);
}
@ -49,3 +51,5 @@ auto mRadioLabel::setText(const string& text) -> type& {
auto mRadioLabel::text() const -> string {
return state.text;
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_SourceEdit)
auto mSourceEdit::allocate() -> pObject* {
return new pSourceEdit(*this);
}
@ -50,3 +52,5 @@ auto mSourceEdit::setText(const string& text) -> type& {
auto mSourceEdit::text() const -> string {
return signal(text);
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_TabFrame)
auto mTabFrameItem::allocate() -> pObject* {
return new pTabFrameItem(*this);
}
@ -93,3 +95,5 @@ auto mTabFrameItem::setText(const string& text) -> type& {
auto mTabFrameItem::text() const -> string {
return state.text;
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_TabFrame)
auto mTabFrame::allocate() -> pObject* {
return new pTabFrame(*this);
}
@ -88,3 +90,5 @@ auto mTabFrame::setParent(mObject* parent, signed offset) -> type& {
for(auto& item : state.items) item->setParent(this, item->offset());
return *this;
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_TextEdit)
auto mTextEdit::allocate() -> pObject* {
return new pTextEdit(*this);
}
@ -81,3 +83,5 @@ auto mTextEdit::text() const -> string {
auto mTextEdit::wordWrap() const -> bool {
return state.wordWrap;
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_TreeView)
auto mTreeViewItem::allocate() -> pObject* {
return new pTreeViewItem(*this);
}
@ -96,3 +98,5 @@ auto mTreeViewItem::setText(const string& text) -> type& {
auto mTreeViewItem::text() const -> string {
return state.text;
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_TreeView)
auto mTreeView::allocate() -> pObject* {
return new pTreeView(*this);
}
@ -126,3 +128,5 @@ auto mTreeView::setForegroundColor(Color color) -> type& {
signal(setForegroundColor, color);
return *this;
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_VerticalScroller)
auto mVerticalScroller::allocate() -> pObject* {
return new pVerticalScroller(*this);
}
@ -32,3 +34,5 @@ auto mVerticalScroller::setPosition(unsigned position) -> type& {
signal(setPosition, position);
return *this;
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_VerticalSlider)
auto mVerticalSlider::allocate() -> pObject* {
return new pVerticalSlider(*this);
}
@ -32,3 +34,5 @@ auto mVerticalSlider::setPosition(unsigned position) -> type& {
signal(setPosition, position);
return *this;
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_Viewport)
auto mViewport::allocate() -> pObject* {
return new pViewport(*this);
}
@ -62,3 +64,5 @@ auto mViewport::setDroppable(bool droppable) -> type& {
signal(setDroppable, droppable);
return *this;
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_Widget)
auto mWidget::allocate() -> pObject* {
return new pWidget(*this);
}
@ -18,3 +20,5 @@ auto mWidget::remove() -> type& {
setParent();
return *this;
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_Window)
auto mWindow::allocate() -> pObject* {
return new pWindow(*this);
}
@ -280,3 +282,5 @@ auto mWindow::statusBar() const -> shared_pointer<mStatusBar> {
auto mWindow::title() const -> string {
return state.title;
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_BrowserDialog)
struct BrowserDialogWindow {
BrowserDialogWindow(BrowserDialog::State& state) : state(state) {}
auto accept() -> void;
@ -229,3 +231,5 @@ auto BrowserDialog::_run() -> lstring {
if(!state.path) state.path = userpath();
return BrowserDialogWindow(state).run();
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_BrowserDialog)
struct BrowserDialogWindow;
struct BrowserDialog {
@ -27,3 +29,5 @@ private:
friend class BrowserDialogWindow;
};
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_FixedLayout)
auto mFixedLayout::append(shared_pointer<mSizable> sizable, Geometry geometry) -> type& {
properties.append({geometry});
mLayout::append(sizable);
@ -49,3 +51,5 @@ auto mFixedLayout::setVisible(bool visible) -> type& {
}
return *this;
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_FixedLayout)
struct mFixedLayout : mLayout {
using type = mFixedLayout;
using mLayout::append;
@ -16,3 +18,5 @@ struct mFixedLayout : mLayout {
};
nall::vector<Properties> properties;
};
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_HorizontalLayout)
auto mHorizontalLayout::append(shared_pointer<mSizable> sizable, Size size, signed spacing) -> type& {
properties.append({size.width(), size.height(), spacing < 0 ? settings.spacing : spacing});
mLayout::append(sizable);
@ -123,3 +125,5 @@ auto mHorizontalLayout::setVisible(bool visible) -> type& {
}
return *this;
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_HorizontalLayout)
struct mHorizontalLayout : mLayout {
using type = mHorizontalLayout;
using mLayout::append;
@ -28,3 +30,5 @@ struct mHorizontalLayout : mLayout {
};
nall::vector<Property> properties;
};
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_MessageDialog)
MessageDialog::MessageDialog(const string& text) {
state.text = text;
}
@ -75,3 +77,5 @@ auto MessageDialog::_run() -> signed {
return state.response;
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_MessageDialog)
struct MessageDialog {
using type = MessageDialog;
@ -22,3 +24,5 @@ private:
auto _run() -> signed;
};
#endif

View File

@ -45,10 +45,13 @@
auto doSize() const -> void { return self().doSize(); } \
auto onSize(const function<void ()>& function = {}) -> type& { return self().onSize(function), *this; } \
#if defined(Hiro_Object)
struct Object : sObject {
DeclareObject(Object)
};
#endif
#if defined(Hiro_Hotkey)
struct Hotkey : sHotkey {
DeclareObject(Hotkey)
@ -61,7 +64,9 @@ struct Hotkey : sHotkey {
auto setParent(sObject object) -> type& { return self().setParent(object), *this; }
auto setSequence(const string& sequence = "") -> type& { return self().setSequence(sequence), *this; }
};
#endif
#if defined(Hiro_Timer)
struct Timer : sTimer {
DeclareObject(Timer)
@ -70,7 +75,9 @@ struct Timer : sTimer {
auto onActivate(const function<void ()>& function = {}) -> type& { return self().onActivate(function), *this; }
auto setInterval(unsigned interval = 0) -> type& { return self().setInterval(interval), *this; }
};
#endif
#if defined(Hiro_Window)
struct Window : sWindow {
DeclareObject(Window)
@ -120,14 +127,18 @@ struct Window : sWindow {
auto statusBar() const -> sStatusBar { return self().statusBar(); }
auto title() const -> string { return self().title(); }
};
#endif
#if defined(Hiro_StatusBar)
struct StatusBar : sStatusBar {
DeclareObject(StatusBar)
auto setText(const string& text = "") -> type& { return self().setText(text), *this; }
auto text() const -> string { return self().text(); }
};
#endif
#if defined(Hiro_MenuBar)
struct MenuBar : sMenuBar {
DeclareObject(MenuBar)
@ -137,7 +148,9 @@ struct MenuBar : sMenuBar {
auto remove(sMenu menu) -> type& { return self().remove(menu), *this; }
auto reset() -> type& { return self().reset(), *this; }
};
#endif
#if defined(Hiro_PopupMenu)
struct PopupMenu : sPopupMenu {
DeclareObject(PopupMenu)
@ -147,11 +160,15 @@ struct PopupMenu : sPopupMenu {
auto remove(sAction action) -> type& { return self().remove(action), *this; }
auto reset() -> type& { return self().reset(), *this; }
};
#endif
#if defined(Hiro_Action)
struct Action : sAction {
DeclareAction(Action)
};
#endif
#if defined(Hiro_Menu)
struct Menu : sMenu {
DeclareAction(Menu)
@ -165,11 +182,15 @@ struct Menu : sMenu {
auto setText(const string& text = "") -> type& { return self().setText(text), *this; }
auto text() const -> string { return self().text(); }
};
#endif
#if defined(Hiro_MenuSeparator)
struct MenuSeparator : sMenuSeparator {
DeclareAction(MenuSeparator)
};
#endif
#if defined(Hiro_MenuItem)
struct MenuItem : sMenuItem {
DeclareAction(MenuItem)
@ -180,7 +201,9 @@ struct MenuItem : sMenuItem {
auto setText(const string& text = "") -> type& { return self().setText(text), *this; }
auto text() const -> string { return self().text(); }
};
#endif
#if defined(Hiro_MenuCheckItem)
struct MenuCheckItem : sMenuCheckItem {
DeclareAction(MenuCheckItem)
@ -191,7 +214,9 @@ struct MenuCheckItem : sMenuCheckItem {
auto setText(const string& text = "") -> type& { return self().setText(text), *this; }
auto text() const -> string { return self().text(); }
};
#endif
#if defined(Hiro_MenuRadioItem)
struct MenuRadioItem : sMenuRadioItem {
DeclareAction(MenuRadioItem)
@ -202,21 +227,33 @@ struct MenuRadioItem : sMenuRadioItem {
auto setText(const string& text = "") -> type& { return self().setText(text), *this; }
auto text() const -> string { return self().text(); }
static auto group(const vector<wMenuRadioItem>& group) -> void { return mMenuRadioItem::group(group); }
static auto group(const vector<MenuRadioItem>& group) -> void {
vector<wMenuRadioItem> items;
for(auto& item : group) items.append(item);
return mMenuRadioItem::group(items);
}
};
#endif
#if defined(Hiro_Sizable)
struct Sizable : sSizable {
DeclareSizable(Sizable)
};
#endif
#if defined(Hiro_Layout)
struct Layout : sLayout {
DeclareLayout(Layout)
};
#endif
#if defined(Hiro_Widget)
struct Widget : sWidget {
DeclareWidget(Widget)
};
#endif
#if defined(Hiro_Button)
struct Button : sButton {
DeclareWidget(Button)
@ -231,7 +268,9 @@ struct Button : sButton {
auto setText(const string& text = "") -> type& { return self().setText(text), *this; }
auto text() const -> string { return self().text(); }
};
#endif
#if defined(Hiro_Canvas)
struct Canvas : sCanvas {
DeclareWidget(Canvas)
@ -260,7 +299,9 @@ struct Canvas : sCanvas {
auto size() const -> Size { return self().size(); }
auto update() -> type& { return self().update(), *this; }
};
#endif
#if defined(Hiro_CheckButton)
struct CheckButton : sCheckButton {
DeclareWidget(CheckButton)
@ -277,7 +318,9 @@ struct CheckButton : sCheckButton {
auto setText(const string& text = "") -> type& { return self().setText(text), *this; }
auto text() const -> string { return self().text(); }
};
#endif
#if defined(Hiro_CheckLabel)
struct CheckLabel : sCheckLabel {
DeclareWidget(CheckLabel)
@ -288,7 +331,9 @@ struct CheckLabel : sCheckLabel {
auto setText(const string& text = "") -> type& { return self().setText(text), *this; }
auto text() const -> string { return self().text(); }
};
#endif
#if defined(Hiro_ComboButton)
struct ComboButton : sComboButton {
DeclareWidget(ComboButton)
@ -301,7 +346,9 @@ struct ComboButton : sComboButton {
auto reset() -> type& { return self().reset(), *this; }
auto selected() const -> sComboButtonItem { return self().selected(); }
};
#endif
#if defined(Hiro_ComboButton)
struct ComboButtonItem : sComboButtonItem {
DeclareObject(ComboButtonItem)
@ -312,7 +359,9 @@ struct ComboButtonItem : sComboButtonItem {
auto setText(const string& text = "") -> type& { return self().setText(text), *this; }
auto text() const -> string { return self().text(); }
};
#endif
#if defined(Hiro_Console)
struct Console : sConsole {
DeclareWidget(Console)
@ -327,7 +376,9 @@ struct Console : sConsole {
auto setForegroundColor(Color color = {}) -> type& { return self().setForegroundColor(color), *this; }
auto setPrompt(const string& prompt = "") -> type& { return self().setPrompt(prompt), *this; }
};
#endif
#if defined(Hiro_Frame)
struct Frame : sFrame {
DeclareWidget(Frame)
@ -338,7 +389,9 @@ struct Frame : sFrame {
auto setText(const string& text = "") -> type& { return self().setText(text), *this; }
auto text() const -> string { return self().text(); }
};
#endif
#if defined(Hiro_HexEdit)
struct HexEdit : sHexEdit {
DeclareWidget(HexEdit)
@ -360,7 +413,9 @@ struct HexEdit : sHexEdit {
auto setRows(unsigned rows = 16) -> type& { return self().setRows(rows), *this; }
auto update() -> type& { return self().update(), *this; }
};
#endif
#if defined(Hiro_HorizontalScroller)
struct HorizontalScroller : sHorizontalScroller {
DeclareWidget(HorizontalScroller)
@ -371,7 +426,9 @@ struct HorizontalScroller : sHorizontalScroller {
auto setLength(unsigned length = 101) -> type& { return self().setLength(length), *this; }
auto setPosition(unsigned position = 0) -> type& { return self().setPosition(position), *this; }
};
#endif
#if defined(Hiro_HorizontalSlider)
struct HorizontalSlider : sHorizontalSlider {
DeclareWidget(HorizontalSlider)
@ -382,7 +439,9 @@ struct HorizontalSlider : sHorizontalSlider {
auto setLength(unsigned length = 101) -> type& { return self().setLength(length), *this; }
auto setPosition(unsigned position = 0) -> type& { return self().setPosition(position), *this; }
};
#endif
#if defined(Hiro_IconView)
struct IconView : sIconView {
DeclareWidget(IconView)
@ -411,7 +470,9 @@ struct IconView : sIconView {
auto setOrientation(Orientation orientation = Orientation::Horizontal) -> type& { return self().setOrientation(orientation), *this; }
auto setSelected(const vector<signed>& selections) -> type& { return self().setSelected(selections), *this; }
};
#endif
#if defined(Hiro_IconView)
struct IconViewItem : sIconViewItem {
DeclareObject(IconViewItem)
@ -422,7 +483,9 @@ struct IconViewItem : sIconViewItem {
auto setText(const string& text = "") -> type& { return self().setText(text), *this; }
auto text() const -> string { return self().text(); }
};
#endif
#if defined(Hiro_Label)
struct Label : sLabel {
DeclareWidget(Label)
@ -433,7 +496,9 @@ struct Label : sLabel {
auto text() const -> string { return self().text(); }
auto verticalAlignment() const -> double { return self().verticalAlignment(); }
};
#endif
#if defined(Hiro_LineEdit)
struct LineEdit : sLineEdit {
DeclareWidget(LineEdit)
@ -450,7 +515,9 @@ struct LineEdit : sLineEdit {
auto setText(const string& text = "") -> type& { return self().setText(text), *this; }
auto text() const -> string { return self().text(); }
};
#endif
#if defined(Hiro_ListView)
struct ListView : sListView {
DeclareWidget(ListView)
@ -494,7 +561,9 @@ struct ListView : sListView {
auto setMultiSelect(bool multiSelect = true) -> type& { return self().setMultiSelect(multiSelect), *this; }
auto setSelected(bool selected = true) -> type& { return self().setSelected(selected), *this; }
};
#endif
#if defined(Hiro_ListView)
struct ListViewColumn : sListViewColumn {
DeclareObject(ListViewColumn)
@ -521,7 +590,9 @@ struct ListViewColumn : sListViewColumn {
auto verticalAlignment() const -> double { return self().verticalAlignment(); }
auto width() const -> signed { return self().width(); }
};
#endif
#if defined(Hiro_ListView)
struct ListViewItem : sListViewItem {
DeclareObject(ListViewItem)
@ -535,14 +606,18 @@ struct ListViewItem : sListViewItem {
auto setText(unsigned column, const string& text = "") -> type& { return self().setText(column, text), *this; }
auto text(unsigned column = 0) const -> string { return self().text(column); }
};
#endif
#if defined(Hiro_ProgressBar)
struct ProgressBar : sProgressBar {
DeclareWidget(ProgressBar)
auto position() const -> unsigned { return self().position(); }
auto setPosition(unsigned position = 0) -> type& { return self().setPosition(position), *this; }
};
#endif
#if defined(Hiro_RadioButton)
struct RadioButton : sRadioButton {
DeclareWidget(RadioButton)
@ -559,9 +634,15 @@ struct RadioButton : sRadioButton {
auto setText(const string& text = "") -> type& { return self().setText(text), *this; }
auto text() const -> string { return self().text(); }
static auto group(const vector<wRadioButton>& group) -> void { return mRadioButton::group(group); }
static auto group(const vector<RadioButton>& group) -> void {
vector<wRadioButton> items;
for(auto& item : group) items.append(item);
return mRadioButton::group(items);
}
};
#endif
#if defined(Hiro_RadioLabel)
struct RadioLabel : sRadioLabel {
DeclareWidget(RadioLabel)
@ -572,9 +653,15 @@ struct RadioLabel : sRadioLabel {
auto setText(const string& text = "") -> type& { return self().setText(text), *this; }
auto text() const -> string { return self().text(); }
static auto group(const vector<wRadioLabel>& group) -> void { return mRadioLabel::group(group); }
static auto group(const vector<RadioLabel>& group) -> void {
vector<wRadioLabel> items;
for(auto& item : items) items.append(item);
return mRadioLabel::group(items);
}
};
#endif
#if defined(Hiro_SourceEdit)
struct SourceEdit : sSourceEdit {
DeclareWidget(SourceEdit)
@ -588,7 +675,9 @@ struct SourceEdit : sSourceEdit {
auto setText(const string& text = "") -> type& { return self().setText(text), *this; }
auto text() const -> string { return self().text(); }
};
#endif
#if defined(Hiro_TabFrame)
struct TabFrame : sTabFrame {
DeclareWidget(TabFrame)
@ -607,7 +696,9 @@ struct TabFrame : sTabFrame {
auto selected() const -> sTabFrameItem { return self().selected(); }
auto setEdge(Edge edge = Edge::Top) -> type& { return self().setEdge(edge), *this; }
};
#endif
#if defined(Hiro_TabFrame)
struct TabFrameItem : sTabFrameItem {
DeclareObject(TabFrameItem)
@ -626,7 +717,9 @@ struct TabFrameItem : sTabFrameItem {
auto setText(const string& text = "") -> type& { return self().setText(text), *this; }
auto text() const -> string { return self().text(); }
};
#endif
#if defined(Hiro_TextEdit)
struct TextEdit : sTextEdit {
DeclareWidget(TextEdit)
@ -647,7 +740,9 @@ struct TextEdit : sTextEdit {
auto text() const -> string { return self().text(); }
auto wordWrap() const -> bool { return self().wordWrap(); }
};
#endif
#if defined(Hiro_TreeView)
struct TreeView : sTreeView {
DeclareWidget(TreeView)
@ -674,7 +769,9 @@ struct TreeView : sTreeView {
auto setCheckable(bool checkable = true) -> type& { return self().setCheckable(checkable), *this; }
auto setForegroundColor(Color color = {}) -> type& { return self().setForegroundColor(color), *this; }
};
#endif
#if defined(Hiro_TreeView)
struct TreeViewItem : sTreeViewItem {
DeclareObject(TreeViewItem)
@ -692,7 +789,9 @@ struct TreeViewItem : sTreeViewItem {
auto setText(const string& text = "") -> type& { return self().setText(text), *this; }
auto text() const -> string { return self().text(); }
};
#endif
#if defined(Hiro_VerticalScroller)
struct VerticalScroller : sVerticalScroller {
DeclareWidget(VerticalScroller)
@ -703,7 +802,9 @@ struct VerticalScroller : sVerticalScroller {
auto setLength(unsigned length = 101) -> type& { return self().setLength(length), *this; }
auto setPosition(unsigned position = 0) -> type& { return self().setPosition(position), *this; }
};
#endif
#if defined(Hiro_VerticalSlider)
struct VerticalSlider : sVerticalSlider {
DeclareWidget(VerticalSlider)
@ -714,7 +815,9 @@ struct VerticalSlider : sVerticalSlider {
auto setLength(unsigned length = 101) -> type& { return self().setLength(length), *this; }
auto setPosition(unsigned position = 0) -> type& { return self().setPosition(position), *this; }
};
#endif
#if defined(Hiro_Viewport)
struct Viewport : sViewport {
DeclareWidget(Viewport)
@ -732,17 +835,19 @@ struct Viewport : sViewport {
auto onMouseRelease(const function<void (Mouse::Button)>& function = {}) -> type& { return self().onMouseRelease(function), *this; }
auto setDroppable(bool droppable = true) -> type& { return self().setDroppable(droppable), *this; }
};
#endif
#if defined(Hiro_FixedLayout)
using sFixedLayout = shared_pointer<mFixedLayout>;
using sHorizontalLayout = shared_pointer<mHorizontalLayout>;
using sVerticalLayout = shared_pointer<mVerticalLayout>;
struct FixedLayout : sFixedLayout {
DeclareLayout(FixedLayout)
auto append(sSizable sizable, Geometry geometry) -> type& { return self().append(sizable, geometry), *this; }
};
#endif
#if defined(Hiro_HorizontalLayout)
using sHorizontalLayout = shared_pointer<mHorizontalLayout>;
struct HorizontalLayout : sHorizontalLayout {
DeclareLayout(HorizontalLayout)
@ -751,7 +856,10 @@ struct HorizontalLayout : sHorizontalLayout {
auto setMargin(signed margin = 0) -> type& { return self().setMargin(margin), *this; }
auto setSpacing(signed spacing = 5) -> type& { return self().setSpacing(spacing), *this; }
};
#endif
#if defined(Hiro_VerticalLayout)
using sVerticalLayout = shared_pointer<mVerticalLayout>;
struct VerticalLayout : sVerticalLayout {
DeclareLayout(VerticalLayout)
@ -760,6 +868,7 @@ struct VerticalLayout : sVerticalLayout {
auto setMargin(signed margin = 0) -> type& { return self().setMargin(margin), *this; }
auto setSpacing(signed spacing = 5) -> type& { return self().setSpacing(spacing), *this; }
};
#endif
#undef Declare
#undef DeclareObject

View File

@ -1,3 +1,5 @@
#if defined(Hiro_VerticalLayout)
auto mVerticalLayout::append(shared_pointer<mSizable> sizable, Size size, signed spacing) -> type& {
properties.append({size.width(), size.height(), spacing < 0 ? settings.spacing : spacing});
mLayout::append(sizable);
@ -125,3 +127,5 @@ auto mVerticalLayout::setVisible(bool visible) -> type& {
}
return *this;
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_VerticalLayout)
struct mVerticalLayout : mLayout {
using type = mVerticalLayout;
using mLayout::append;
@ -28,3 +30,5 @@ struct mVerticalLayout : mLayout {
};
nall::vector<Properties> properties;
};
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_Action)
namespace hiro {
auto pAction::construct() -> void {
@ -29,3 +31,5 @@ auto pAction::_mnemonic(string text) -> string {
}
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_Action)
namespace hiro {
struct pAction : pObject {
@ -13,3 +15,5 @@ struct pAction : pObject {
};
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_MenuCheckItem)
namespace hiro {
static auto MenuCheckItem_toggle(GtkCheckMenuItem* gtkCheckMenuItem, pMenuCheckItem* p) -> void {
@ -32,3 +34,5 @@ auto pMenuCheckItem::setText(const string& text) -> void {
}
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_MenuCheckItem)
namespace hiro {
struct pMenuCheckItem : pAction {
@ -9,3 +11,5 @@ struct pMenuCheckItem : pAction {
};
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_MenuItem)
namespace hiro {
static auto MenuItem_activate(GtkMenuItem*, pMenuItem* p) -> void {
@ -28,3 +30,5 @@ auto pMenuItem::setText(const string& text) -> void {
}
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_MenuItem)
namespace hiro {
struct pMenuItem : pAction {
@ -8,3 +10,5 @@ struct pMenuItem : pAction {
};
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_MenuRadioItem)
namespace hiro {
static auto MenuRadioItem_activate(GtkCheckMenuItem* gtkCheckMenuItem, pMenuRadioItem* p) -> void {
@ -73,3 +75,5 @@ auto pMenuRadioItem::_parent() -> pMenuRadioItem& {
}
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_MenuRadioItem)
namespace hiro {
struct pMenuRadioItem : pAction {
@ -12,3 +14,5 @@ struct pMenuRadioItem : pAction {
};
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_MenuSeparator)
namespace hiro {
auto pMenuSeparator::construct() -> void {
@ -9,3 +11,5 @@ auto pMenuSeparator::destruct() -> void {
}
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_MenuSeparator)
namespace hiro {
struct pMenuSeparator : pAction {
@ -5,3 +7,5 @@ struct pMenuSeparator : pAction {
};
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_Menu)
namespace hiro {
auto pMenu::construct() -> void {
@ -18,7 +20,7 @@ auto pMenu::append(sAction action) -> void {
if(action->self()) {
gtk_menu_shell_append(GTK_MENU_SHELL(gtkMenu), action->self()->widget);
action->self()->setFont(action->font(true));
action->self()->setVisible(action->visible(true));
action->self()->setVisible(action->visible()); //hidden parent will hide child; no need to inherit visibility
}
}
@ -46,3 +48,5 @@ auto pMenu::setText(const string& text) -> void {
}
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_Menu)
namespace hiro {
struct pMenu : pAction {
@ -13,3 +15,5 @@ struct pMenu : pAction {
};
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_Application)
namespace hiro {
#if defined(PLATFORM_XORG)
@ -106,3 +108,5 @@ void pApplication::initialize() {
}
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_Application)
namespace hiro {
struct pApplication {
@ -14,3 +16,5 @@ struct pApplication {
};
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_BrowserWindow)
namespace hiro {
static void BrowserWindow_addFilters(GtkWidget* dialog, lstring filters) {
@ -86,3 +88,5 @@ auto pBrowserWindow::save(BrowserWindow::State& state) -> string {
}
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_BrowserWindow)
namespace hiro {
struct pBrowserWindow {
@ -7,3 +9,5 @@ struct pBrowserWindow {
};
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_Desktop)
namespace hiro {
Size pDesktop::size() {
@ -46,3 +48,5 @@ Geometry pDesktop::workspace() {
}
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_Desktop)
namespace hiro {
struct pDesktop {
@ -6,3 +8,5 @@ struct pDesktop {
};
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_Font)
namespace hiro {
string pFont::serif(unsigned size, string style) {
@ -75,3 +77,5 @@ void pFont::setFont(GtkWidget* widget, gpointer font) {
}
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_Font)
namespace hiro {
struct pFont {
@ -14,3 +16,5 @@ struct pFont {
};
}
#endif

View File

@ -14,28 +14,32 @@
#include <uxtheme.h>
#include <io.h>
#include <shlobj.h>
#include <cairo.h>
#include <gdk/gdk.h>
#include <gdk/gdkwin32.h>
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
#if defined(Hiro_SourceEdit)
#include <gtksourceview/gtksourceview.h>
#include <gtksourceview/gtksourcelanguagemanager.h>
#include <gtksourceview/gtksourcestyleschememanager.h>
#include <cairo.h>
#endif
#include <nall/windows/registry.hpp>
#include <nall/windows/utf8.hpp>
#endif
#if defined(PLATFORM_XORG)
#include <nall/xorg/guard.hpp>
#include <X11/Xatom.h>
#include <cairo.h>
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
#if defined(Hiro_SourceEdit)
#include <gtksourceview/gtksourceview.h>
#include <gtksourceview/gtksourcelanguagemanager.h>
#include <gtksourceview/gtksourcestyleschememanager.h>
#include <cairo.h>
#include <X11/Xatom.h>
#endif
#include <nall/xorg/guard.hpp>
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_Hotkey)
namespace hiro {
auto pHotkey::construct() -> void {
@ -7,3 +9,5 @@ auto pHotkey::destruct() -> void {
}
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_Hotkey)
namespace hiro {
struct pHotkey : pObject {
@ -5,3 +7,5 @@ struct pHotkey : pObject {
};
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_Keyboard)
namespace hiro {
auto pKeyboard::poll() -> vector<bool> {
@ -245,3 +247,5 @@ auto pKeyboard::initialize() -> void {
}
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_Mouse)
namespace hiro {
struct pKeyboard {
@ -11,3 +13,5 @@ struct pKeyboard {
};
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_Layout)
namespace hiro {
auto pLayout::construct() -> void {
@ -27,3 +29,5 @@ auto pLayout::setVisible(bool visible) -> void {
}
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(Hiro_Layout)
namespace hiro {
struct pLayout : pSizable {
@ -9,3 +11,5 @@ struct pLayout : pSizable {
};
}
#endif

Some files were not shown because too many files have changed in this diff Show More