mirror of https://github.com/bsnes-emu/bsnes.git
Update to v094r41 release (open beta).
byuu says: Changelog (since the last open beta): - icarus is now included. icarus is used to import game files/archives into game paks (folders) - SNES: mid-scanline BGMODE changes now emulated correctly (used only by atx2.smc Anthrox Demo) - GBA: fixed a CPU bug that was causing dozens of games to have distorted audio - GBA: fixed default FlashROM ID; should allow much higher compatibility - GBA: now using Cydrak's new, much improved, GBA color emulation filter (still a work-in-progress) - re-added command-line loading support for game paks (not for game files/archives, sorry!) - Qt port now compiles and runs again (may be a little buggy; Windows/GTK+ ports preferred) - SNES performance profile now compiles and runs again - much more
This commit is contained in:
parent
4344b916b6
commit
213879771e
|
@ -8,7 +8,7 @@ using namespace nall;
|
|||
|
||||
namespace Emulator {
|
||||
static const string Name = "higan";
|
||||
static const string Version = "094.40";
|
||||
static const string Version = "094.41";
|
||||
static const string Author = "byuu";
|
||||
static const string License = "GPLv3";
|
||||
static const string Website = "http://byuu.org/";
|
||||
|
|
|
@ -32,6 +32,7 @@ void Video::generate_palette(Emulator::Interface::PaletteMode mode) {
|
|||
}
|
||||
|
||||
if(mode == Emulator::Interface::PaletteMode::Emulation) {
|
||||
#if 0
|
||||
R = curve[R];
|
||||
G = curve[G];
|
||||
B = curve[B];
|
||||
|
@ -67,6 +68,16 @@ void Video::generate_palette(Emulator::Interface::PaletteMode mode) {
|
|||
R = image::normalize(R, 8, 16);
|
||||
G = image::normalize(G, 8, 16);
|
||||
B = image::normalize(B, 8, 16);
|
||||
#else
|
||||
double lcdGamma = 4.0, outGamma = 2.2;
|
||||
double lb = pow(B / 31.0, lcdGamma);
|
||||
double lg = pow(G / 31.0, lcdGamma);
|
||||
double lr = pow(R / 31.0, lcdGamma);
|
||||
B = pow((220 * lb + 10 * lg + 50 * lr) / 255, 1 / outGamma) * (0xffff * 255 / 280);
|
||||
G = pow(( 30 * lb + 230 * lg + 10 * lr) / 255, 1 / outGamma) * (0xffff * 255 / 280);
|
||||
R = pow(( 0 * lb + 50 * lg + 255 * lr) / 255, 1 / outGamma) * (0xffff * 255 / 280);
|
||||
#endif
|
||||
|
||||
palette[color] = interface->videoColor(color, 0, R, G, B);
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
#define Hiro_Console
|
||||
#define Hiro_Frame
|
||||
#define Hiro_HexEdit
|
||||
#define Hiro_HorizontalScroller
|
||||
#define Hiro_HorizontalScrollBar
|
||||
#define Hiro_HorizontalSlider
|
||||
#define Hiro_IconView
|
||||
#define Hiro_Label
|
||||
|
@ -67,7 +67,7 @@
|
|||
#define Hiro_TabFrame
|
||||
#define Hiro_TextEdit
|
||||
#define Hiro_TreeView
|
||||
#define Hiro_VerticalScroller
|
||||
#define Hiro_VerticalScrollBar
|
||||
#define Hiro_VerticalSlider
|
||||
#define Hiro_Viewport
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ namespace hiro {
|
|||
#include "widget/console.cpp"
|
||||
#include "widget/frame.cpp"
|
||||
#include "widget/hex-edit.cpp"
|
||||
#include "widget/horizontal-scroller.cpp"
|
||||
#include "widget/horizontal-scroll-bar.cpp"
|
||||
#include "widget/horizontal-slider.cpp"
|
||||
#include "widget/icon-view.cpp"
|
||||
#include "widget/icon-view-item.cpp"
|
||||
|
@ -95,7 +95,7 @@ namespace hiro {
|
|||
#include "widget/text-edit.cpp"
|
||||
#include "widget/tree-view.cpp"
|
||||
#include "widget/tree-view-item.cpp"
|
||||
#include "widget/vertical-scroller.cpp"
|
||||
#include "widget/vertical-scroll-bar.cpp"
|
||||
#include "widget/vertical-slider.cpp"
|
||||
#include "widget/viewport.cpp"
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ Declare(ComboButtonItem)
|
|||
Declare(Console)
|
||||
Declare(Frame)
|
||||
Declare(HexEdit)
|
||||
Declare(HorizontalScroller)
|
||||
Declare(HorizontalScrollBar)
|
||||
Declare(HorizontalSlider)
|
||||
Declare(IconView)
|
||||
Declare(IconViewItem)
|
||||
|
@ -77,7 +77,7 @@ Declare(TabFrameItem)
|
|||
Declare(TextEdit)
|
||||
Declare(TreeView)
|
||||
Declare(TreeViewItem)
|
||||
Declare(VerticalScroller)
|
||||
Declare(VerticalScrollBar)
|
||||
Declare(VerticalSlider)
|
||||
Declare(Viewport)
|
||||
|
||||
|
@ -297,12 +297,36 @@ struct Geometry {
|
|||
|
||||
#if defined(Hiro_Font)
|
||||
struct Font {
|
||||
Font() = delete;
|
||||
using type = Font;
|
||||
|
||||
Font();
|
||||
Font(const string& family, unsigned size = 0);
|
||||
|
||||
explicit operator bool() const;
|
||||
auto operator==(const Font& source) const -> bool;
|
||||
auto operator!=(const Font& source) const -> bool;
|
||||
|
||||
auto bold() const -> bool;
|
||||
auto family() const -> string;
|
||||
auto italic() const -> bool;
|
||||
auto setBold(bool bold = true) -> type&;
|
||||
auto setFamily(const string& family = "") -> type&;
|
||||
auto setItalic(bool italic = true) -> type&;
|
||||
auto setSize(unsigned size = 0) -> type&;
|
||||
auto size() const -> unsigned;
|
||||
|
||||
static auto serif(unsigned size = 0, const string& style = "") -> string;
|
||||
static auto sans(unsigned size = 0, const string& style = "") -> string;
|
||||
static auto monospace(unsigned size = 0, const string& style = "") -> string;
|
||||
static auto size(const string& font, const string& text = " ") -> Size;
|
||||
|
||||
//private:
|
||||
struct State {
|
||||
string family;
|
||||
unsigned size = 0;
|
||||
bool bold = false;
|
||||
bool italic = false;
|
||||
} state;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -1099,9 +1123,9 @@ struct mHexEdit : mWidget {
|
|||
};
|
||||
#endif
|
||||
|
||||
#if defined(Hiro_HorizontalScroller)
|
||||
struct mHorizontalScroller : mWidget {
|
||||
Declare(HorizontalScroller)
|
||||
#if defined(Hiro_HorizontalScrollBar)
|
||||
struct mHorizontalScrollBar : mWidget {
|
||||
Declare(HorizontalScrollBar)
|
||||
|
||||
auto doChange() const -> void;
|
||||
auto length() const -> unsigned;
|
||||
|
@ -1736,9 +1760,9 @@ struct mTreeViewItem : mObject {
|
|||
};
|
||||
#endif
|
||||
|
||||
#if defined(Hiro_VerticalScroller)
|
||||
struct mVerticalScroller : mWidget {
|
||||
Declare(VerticalScroller)
|
||||
#if defined(Hiro_VerticalScrollBar)
|
||||
struct mVerticalScrollBar : mWidget {
|
||||
Declare(VerticalScrollBar)
|
||||
|
||||
auto doChange() const -> void;
|
||||
auto length() const -> unsigned;
|
||||
|
|
|
@ -1,5 +1,63 @@
|
|||
#if defined(Hiro_Font)
|
||||
|
||||
Font::Font() {
|
||||
}
|
||||
|
||||
Font::Font(const string& family, unsigned size) {
|
||||
state.family = family;
|
||||
state.size = size;
|
||||
}
|
||||
|
||||
Font::operator bool() const {
|
||||
return state.family || state.size || state.bold || state.italic;
|
||||
}
|
||||
|
||||
auto Font::operator==(const Font& source) const -> bool {
|
||||
return family() == source.family() || size() == source.size() && bold() == source.bold() && italic() == source.italic();
|
||||
};
|
||||
|
||||
auto Font::operator!=(const Font& source) const -> bool {
|
||||
return !operator==(source);
|
||||
}
|
||||
|
||||
auto Font::bold() const -> bool {
|
||||
return state.bold;
|
||||
}
|
||||
|
||||
auto Font::family() const -> string {
|
||||
return state.family;
|
||||
}
|
||||
|
||||
auto Font::italic() const -> bool {
|
||||
return state.italic;
|
||||
}
|
||||
|
||||
auto Font::setBold(bool bold) -> type& {
|
||||
state.bold = bold;
|
||||
return *this;
|
||||
}
|
||||
|
||||
auto Font::setFamily(const string& family) -> type& {
|
||||
state.family = family;
|
||||
return *this;
|
||||
}
|
||||
|
||||
auto Font::setItalic(bool italic) -> type& {
|
||||
state.italic = italic;
|
||||
return *this;
|
||||
}
|
||||
|
||||
auto Font::setSize(unsigned size) -> type& {
|
||||
state.size = size;
|
||||
return *this;
|
||||
}
|
||||
|
||||
auto Font::size() const -> unsigned {
|
||||
return state.size;
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
auto Font::serif(unsigned size, const string& style) -> string {
|
||||
return pFont::serif(size, style);
|
||||
}
|
||||
|
|
|
@ -358,9 +358,9 @@ struct HexEdit : sHexEdit {
|
|||
};
|
||||
#endif
|
||||
|
||||
#if defined(Hiro_HorizontalScroller)
|
||||
struct HorizontalScroller : sHorizontalScroller {
|
||||
DeclareSharedWidget(HorizontalScroller)
|
||||
#if defined(Hiro_HorizontalScrollBar)
|
||||
struct HorizontalScrollBar : sHorizontalScrollBar {
|
||||
DeclareSharedWidget(HorizontalScrollBar)
|
||||
|
||||
auto doChange() const { return self().doChange(); }
|
||||
auto length() const { return self().length(); }
|
||||
|
@ -762,9 +762,9 @@ struct TreeView : sTreeView {
|
|||
};
|
||||
#endif
|
||||
|
||||
#if defined(Hiro_VerticalScroller)
|
||||
struct VerticalScroller : sVerticalScroller {
|
||||
DeclareSharedWidget(VerticalScroller)
|
||||
#if defined(Hiro_VerticalScrollBar)
|
||||
struct VerticalScrollBar : sVerticalScrollBar {
|
||||
DeclareSharedWidget(VerticalScrollBar)
|
||||
|
||||
auto doChange() const { return self().doChange(); }
|
||||
auto length() const { return self().length(); }
|
||||
|
|
|
@ -12,6 +12,7 @@ auto mComboButton::destruct() -> void {
|
|||
//
|
||||
|
||||
auto mComboButton::append(sComboButtonItem item) -> type& {
|
||||
if(!state.items) item->state.selected = true;
|
||||
state.items.append(item);
|
||||
item->setParent(this, itemCount() - 1);
|
||||
signal(append, item);
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
#if defined(Hiro_HorizontalScrollBar)
|
||||
|
||||
auto mHorizontalScrollBar::allocate() -> pObject* {
|
||||
return new pHorizontalScrollBar(*this);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
auto mHorizontalScrollBar::doChange() const -> void {
|
||||
if(state.onChange) return state.onChange();
|
||||
}
|
||||
|
||||
auto mHorizontalScrollBar::length() const -> unsigned {
|
||||
return state.length;
|
||||
}
|
||||
|
||||
auto mHorizontalScrollBar::onChange(const function<void ()>& callback) -> type& {
|
||||
state.onChange = callback;
|
||||
return *this;
|
||||
}
|
||||
|
||||
auto mHorizontalScrollBar::position() const -> unsigned {
|
||||
return state.position;
|
||||
}
|
||||
|
||||
auto mHorizontalScrollBar::setLength(unsigned length) -> type& {
|
||||
state.length = length;
|
||||
signal(setLength, length);
|
||||
return *this;
|
||||
}
|
||||
|
||||
auto mHorizontalScrollBar::setPosition(unsigned position) -> type& {
|
||||
state.position = position;
|
||||
signal(setPosition, position);
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,38 +0,0 @@
|
|||
#if defined(Hiro_HorizontalScroller)
|
||||
|
||||
auto mHorizontalScroller::allocate() -> pObject* {
|
||||
return new pHorizontalScroller(*this);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
auto mHorizontalScroller::doChange() const -> void {
|
||||
if(state.onChange) return state.onChange();
|
||||
}
|
||||
|
||||
auto mHorizontalScroller::length() const -> unsigned {
|
||||
return state.length;
|
||||
}
|
||||
|
||||
auto mHorizontalScroller::onChange(const function<void ()>& callback) -> type& {
|
||||
state.onChange = callback;
|
||||
return *this;
|
||||
}
|
||||
|
||||
auto mHorizontalScroller::position() const -> unsigned {
|
||||
return state.position;
|
||||
}
|
||||
|
||||
auto mHorizontalScroller::setLength(unsigned length) -> type& {
|
||||
state.length = length;
|
||||
signal(setLength, length);
|
||||
return *this;
|
||||
}
|
||||
|
||||
auto mHorizontalScroller::setPosition(unsigned position) -> type& {
|
||||
state.position = position;
|
||||
signal(setPosition, position);
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif
|
|
@ -146,11 +146,8 @@ auto mListView::remove(sListViewItem item) -> type& {
|
|||
}
|
||||
|
||||
auto mListView::reset() -> type& {
|
||||
signal(reset);
|
||||
for(auto& item : state.items) item->setParent();
|
||||
state.items.reset();
|
||||
if(auto& header = state.header) header->setParent();
|
||||
state.header.reset();
|
||||
for(auto n : rrange(state.items)) remove(state.items[n]);
|
||||
if(auto& header = state.header) remove(header);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
#if defined(Hiro_VerticalScrollBar)
|
||||
|
||||
auto mVerticalScrollBar::allocate() -> pObject* {
|
||||
return new pVerticalScrollBar(*this);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
auto mVerticalScrollBar::doChange() const -> void {
|
||||
if(state.onChange) return state.onChange();
|
||||
}
|
||||
|
||||
auto mVerticalScrollBar::length() const -> unsigned {
|
||||
return state.length;
|
||||
}
|
||||
|
||||
auto mVerticalScrollBar::onChange(const function<void ()>& callback) -> type& {
|
||||
state.onChange = callback;
|
||||
return *this;
|
||||
}
|
||||
|
||||
auto mVerticalScrollBar::position() const -> unsigned {
|
||||
return state.position;
|
||||
}
|
||||
|
||||
auto mVerticalScrollBar::setLength(unsigned length) -> type& {
|
||||
state.length = length;
|
||||
signal(setLength, length);
|
||||
return *this;
|
||||
}
|
||||
|
||||
auto mVerticalScrollBar::setPosition(unsigned position) -> type& {
|
||||
state.position = position;
|
||||
signal(setPosition, position);
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,38 +0,0 @@
|
|||
#if defined(Hiro_VerticalScroller)
|
||||
|
||||
auto mVerticalScroller::allocate() -> pObject* {
|
||||
return new pVerticalScroller(*this);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
auto mVerticalScroller::doChange() const -> void {
|
||||
if(state.onChange) return state.onChange();
|
||||
}
|
||||
|
||||
auto mVerticalScroller::length() const -> unsigned {
|
||||
return state.length;
|
||||
}
|
||||
|
||||
auto mVerticalScroller::onChange(const function<void ()>& callback) -> type& {
|
||||
state.onChange = callback;
|
||||
return *this;
|
||||
}
|
||||
|
||||
auto mVerticalScroller::position() const -> unsigned {
|
||||
return state.position;
|
||||
}
|
||||
|
||||
auto mVerticalScroller::setLength(unsigned length) -> type& {
|
||||
state.length = length;
|
||||
signal(setLength, length);
|
||||
return *this;
|
||||
}
|
||||
|
||||
auto mVerticalScroller::setPosition(unsigned position) -> type& {
|
||||
state.position = position;
|
||||
signal(setPosition, position);
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif
|
|
@ -39,7 +39,7 @@
|
|||
#include "widget/console.cpp"
|
||||
#include "widget/frame.cpp"
|
||||
#include "widget/hex-edit.cpp"
|
||||
#include "widget/horizontal-scroller.cpp"
|
||||
#include "widget/horizontal-scroll-bar.cpp"
|
||||
#include "widget/horizontal-slider.cpp"
|
||||
#include "widget/icon-view.cpp"
|
||||
#include "widget/icon-view-item.cpp"
|
||||
|
@ -59,7 +59,7 @@
|
|||
#include "widget/text-edit.cpp"
|
||||
#include "widget/tree-view.cpp"
|
||||
#include "widget/tree-view-item.cpp"
|
||||
#include "widget/vertical-scroller.cpp"
|
||||
#include "widget/vertical-scroll-bar.cpp"
|
||||
#include "widget/vertical-slider.cpp"
|
||||
#include "widget/viewport.cpp"
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ namespace hiro {
|
|||
#include "widget/console.hpp"
|
||||
#include "widget/frame.hpp"
|
||||
#include "widget/hex-edit.hpp"
|
||||
#include "widget/horizontal-scroller.hpp"
|
||||
#include "widget/horizontal-scroll-bar.hpp"
|
||||
#include "widget/horizontal-slider.hpp"
|
||||
#include "widget/icon-view.hpp"
|
||||
#include "widget/icon-view-item.hpp"
|
||||
|
@ -70,7 +70,7 @@ namespace hiro {
|
|||
#include "widget/text-edit.hpp"
|
||||
#include "widget/tree-view.hpp"
|
||||
#include "widget/tree-view-item.hpp"
|
||||
#include "widget/vertical-scroller.hpp"
|
||||
#include "widget/vertical-scroll-bar.hpp"
|
||||
#include "widget/vertical-slider.hpp"
|
||||
#include "widget/viewport.hpp"
|
||||
|
||||
|
|
|
@ -1,34 +1,34 @@
|
|||
#if defined(Hiro_HorizontalScroller)
|
||||
#if defined(Hiro_HorizontalScrollBar)
|
||||
|
||||
namespace hiro {
|
||||
|
||||
static auto HorizontalScroller_change(GtkRange* gtkRange, pHorizontalScroller* p) -> void {
|
||||
static auto HorizontalScrollBar_change(GtkRange* gtkRange, pHorizontalScrollBar* p) -> void {
|
||||
auto position = (unsigned)gtk_range_get_value(gtkRange);
|
||||
if(p->state().position == position) return;
|
||||
p->state().position = position;
|
||||
if(!p->locked()) p->self().doChange();
|
||||
}
|
||||
|
||||
auto pHorizontalScroller::construct() -> void {
|
||||
auto pHorizontalScrollBar::construct() -> void {
|
||||
gtkWidget = gtk_hscrollbar_new(0);
|
||||
|
||||
setLength(state().length);
|
||||
setPosition(state().position);
|
||||
|
||||
g_signal_connect(G_OBJECT(gtkWidget), "value-changed", G_CALLBACK(HorizontalScroller_change), (gpointer)this);
|
||||
g_signal_connect(G_OBJECT(gtkWidget), "value-changed", G_CALLBACK(HorizontalScrollBar_change), (gpointer)this);
|
||||
|
||||
pWidget::construct();
|
||||
}
|
||||
|
||||
auto pHorizontalScroller::destruct() -> void {
|
||||
auto pHorizontalScrollBar::destruct() -> void {
|
||||
gtk_widget_destroy(gtkWidget);
|
||||
}
|
||||
|
||||
auto pHorizontalScroller::minimumSize() const -> Size {
|
||||
auto pHorizontalScrollBar::minimumSize() const -> Size {
|
||||
return {0, 20};
|
||||
}
|
||||
|
||||
auto pHorizontalScroller::setLength(unsigned length) -> void {
|
||||
auto pHorizontalScrollBar::setLength(unsigned length) -> void {
|
||||
lock();
|
||||
length += length == 0;
|
||||
gtk_range_set_range(GTK_RANGE(gtkWidget), 0, max(1u, length - 1));
|
||||
|
@ -36,7 +36,7 @@ auto pHorizontalScroller::setLength(unsigned length) -> void {
|
|||
unlock();
|
||||
}
|
||||
|
||||
auto pHorizontalScroller::setPosition(unsigned position) -> void {
|
||||
auto pHorizontalScrollBar::setPosition(unsigned position) -> void {
|
||||
gtk_range_set_value(GTK_RANGE(gtkWidget), position);
|
||||
}
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
#if defined(Hiro_HorizontalScroller)
|
||||
#if defined(Hiro_HorizontalScrollBar)
|
||||
|
||||
namespace hiro {
|
||||
|
||||
struct pHorizontalScroller : pWidget {
|
||||
Declare(HorizontalScroller, Widget)
|
||||
struct pHorizontalScrollBar : pWidget {
|
||||
Declare(HorizontalScrollBar, Widget)
|
||||
|
||||
auto minimumSize() const -> Size;
|
||||
auto setLength(unsigned length) -> void;
|
|
@ -66,18 +66,6 @@ auto pListView::remove(sListViewHeader header) -> void {
|
|||
auto pListView::remove(sListViewItem item) -> void {
|
||||
}
|
||||
|
||||
auto pListView::reset() -> void {
|
||||
GList* list = gtk_tree_view_get_columns(gtkTreeView);
|
||||
GList* p = list;
|
||||
while(p && p->data) {
|
||||
gtk_tree_view_remove_column(gtkTreeView, (GtkTreeViewColumn*)p->data);
|
||||
p = p->next;
|
||||
}
|
||||
g_list_free(list);
|
||||
_createModel();
|
||||
gtk_tree_view_set_rules_hint(gtkTreeView, false);
|
||||
}
|
||||
|
||||
auto pListView::resizeColumns() -> void {
|
||||
lock();
|
||||
|
||||
|
@ -159,7 +147,7 @@ auto pListView::_cellWidth(unsigned _row, unsigned _column) -> unsigned {
|
|||
if(auto item = self().item(_row)) {
|
||||
if(auto cell = item->cell(_column)) {
|
||||
if(cell->state.checkable) {
|
||||
width += 32;
|
||||
width += 24;
|
||||
}
|
||||
if(auto& icon = cell->state.icon) {
|
||||
width += icon.width() + 2;
|
||||
|
|
|
@ -10,7 +10,6 @@ struct pListView : pWidget {
|
|||
auto focused() const -> bool override;
|
||||
auto remove(sListViewHeader column) -> void;
|
||||
auto remove(sListViewItem item) -> void;
|
||||
auto reset() -> void;
|
||||
auto resizeColumns() -> void;
|
||||
auto setAlignment(Alignment alignment) -> void;
|
||||
auto setBackgroundColor(Color color) -> void;
|
||||
|
|
|
@ -1,34 +1,34 @@
|
|||
#if defined(Hiro_VerticalScroller)
|
||||
#if defined(Hiro_VerticalScrollBar)
|
||||
|
||||
namespace hiro {
|
||||
|
||||
static auto VerticalScroller_change(GtkRange* gtkRange, pVerticalScroller* p) -> void {
|
||||
static auto VerticalScrollBar_change(GtkRange* gtkRange, pVerticalScrollBar* p) -> void {
|
||||
auto position = (unsigned)gtk_range_get_value(gtkRange);
|
||||
if(p->state().position == position) return;
|
||||
p->state().position = position;
|
||||
if(!p->locked()) p->self().doChange();
|
||||
}
|
||||
|
||||
auto pVerticalScroller::construct() -> void {
|
||||
auto pVerticalScrollBar::construct() -> void {
|
||||
gtkWidget = gtk_vscrollbar_new(0);
|
||||
|
||||
setLength(state().length);
|
||||
setPosition(state().position);
|
||||
|
||||
g_signal_connect(G_OBJECT(gtkWidget), "value-changed", G_CALLBACK(VerticalScroller_change), (gpointer)this);
|
||||
g_signal_connect(G_OBJECT(gtkWidget), "value-changed", G_CALLBACK(VerticalScrollBar_change), (gpointer)this);
|
||||
|
||||
pWidget::construct();
|
||||
}
|
||||
|
||||
auto pVerticalScroller::destruct() -> void {
|
||||
auto pVerticalScrollBar::destruct() -> void {
|
||||
gtk_widget_destroy(gtkWidget);
|
||||
}
|
||||
|
||||
auto pVerticalScroller::minimumSize() const -> Size {
|
||||
auto pVerticalScrollBar::minimumSize() const -> Size {
|
||||
return {20, 0};
|
||||
}
|
||||
|
||||
auto pVerticalScroller::setLength(unsigned length) -> void {
|
||||
auto pVerticalScrollBar::setLength(unsigned length) -> void {
|
||||
lock();
|
||||
length += length == 0;
|
||||
gtk_range_set_range(GTK_RANGE(gtkWidget), 0, max(1u, length - 1));
|
||||
|
@ -36,7 +36,7 @@ auto pVerticalScroller::setLength(unsigned length) -> void {
|
|||
unlock();
|
||||
}
|
||||
|
||||
auto pVerticalScroller::setPosition(unsigned position) -> void {
|
||||
auto pVerticalScrollBar::setPosition(unsigned position) -> void {
|
||||
gtk_range_set_value(GTK_RANGE(gtkWidget), position);
|
||||
}
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
#if defined(Hiro_VerticalScroller)
|
||||
#if defined(Hiro_VerticalScrollBar)
|
||||
|
||||
namespace hiro {
|
||||
|
||||
struct pVerticalScroller : pWidget {
|
||||
Declare(VerticalScroller, Widget)
|
||||
struct pVerticalScrollBar : pWidget {
|
||||
Declare(VerticalScrollBar, Widget)
|
||||
|
||||
auto minimumSize() const -> Size;
|
||||
auto setLength(unsigned length) -> void;
|
|
@ -9,53 +9,15 @@ auto pAction::destruct() -> void {
|
|||
}
|
||||
|
||||
auto pAction::setEnabled(bool enabled) -> void {
|
||||
/*
|
||||
if(dynamic_cast<Menu*>(&action)) {
|
||||
((Menu&)action).p.qtMenu->setEnabled(enabled);
|
||||
} else if(dynamic_cast<Separator*>(&action)) {
|
||||
((Separator&)action).p.qtAction->setEnabled(enabled);
|
||||
} else if(dynamic_cast<Item*>(&action)) {
|
||||
((Item&)action).p.qtAction->setEnabled(enabled);
|
||||
} else if(dynamic_cast<CheckItem*>(&action)) {
|
||||
((CheckItem&)action).p.qtAction->setEnabled(enabled);
|
||||
} else if(dynamic_cast<RadioItem*>(&action)) {
|
||||
((RadioItem&)action).p.qtAction->setEnabled(enabled);
|
||||
}
|
||||
*/
|
||||
_setState();
|
||||
}
|
||||
|
||||
auto pAction::setFont(const string& font) -> void {
|
||||
/*
|
||||
QFont qtFont = pFont::create(font);
|
||||
|
||||
if(dynamic_cast<Menu*>(&action)) {
|
||||
((Menu&)action).p.setFont(font);
|
||||
} else if(dynamic_cast<Separator*>(&action)) {
|
||||
((Separator&)action).p.qtAction->setFont(qtFont);
|
||||
} else if(dynamic_cast<Item*>(&action)) {
|
||||
((Item&)action).p.qtAction->setFont(qtFont);
|
||||
} else if(dynamic_cast<CheckItem*>(&action)) {
|
||||
((CheckItem&)action).p.qtAction->setFont(qtFont);
|
||||
} else if(dynamic_cast<RadioItem*>(&action)) {
|
||||
((RadioItem&)action).p.qtAction->setFont(qtFont);
|
||||
}
|
||||
*/
|
||||
_setState();
|
||||
}
|
||||
|
||||
auto pAction::setVisible(bool visible) -> void {
|
||||
/*
|
||||
if(dynamic_cast<Menu*>(&action)) {
|
||||
((Menu&)action).p.qtMenu->menuAction()->setVisible(visible);
|
||||
} else if(dynamic_cast<Separator*>(&action)) {
|
||||
((Separator&)action).p.qtAction->setVisible(visible);
|
||||
} else if(dynamic_cast<Item*>(&action)) {
|
||||
((Item&)action).p.qtAction->setVisible(visible);
|
||||
} else if(dynamic_cast<CheckItem*>(&action)) {
|
||||
((CheckItem&)action).p.qtAction->setVisible(visible);
|
||||
} else if(dynamic_cast<RadioItem*>(&action)) {
|
||||
((RadioItem&)action).p.qtAction->setVisible(visible);
|
||||
}
|
||||
*/
|
||||
_setState();
|
||||
}
|
||||
|
||||
auto pAction::_parentMenu() -> maybe<pMenu&> {
|
||||
|
|
|
@ -33,10 +33,6 @@ auto pMenu::append(sAction action) -> void {
|
|||
auto pMenu::remove(sAction action) -> void {
|
||||
}
|
||||
|
||||
auto pMenu::setFont(const string& font) -> void {
|
||||
_setState();
|
||||
}
|
||||
|
||||
auto pMenu::setIcon(const image& icon) -> void {
|
||||
_setState();
|
||||
}
|
||||
|
@ -46,9 +42,11 @@ auto pMenu::setText(const string& text) -> void {
|
|||
}
|
||||
|
||||
auto pMenu::_setState() -> void {
|
||||
qtMenu->setEnabled(self().enabled());
|
||||
qtMenu->setFont(pFont::create(self().font(true)));
|
||||
qtMenu->setIcon(CreateIcon(state().icon));
|
||||
qtMenu->setTitle(QString::fromUtf8(state().text));
|
||||
qtMenu->menuAction()->setVisible(self().visible());
|
||||
|
||||
for(auto& action : state().actions) {
|
||||
if(auto self = action->self()) self->setFont(action->font(true));
|
||||
|
|
|
@ -7,7 +7,6 @@ struct pMenu : public pAction {
|
|||
|
||||
auto append(sAction action) -> void;
|
||||
auto remove(sAction action) -> void;
|
||||
auto setFont(const string& font) -> void override;
|
||||
auto setIcon(const image& icon) -> void;
|
||||
auto setText(const string& text) -> void;
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ auto pFont::size(const QFont& qtFont, const string& text) -> Size {
|
|||
QFontMetrics metrics(qtFont);
|
||||
|
||||
lstring lines;
|
||||
lines.split("\n", text ? text : " ");
|
||||
lines.split(text ? text : " ", "\n");
|
||||
|
||||
unsigned maxWidth = 0;
|
||||
for(auto& line : lines) {
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
#include "widget/console.cpp"
|
||||
#include "widget/frame.cpp"
|
||||
#include "widget/hex-edit.cpp"
|
||||
#include "widget/horizontal-scroller.cpp"
|
||||
#include "widget/horizontal-scroll-bar.cpp"
|
||||
#include "widget/horizontal-slider.cpp"
|
||||
#include "widget/icon-view.cpp"
|
||||
#include "widget/label.cpp"
|
||||
|
@ -59,7 +59,7 @@
|
|||
#include "widget/tab-frame.cpp"
|
||||
#include "widget/tab-frame-item.cpp"
|
||||
#include "widget/text-edit.cpp"
|
||||
#include "widget/vertical-scroller.cpp"
|
||||
#include "widget/vertical-scroll-bar.cpp"
|
||||
#include "widget/vertical-slider.cpp"
|
||||
#include "widget/viewport.cpp"
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
#include "widget/combo-button-item.hpp"
|
||||
#include "widget/frame.hpp"
|
||||
#include "widget/hex-edit.hpp"
|
||||
#include "widget/horizontal-scroller.hpp"
|
||||
#include "widget/horizontal-scroll-bar.hpp"
|
||||
#include "widget/horizontal-slider.hpp"
|
||||
#include "widget/label.hpp"
|
||||
#include "widget/line-edit.hpp"
|
||||
|
@ -60,7 +60,7 @@
|
|||
#include "widget/tab-frame.hpp"
|
||||
#include "widget/tab-frame-item.hpp"
|
||||
#include "widget/text-edit.hpp"
|
||||
#include "widget/vertical-scroller.hpp"
|
||||
#include "widget/vertical-scroll-bar.hpp"
|
||||
#include "widget/vertical-slider.hpp"
|
||||
#include "widget/viewport.hpp"
|
||||
|
||||
|
|
|
@ -134,7 +134,7 @@ public:
|
|||
QtComboButton(pComboButton& p) : p(p) {}
|
||||
pComboButton& p;
|
||||
public slots:
|
||||
void onChange();
|
||||
void onChange(int offset);
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -160,12 +160,12 @@ public slots:
|
|||
};
|
||||
#endif
|
||||
|
||||
#if defined(Hiro_HorizontalScroller)
|
||||
struct QtHorizontalScroller : public QScrollBar {
|
||||
#if defined(Hiro_HorizontalScrollBar)
|
||||
struct QtHorizontalScrollBar : public QScrollBar {
|
||||
Q_OBJECT
|
||||
public:
|
||||
QtHorizontalScroller(pHorizontalScroller& p) : QScrollBar(Qt::Horizontal), p(p) {}
|
||||
pHorizontalScroller& p;
|
||||
QtHorizontalScrollBar(pHorizontalScrollBar& p) : QScrollBar(Qt::Horizontal), p(p) {}
|
||||
pHorizontalScrollBar& p;
|
||||
public slots:
|
||||
void onChange();
|
||||
};
|
||||
|
@ -208,7 +208,7 @@ public slots:
|
|||
void onChange();
|
||||
void onContext();
|
||||
void onSort(int column);
|
||||
void onToggle(QTreeWidgetItem* item);
|
||||
void onToggle(QTreeWidgetItem* item, int column);
|
||||
};
|
||||
|
||||
struct QtListViewDelegate : public QStyledItemDelegate {
|
||||
|
@ -263,12 +263,12 @@ public slots:
|
|||
};
|
||||
#endif
|
||||
|
||||
#if defined(Hiro_VerticalScroller)
|
||||
struct QtVerticalScroller : public QScrollBar {
|
||||
#if defined(Hiro_VerticalScrollBar)
|
||||
struct QtVerticalScrollBar : public QScrollBar {
|
||||
Q_OBJECT
|
||||
public:
|
||||
QtVerticalScroller(pVerticalScroller& p) : QScrollBar(Qt::Vertical), p(p) {}
|
||||
pVerticalScroller& p;
|
||||
QtVerticalScrollBar(pVerticalScrollBar& p) : QScrollBar(Qt::Vertical), p(p) {}
|
||||
pVerticalScrollBar& p;
|
||||
public slots:
|
||||
void onChange();
|
||||
};
|
||||
|
|
|
@ -608,13 +608,14 @@ static const uint qt_meta_data_hiro__QtComboButton[] = {
|
|||
0, // signalCount
|
||||
|
||||
// slots: signature, parameters, type, tag, flags
|
||||
20, 31, 31, 31, 0x0a,
|
||||
20, 34, 41, 41, 0x0a,
|
||||
|
||||
0 // eod
|
||||
};
|
||||
|
||||
static const char qt_meta_stringdata_hiro__QtComboButton[] = {
|
||||
"hiro::QtComboButton\0onChange()\0\0"
|
||||
"hiro::QtComboButton\0onChange(int)\0"
|
||||
"offset\0\0"
|
||||
};
|
||||
|
||||
void hiro::QtComboButton::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
|
||||
|
@ -623,11 +624,10 @@ void hiro::QtComboButton::qt_static_metacall(QObject *_o, QMetaObject::Call _c,
|
|||
Q_ASSERT(staticMetaObject.cast(_o));
|
||||
QtComboButton *_t = static_cast<QtComboButton *>(_o);
|
||||
switch (_id) {
|
||||
case 0: _t->onChange(); break;
|
||||
case 0: _t->onChange((*reinterpret_cast< int(*)>(_a[1]))); break;
|
||||
default: ;
|
||||
}
|
||||
}
|
||||
Q_UNUSED(_a);
|
||||
}
|
||||
|
||||
const QMetaObjectExtraData hiro::QtComboButton::staticMetaObjectExtraData = {
|
||||
|
@ -804,7 +804,7 @@ int hiro::QtHexEditScrollBar::qt_metacall(QMetaObject::Call _c, int _id, void **
|
|||
}
|
||||
return _id;
|
||||
}
|
||||
static const uint qt_meta_data_hiro__QtHorizontalScroller[] = {
|
||||
static const uint qt_meta_data_hiro__QtHorizontalScrollBar[] = {
|
||||
|
||||
// content:
|
||||
6, // revision
|
||||
|
@ -818,21 +818,21 @@ static const uint qt_meta_data_hiro__QtHorizontalScroller[] = {
|
|||
0, // signalCount
|
||||
|
||||
// slots: signature, parameters, type, tag, flags
|
||||
27, 38, 38, 38, 0x0a,
|
||||
28, 39, 39, 39, 0x0a,
|
||||
|
||||
0 // eod
|
||||
};
|
||||
|
||||
static const char qt_meta_stringdata_hiro__QtHorizontalScroller[] = {
|
||||
"hiro::QtHorizontalScroller\0onChange()\0"
|
||||
static const char qt_meta_stringdata_hiro__QtHorizontalScrollBar[] = {
|
||||
"hiro::QtHorizontalScrollBar\0onChange()\0"
|
||||
"\0"
|
||||
};
|
||||
|
||||
void hiro::QtHorizontalScroller::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
|
||||
void hiro::QtHorizontalScrollBar::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
|
||||
{
|
||||
if (_c == QMetaObject::InvokeMetaMethod) {
|
||||
Q_ASSERT(staticMetaObject.cast(_o));
|
||||
QtHorizontalScroller *_t = static_cast<QtHorizontalScroller *>(_o);
|
||||
QtHorizontalScrollBar *_t = static_cast<QtHorizontalScrollBar *>(_o);
|
||||
switch (_id) {
|
||||
case 0: _t->onChange(); break;
|
||||
default: ;
|
||||
|
@ -841,33 +841,33 @@ void hiro::QtHorizontalScroller::qt_static_metacall(QObject *_o, QMetaObject::Ca
|
|||
Q_UNUSED(_a);
|
||||
}
|
||||
|
||||
const QMetaObjectExtraData hiro::QtHorizontalScroller::staticMetaObjectExtraData = {
|
||||
const QMetaObjectExtraData hiro::QtHorizontalScrollBar::staticMetaObjectExtraData = {
|
||||
0, qt_static_metacall
|
||||
};
|
||||
|
||||
const QMetaObject hiro::QtHorizontalScroller::staticMetaObject = {
|
||||
{ &QScrollBar::staticMetaObject, qt_meta_stringdata_hiro__QtHorizontalScroller,
|
||||
qt_meta_data_hiro__QtHorizontalScroller, &staticMetaObjectExtraData }
|
||||
const QMetaObject hiro::QtHorizontalScrollBar::staticMetaObject = {
|
||||
{ &QScrollBar::staticMetaObject, qt_meta_stringdata_hiro__QtHorizontalScrollBar,
|
||||
qt_meta_data_hiro__QtHorizontalScrollBar, &staticMetaObjectExtraData }
|
||||
};
|
||||
|
||||
#ifdef Q_NO_DATA_RELOCATION
|
||||
const QMetaObject &hiro::QtHorizontalScroller::getStaticMetaObject() { return staticMetaObject; }
|
||||
const QMetaObject &hiro::QtHorizontalScrollBar::getStaticMetaObject() { return staticMetaObject; }
|
||||
#endif //Q_NO_DATA_RELOCATION
|
||||
|
||||
const QMetaObject *hiro::QtHorizontalScroller::metaObject() const
|
||||
const QMetaObject *hiro::QtHorizontalScrollBar::metaObject() const
|
||||
{
|
||||
return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject;
|
||||
}
|
||||
|
||||
void *hiro::QtHorizontalScroller::qt_metacast(const char *_clname)
|
||||
void *hiro::QtHorizontalScrollBar::qt_metacast(const char *_clname)
|
||||
{
|
||||
if (!_clname) return 0;
|
||||
if (!strcmp(_clname, qt_meta_stringdata_hiro__QtHorizontalScroller))
|
||||
return static_cast<void*>(const_cast< QtHorizontalScroller*>(this));
|
||||
if (!strcmp(_clname, qt_meta_stringdata_hiro__QtHorizontalScrollBar))
|
||||
return static_cast<void*>(const_cast< QtHorizontalScrollBar*>(this));
|
||||
return QScrollBar::qt_metacast(_clname);
|
||||
}
|
||||
|
||||
int hiro::QtHorizontalScroller::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
|
||||
int hiro::QtHorizontalScrollBar::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
|
||||
{
|
||||
_id = QScrollBar::qt_metacall(_c, _id, _a);
|
||||
if (_id < 0)
|
||||
|
@ -1049,7 +1049,7 @@ static const uint qt_meta_data_hiro__QtListView[] = {
|
|||
31, 30, 30, 30, 0x0a,
|
||||
42, 30, 30, 30, 0x0a,
|
||||
54, 66, 30, 30, 0x0a,
|
||||
73, 100, 30, 30, 0x0a,
|
||||
73, 104, 30, 30, 0x0a,
|
||||
|
||||
0 // eod
|
||||
};
|
||||
|
@ -1057,8 +1057,8 @@ static const uint qt_meta_data_hiro__QtListView[] = {
|
|||
static const char qt_meta_stringdata_hiro__QtListView[] = {
|
||||
"hiro::QtListView\0onActivate()\0\0"
|
||||
"onChange()\0onContext()\0onSort(int)\0"
|
||||
"column\0onToggle(QTreeWidgetItem*)\0"
|
||||
"item\0"
|
||||
"column\0onToggle(QTreeWidgetItem*,int)\0"
|
||||
"item,column\0"
|
||||
};
|
||||
|
||||
void hiro::QtListView::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
|
||||
|
@ -1071,7 +1071,7 @@ void hiro::QtListView::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int
|
|||
case 1: _t->onChange(); break;
|
||||
case 2: _t->onContext(); break;
|
||||
case 3: _t->onSort((*reinterpret_cast< int(*)>(_a[1]))); break;
|
||||
case 4: _t->onToggle((*reinterpret_cast< QTreeWidgetItem*(*)>(_a[1]))); break;
|
||||
case 4: _t->onToggle((*reinterpret_cast< QTreeWidgetItem*(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
|
||||
default: ;
|
||||
}
|
||||
}
|
||||
|
@ -1411,7 +1411,7 @@ int hiro::QtTextEdit::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
|
|||
}
|
||||
return _id;
|
||||
}
|
||||
static const uint qt_meta_data_hiro__QtVerticalScroller[] = {
|
||||
static const uint qt_meta_data_hiro__QtVerticalScrollBar[] = {
|
||||
|
||||
// content:
|
||||
6, // revision
|
||||
|
@ -1425,21 +1425,21 @@ static const uint qt_meta_data_hiro__QtVerticalScroller[] = {
|
|||
0, // signalCount
|
||||
|
||||
// slots: signature, parameters, type, tag, flags
|
||||
25, 36, 36, 36, 0x0a,
|
||||
26, 37, 37, 37, 0x0a,
|
||||
|
||||
0 // eod
|
||||
};
|
||||
|
||||
static const char qt_meta_stringdata_hiro__QtVerticalScroller[] = {
|
||||
"hiro::QtVerticalScroller\0onChange()\0"
|
||||
static const char qt_meta_stringdata_hiro__QtVerticalScrollBar[] = {
|
||||
"hiro::QtVerticalScrollBar\0onChange()\0"
|
||||
"\0"
|
||||
};
|
||||
|
||||
void hiro::QtVerticalScroller::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
|
||||
void hiro::QtVerticalScrollBar::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
|
||||
{
|
||||
if (_c == QMetaObject::InvokeMetaMethod) {
|
||||
Q_ASSERT(staticMetaObject.cast(_o));
|
||||
QtVerticalScroller *_t = static_cast<QtVerticalScroller *>(_o);
|
||||
QtVerticalScrollBar *_t = static_cast<QtVerticalScrollBar *>(_o);
|
||||
switch (_id) {
|
||||
case 0: _t->onChange(); break;
|
||||
default: ;
|
||||
|
@ -1448,33 +1448,33 @@ void hiro::QtVerticalScroller::qt_static_metacall(QObject *_o, QMetaObject::Call
|
|||
Q_UNUSED(_a);
|
||||
}
|
||||
|
||||
const QMetaObjectExtraData hiro::QtVerticalScroller::staticMetaObjectExtraData = {
|
||||
const QMetaObjectExtraData hiro::QtVerticalScrollBar::staticMetaObjectExtraData = {
|
||||
0, qt_static_metacall
|
||||
};
|
||||
|
||||
const QMetaObject hiro::QtVerticalScroller::staticMetaObject = {
|
||||
{ &QScrollBar::staticMetaObject, qt_meta_stringdata_hiro__QtVerticalScroller,
|
||||
qt_meta_data_hiro__QtVerticalScroller, &staticMetaObjectExtraData }
|
||||
const QMetaObject hiro::QtVerticalScrollBar::staticMetaObject = {
|
||||
{ &QScrollBar::staticMetaObject, qt_meta_stringdata_hiro__QtVerticalScrollBar,
|
||||
qt_meta_data_hiro__QtVerticalScrollBar, &staticMetaObjectExtraData }
|
||||
};
|
||||
|
||||
#ifdef Q_NO_DATA_RELOCATION
|
||||
const QMetaObject &hiro::QtVerticalScroller::getStaticMetaObject() { return staticMetaObject; }
|
||||
const QMetaObject &hiro::QtVerticalScrollBar::getStaticMetaObject() { return staticMetaObject; }
|
||||
#endif //Q_NO_DATA_RELOCATION
|
||||
|
||||
const QMetaObject *hiro::QtVerticalScroller::metaObject() const
|
||||
const QMetaObject *hiro::QtVerticalScrollBar::metaObject() const
|
||||
{
|
||||
return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject;
|
||||
}
|
||||
|
||||
void *hiro::QtVerticalScroller::qt_metacast(const char *_clname)
|
||||
void *hiro::QtVerticalScrollBar::qt_metacast(const char *_clname)
|
||||
{
|
||||
if (!_clname) return 0;
|
||||
if (!strcmp(_clname, qt_meta_stringdata_hiro__QtVerticalScroller))
|
||||
return static_cast<void*>(const_cast< QtVerticalScroller*>(this));
|
||||
if (!strcmp(_clname, qt_meta_stringdata_hiro__QtVerticalScrollBar))
|
||||
return static_cast<void*>(const_cast< QtVerticalScrollBar*>(this));
|
||||
return QScrollBar::qt_metacast(_clname);
|
||||
}
|
||||
|
||||
int hiro::QtVerticalScroller::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
|
||||
int hiro::QtVerticalScrollBar::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
|
||||
{
|
||||
_id = QScrollBar::qt_metacall(_c, _id, _a);
|
||||
if (_id < 0)
|
||||
|
|
|
@ -4,8 +4,10 @@ namespace hiro {
|
|||
|
||||
auto pComboButtonItem::construct() -> void {
|
||||
if(auto parent = _parent()) {
|
||||
parent->lock();
|
||||
parent->qtComboButton->addItem("");
|
||||
_setState();
|
||||
parent->unlock();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ namespace hiro {
|
|||
|
||||
auto pComboButton::construct() -> void {
|
||||
qtWidget = qtComboButton = new QtComboButton(*this);
|
||||
qtComboButton->connect(qtComboButton, SIGNAL(currentIndexChanged(int)), SLOT(onChange()));
|
||||
qtComboButton->connect(qtComboButton, SIGNAL(currentIndexChanged(int)), SLOT(onChange(int)));
|
||||
|
||||
pWidget::construct();
|
||||
}
|
||||
|
@ -35,7 +35,13 @@ auto pComboButton::reset() -> void {
|
|||
unlock();
|
||||
}
|
||||
|
||||
auto QtComboButton::onChange() -> void {
|
||||
auto QtComboButton::onChange(int offset) -> void {
|
||||
for(auto& item : p.state().items) {
|
||||
item->state.selected = false;
|
||||
}
|
||||
if(auto item = p.self().item(offset)) {
|
||||
item->state.selected = true;
|
||||
}
|
||||
if(!p.locked()) p.self().doChange();
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
#if defined(Hiro_HorizontalScrollBar)
|
||||
|
||||
namespace hiro {
|
||||
|
||||
auto pHorizontalScrollBar::construct() -> void {
|
||||
qtWidget = qtHorizontalScrollBar = new QtHorizontalScrollBar(*this);
|
||||
qtHorizontalScrollBar->setRange(0, 100);
|
||||
qtHorizontalScrollBar->setPageStep(101 >> 3);
|
||||
qtHorizontalScrollBar->connect(qtHorizontalScrollBar, SIGNAL(valueChanged(int)), SLOT(onChange()));
|
||||
|
||||
pWidget::construct();
|
||||
_setState();
|
||||
}
|
||||
|
||||
auto pHorizontalScrollBar::destruct() -> void {
|
||||
delete qtHorizontalScrollBar;
|
||||
qtWidget = qtHorizontalScrollBar = nullptr;
|
||||
}
|
||||
|
||||
auto pHorizontalScrollBar::minimumSize() const -> Size {
|
||||
return {0, 15};
|
||||
}
|
||||
|
||||
auto pHorizontalScrollBar::setLength(unsigned length) -> void {
|
||||
_setState();
|
||||
}
|
||||
|
||||
auto pHorizontalScrollBar::setPosition(unsigned position) -> void {
|
||||
_setState();
|
||||
}
|
||||
|
||||
auto pHorizontalScrollBar::_setState() -> void {
|
||||
signed length = state().length + (state().length == 0);
|
||||
qtHorizontalScrollBar->setRange(0, length - 1);
|
||||
qtHorizontalScrollBar->setPageStep(length >> 3);
|
||||
qtHorizontalScrollBar->setValue(state().position);
|
||||
}
|
||||
|
||||
auto QtHorizontalScrollBar::onChange() -> void {
|
||||
p.state().position = value();
|
||||
p.self().doChange();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,9 +1,9 @@
|
|||
#if defined(Hiro_HorizontalScroller)
|
||||
#if defined(Hiro_HorizontalScrollBar)
|
||||
|
||||
namespace hiro {
|
||||
|
||||
struct pHorizontalScroller : pWidget {
|
||||
Declare(HorizontalScroller, Widget)
|
||||
struct pHorizontalScrollBar : pWidget {
|
||||
Declare(HorizontalScrollBar, Widget)
|
||||
|
||||
auto minimumSize() const -> Size override;
|
||||
auto setLength(unsigned length) -> void;
|
||||
|
@ -11,7 +11,7 @@ struct pHorizontalScroller : pWidget {
|
|||
|
||||
auto _setState() -> void;
|
||||
|
||||
QtHorizontalScroller* qtHorizontalScroller = nullptr;
|
||||
QtHorizontalScrollBar* qtHorizontalScrollBar = nullptr;
|
||||
};
|
||||
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
#if defined(Hiro_HorizontalScroller)
|
||||
|
||||
namespace hiro {
|
||||
|
||||
auto pHorizontalScroller::construct() -> void {
|
||||
qtWidget = qtHorizontalScroller = new QtHorizontalScroller(*this);
|
||||
qtHorizontalScroller->setRange(0, 100);
|
||||
qtHorizontalScroller->setPageStep(101 >> 3);
|
||||
qtHorizontalScroller->connect(qtHorizontalScroller, SIGNAL(valueChanged(int)), SLOT(onChange()));
|
||||
|
||||
pWidget::construct();
|
||||
_setState();
|
||||
}
|
||||
|
||||
auto pHorizontalScroller::destruct() -> void {
|
||||
delete qtHorizontalScroller;
|
||||
qtWidget = qtHorizontalScroller = nullptr;
|
||||
}
|
||||
|
||||
auto pHorizontalScroller::minimumSize() const -> Size {
|
||||
return {0, 15};
|
||||
}
|
||||
|
||||
auto pHorizontalScroller::setLength(unsigned length) -> void {
|
||||
_setState();
|
||||
}
|
||||
|
||||
auto pHorizontalScroller::setPosition(unsigned position) -> void {
|
||||
_setState();
|
||||
}
|
||||
|
||||
auto pHorizontalScroller::_setState() -> void {
|
||||
signed length = state().length + (state().length == 0);
|
||||
qtHorizontalScroller->setRange(0, length - 1);
|
||||
qtHorizontalScroller->setPageStep(length >> 3);
|
||||
qtHorizontalScroller->setValue(state().position);
|
||||
}
|
||||
|
||||
auto QtHorizontalScroller::onChange() -> void {
|
||||
p.state().position = value();
|
||||
p.self().doChange();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -49,18 +49,22 @@ auto pListViewCell::_parent() -> maybe<pListViewItem&> {
|
|||
|
||||
auto pListViewCell::_setState() -> void {
|
||||
if(auto parent = _parent()) {
|
||||
parent->qtItem->setBackground(self().offset(), CreateBrush(self().backgroundColor(true)));
|
||||
if(state().checkable) {
|
||||
parent->qtItem->setCheckState(self().offset(), state().checked ? Qt::Checked : Qt::Unchecked);
|
||||
} else {
|
||||
//extremely unintuitive; but this is the only way to remove an existing checkbox from a cell
|
||||
parent->qtItem->setData(self().offset(), Qt::CheckStateRole, QVariant());
|
||||
if(auto grandparent = parent->_parent()) {
|
||||
grandparent->lock();
|
||||
parent->qtItem->setBackground(self().offset(), CreateBrush(self().backgroundColor(true)));
|
||||
if(state().checkable) {
|
||||
parent->qtItem->setCheckState(self().offset(), state().checked ? Qt::Checked : Qt::Unchecked);
|
||||
} else {
|
||||
//extremely unintuitive; but this is the only way to remove an existing checkbox from a cell
|
||||
parent->qtItem->setData(self().offset(), Qt::CheckStateRole, QVariant());
|
||||
}
|
||||
parent->qtItem->setFont(self().offset(), pFont::create(self().font(true)));
|
||||
parent->qtItem->setForeground(self().offset(), CreateBrush(self().foregroundColor(true)));
|
||||
parent->qtItem->setIcon(self().offset(), CreateIcon(state().icon));
|
||||
parent->qtItem->setText(self().offset(), QString::fromUtf8(state().text));
|
||||
parent->qtItem->setTextAlignment(self().offset(), CalculateAlignment(self().alignment(true)));
|
||||
grandparent->unlock();
|
||||
}
|
||||
parent->qtItem->setFont(self().offset(), pFont::create(self().font(true)));
|
||||
parent->qtItem->setForeground(self().offset(), CreateBrush(self().foregroundColor(true)));
|
||||
parent->qtItem->setIcon(self().offset(), CreateIcon(state().icon));
|
||||
parent->qtItem->setText(self().offset(), QString::fromUtf8(state().text));
|
||||
parent->qtItem->setTextAlignment(self().offset(), CalculateAlignment(self().alignment(true)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,10 +6,12 @@ auto pListViewItem::construct() -> void {
|
|||
}
|
||||
|
||||
auto pListViewItem::destruct() -> void {
|
||||
if(auto parent = _parent()) parent->lock();
|
||||
if(qtItem) {
|
||||
delete qtItem;
|
||||
qtItem = nullptr;
|
||||
}
|
||||
if(auto parent = _parent()) parent->unlock();
|
||||
}
|
||||
|
||||
auto pListViewItem::append(sListViewCell cell) -> void {
|
||||
|
|
|
@ -17,7 +17,7 @@ auto pListView::construct() -> void {
|
|||
qtListView->connect(qtListView, SIGNAL(itemSelectionChanged()), SLOT(onChange()));
|
||||
qtListView->connect(qtListView, SIGNAL(customContextMenuRequested(const QPoint&)), SLOT(onContext()));
|
||||
qtListView->connect(qtListView->header(), SIGNAL(sectionClicked(int)), SLOT(onSort(int)));
|
||||
qtListView->connect(qtListView, SIGNAL(itemChanged(QTreeWidgetItem*, int)), SLOT(onToggle(QTreeWidgetItem*)));
|
||||
qtListView->connect(qtListView, SIGNAL(itemChanged(QTreeWidgetItem*, int)), SLOT(onToggle(QTreeWidgetItem*, int)));
|
||||
|
||||
setBackgroundColor(state().backgroundColor);
|
||||
setBatchable(state().batchable);
|
||||
|
@ -57,12 +57,6 @@ auto pListView::remove(sListViewHeader header) -> void {
|
|||
auto pListView::remove(sListViewItem item) -> void {
|
||||
}
|
||||
|
||||
auto pListView::reset() -> void {
|
||||
lock();
|
||||
qtListView->clear();
|
||||
unlock();
|
||||
}
|
||||
|
||||
auto pListView::resizeColumns() -> void {
|
||||
lock();
|
||||
|
||||
|
@ -194,15 +188,13 @@ auto QtListView::onActivate() -> void {
|
|||
}
|
||||
|
||||
auto QtListView::onChange() -> void {
|
||||
/*
|
||||
for(auto& item : listView.state.items) item.selected = false;
|
||||
for(unsigned position = 0; position < qtListView->topLevelItemCount(); position++) {
|
||||
if(auto item = qtListView->topLevelItem(position)) {
|
||||
if(item->isSelected()) listView.state.items[position].selected = true;
|
||||
for(auto& item : p.state().items) {
|
||||
item->state.selected = false;
|
||||
if(auto self = item->self()) {
|
||||
if(self->qtItem->isSelected()) item->state.selected = true;
|
||||
}
|
||||
}
|
||||
if(!locked() && listView.onChange) listView.onChange();
|
||||
*/
|
||||
if(!p.locked()) p.self().doChange();
|
||||
}
|
||||
|
||||
auto QtListView::onContext() -> void {
|
||||
|
@ -217,22 +209,17 @@ auto QtListView::onSort(int columnNumber) -> void {
|
|||
}
|
||||
}
|
||||
|
||||
auto QtListView::onToggle(QTreeWidgetItem* item) -> void {
|
||||
/*
|
||||
maybe<unsigned> row;
|
||||
for(unsigned position = 0; position < qtListView->topLevelItemCount(); position++) {
|
||||
if(auto topLevelItem = qtListView->topLevelItem(position)) {
|
||||
if(topLevelItem == item) {
|
||||
row = position;
|
||||
break;
|
||||
auto QtListView::onToggle(QTreeWidgetItem* qtItem, int column) -> void {
|
||||
for(auto& item : p.state().items) {
|
||||
if(auto self = item->self()) {
|
||||
if(qtItem == self->qtItem) {
|
||||
if(auto cell = item->cell(column)) {
|
||||
cell->state.checked = (qtItem->checkState(column) == Qt::Checked);
|
||||
if(!p.locked()) p.self().doToggle(cell);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(row) {
|
||||
listView.state.items[*row].checked = (item->checkState(0) == Qt::Checked);
|
||||
if(!locked() && listView.onToggle) listView.onToggle(*row);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
auto QtListView::mousePressEvent(QMouseEvent* event) -> void {
|
||||
|
|
|
@ -9,7 +9,6 @@ struct pListView : pWidget {
|
|||
auto append(sListViewItem item) -> void;
|
||||
auto remove(sListViewHeader header) -> void;
|
||||
auto remove(sListViewItem item) -> void;
|
||||
auto reset() -> void;
|
||||
auto resizeColumns() -> void;
|
||||
auto setAlignment(Alignment alignment) -> void;
|
||||
auto setBackgroundColor(Color color) -> void;
|
||||
|
|
|
@ -35,12 +35,14 @@ auto pTabFrameItem::setGeometry(Geometry geometry) -> void {
|
|||
}
|
||||
|
||||
auto pTabFrameItem::setIcon(const image& icon) -> void {
|
||||
_setState();
|
||||
}
|
||||
|
||||
auto pTabFrameItem::setMovable(bool movable) -> void {
|
||||
}
|
||||
|
||||
auto pTabFrameItem::setSelected() -> void {
|
||||
_setState();
|
||||
}
|
||||
|
||||
auto pTabFrameItem::setText(const string& text) -> void {
|
||||
|
@ -60,6 +62,8 @@ auto pTabFrameItem::_parent() -> maybe<pTabFrame&> {
|
|||
|
||||
auto pTabFrameItem::_setState() -> void {
|
||||
if(auto parent = _parent()) {
|
||||
parent->qtTabFrame->setTabIcon(self().offset(), CreateIcon(state().icon));
|
||||
if(state().selected) parent->qtTabFrame->setCurrentIndex(self().offset());
|
||||
parent->qtTabFrame->setTabText(self().offset(), QString::fromUtf8(state().text));
|
||||
if(auto layout = state().layout) {
|
||||
auto geometry = parent->self().geometry();
|
||||
|
|
|
@ -16,6 +16,7 @@ auto pTabFrame::destruct() -> void {
|
|||
}
|
||||
|
||||
auto pTabFrame::append(sTabFrameItem item) -> void {
|
||||
setGeometry(self().geometry());
|
||||
}
|
||||
|
||||
auto pTabFrame::remove(sTabFrameItem item) -> void {
|
||||
|
@ -24,91 +25,17 @@ auto pTabFrame::remove(sTabFrameItem item) -> void {
|
|||
auto pTabFrame::setEdge(Edge edge) -> void {
|
||||
}
|
||||
|
||||
/*
|
||||
auto pTabFrame::container(Widget& widget) -> QWidget* {
|
||||
Layout* widgetLayout = GetParentWidgetLayout(&widget);
|
||||
unsigned selection = 0;
|
||||
for(auto& layout : tabFrame.state.layout) {
|
||||
if(layout == widgetLayout) return qtTabFrame->widget(selection);
|
||||
selection++;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto pTabFrame::displacement() -> Position {
|
||||
return {5, 33};
|
||||
}
|
||||
|
||||
auto pTabFrame::remove(unsigned selection) -> void {
|
||||
qtTabFrame->removeTab(selection);
|
||||
}
|
||||
|
||||
auto pTabFrame::setEnabled(bool enabled) -> void {
|
||||
for(auto& layout : tabFrame.state.layout) {
|
||||
if(layout) layout->setEnabled(layout->enabled());
|
||||
}
|
||||
pWidget::setEnabled(enabled);
|
||||
}
|
||||
|
||||
auto pTabFrame::setGeometry(Geometry geometry) -> void {
|
||||
pWidget::setGeometry(geometry);
|
||||
geometry.x += 0, geometry.width -= 5;
|
||||
geometry.y += 29, geometry.height -= 33;
|
||||
for(auto& layout : tabFrame.state.layout) {
|
||||
if(layout) layout->setGeometry(geometry);
|
||||
}
|
||||
synchronizeLayout();
|
||||
}
|
||||
*/
|
||||
|
||||
auto pTabFrame::setGeometry(Geometry geometry) -> void {
|
||||
pWidget::setGeometry(geometry);
|
||||
|
||||
// geometry.setPosition({0, 0});
|
||||
// geometry.setWidth(geometry.width() - 4);
|
||||
// geometry.setHeight(geometry.height() - 25);
|
||||
|
||||
for(auto& item : state().items) {
|
||||
if(auto self = item->self()) self->setGeometry(geometry);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
auto pTabFrame::setIcon(unsigned selection, const image& icon) -> void {
|
||||
qtTabFrame->setTabIcon(selection, CreateIcon(image));
|
||||
}
|
||||
|
||||
auto pTabFrame::setSelected(unsigned selection) -> void {
|
||||
lock();
|
||||
qtTabFrame->setCurrentIndex(selection);
|
||||
synchronizeLayout();
|
||||
unlock();
|
||||
}
|
||||
|
||||
auto pTabFrame::setVisible(bool visible) -> void {
|
||||
for(auto& layout : tabFrame.state.layout) {
|
||||
if(layout) layout->setVisible(layout->visible());
|
||||
}
|
||||
pWidget::setVisible(visible);
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
auto pTabFrame::synchronizeLayout() -> void {
|
||||
unsigned selection = 0;
|
||||
for(auto& layout : tabFrame.state.layout) {
|
||||
if(layout) layout->setVisible(selection == tabFrame.state.selection);
|
||||
selection++;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
auto pTabFrame::_setState() -> void {
|
||||
for(auto& item : state().items) {
|
||||
if(auto self = item->self()) self->_setState();
|
||||
// if(auto layout = item->state.layout) {
|
||||
// item->setVisible(item->visible(true));
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -118,9 +45,12 @@ auto QtTabFrame::showEvent(QShowEvent* event) -> void {
|
|||
}
|
||||
|
||||
auto QtTabFrame::onChange(int selection) -> void {
|
||||
// state().selection = selection;
|
||||
// synchronizeLayout();
|
||||
// if(!p.locked()) p.self().doChange();
|
||||
//geometry of tab frames is only valid once said tab frame is visible
|
||||
//as such, as need to call _setState() to update the TabFrameItem's geometry here
|
||||
if(auto item = p.self().item(selection)) {
|
||||
if(auto self = item->self()) self->_setState();
|
||||
}
|
||||
if(!p.locked()) p.self().doChange();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
#if defined(Hiro_VerticalScrollBar)
|
||||
|
||||
namespace hiro {
|
||||
|
||||
auto pVerticalScrollBar::construct() -> void {
|
||||
qtWidget = qtVerticalScrollBar = new QtVerticalScrollBar(*this);
|
||||
qtVerticalScrollBar->setRange(0, 100);
|
||||
qtVerticalScrollBar->setPageStep(101 >> 3);
|
||||
qtVerticalScrollBar->connect(qtVerticalScrollBar, SIGNAL(valueChanged(int)), SLOT(onChange()));
|
||||
|
||||
pWidget::construct();
|
||||
_setState();
|
||||
}
|
||||
|
||||
auto pVerticalScrollBar::destruct() -> void {
|
||||
delete qtVerticalScrollBar;
|
||||
qtWidget = qtVerticalScrollBar = nullptr;
|
||||
}
|
||||
|
||||
auto pVerticalScrollBar::minimumSize() const -> Size {
|
||||
return {15, 0};
|
||||
}
|
||||
|
||||
auto pVerticalScrollBar::setLength(unsigned length) -> void {
|
||||
_setState();
|
||||
}
|
||||
|
||||
auto pVerticalScrollBar::setPosition(unsigned position) -> void {
|
||||
_setState();
|
||||
}
|
||||
|
||||
auto pVerticalScrollBar::_setState() -> void {
|
||||
signed length = state().length + (state().length == 0);
|
||||
qtVerticalScrollBar->setRange(0, length - 1);
|
||||
qtVerticalScrollBar->setPageStep(length >> 3);
|
||||
qtVerticalScrollBar->setValue(state().position);
|
||||
}
|
||||
|
||||
auto QtVerticalScrollBar::onChange() -> void {
|
||||
p.state().position = value();
|
||||
p.self().doChange();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,9 +1,9 @@
|
|||
#if defined(Hiro_VerticalScroller)
|
||||
#if defined(Hiro_VerticalScrollBar)
|
||||
|
||||
namespace hiro {
|
||||
|
||||
struct pVerticalScroller : pWidget {
|
||||
Declare(VerticalScroller, Widget)
|
||||
struct pVerticalScrollBar : pWidget {
|
||||
Declare(VerticalScrollBar, Widget)
|
||||
|
||||
auto minimumSize() const -> Size override;
|
||||
auto setLength(unsigned length) -> void;
|
||||
|
@ -11,7 +11,7 @@ struct pVerticalScroller : pWidget {
|
|||
|
||||
auto _setState() -> void;
|
||||
|
||||
QtVerticalScroller* qtVerticalScroller = nullptr;
|
||||
QtVerticalScrollBar* qtVerticalScrollBar = nullptr;
|
||||
};
|
||||
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
#if defined(Hiro_VerticalScroller)
|
||||
|
||||
namespace hiro {
|
||||
|
||||
auto pVerticalScroller::construct() -> void {
|
||||
qtWidget = qtVerticalScroller = new QtVerticalScroller(*this);
|
||||
qtVerticalScroller->setRange(0, 100);
|
||||
qtVerticalScroller->setPageStep(101 >> 3);
|
||||
qtVerticalScroller->connect(qtVerticalScroller, SIGNAL(valueChanged(int)), SLOT(onChange()));
|
||||
|
||||
pWidget::construct();
|
||||
_setState();
|
||||
}
|
||||
|
||||
auto pVerticalScroller::destruct() -> void {
|
||||
delete qtVerticalScroller;
|
||||
qtWidget = qtVerticalScroller = nullptr;
|
||||
}
|
||||
|
||||
auto pVerticalScroller::minimumSize() const -> Size {
|
||||
return {15, 0};
|
||||
}
|
||||
|
||||
auto pVerticalScroller::setLength(unsigned length) -> void {
|
||||
_setState();
|
||||
}
|
||||
|
||||
auto pVerticalScroller::setPosition(unsigned position) -> void {
|
||||
_setState();
|
||||
}
|
||||
|
||||
auto pVerticalScroller::_setState() -> void {
|
||||
signed length = state().length + (state().length == 0);
|
||||
qtVerticalScroller->setRange(0, length - 1);
|
||||
qtVerticalScroller->setPageStep(length >> 3);
|
||||
qtVerticalScroller->setValue(state().position);
|
||||
}
|
||||
|
||||
auto QtVerticalScroller::onChange() -> void {
|
||||
p.state().position = value();
|
||||
p.self().doChange();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -38,7 +38,7 @@
|
|||
#include "widget/combo-button-item.cpp"
|
||||
#include "widget/frame.cpp"
|
||||
#include "widget/hex-edit.cpp"
|
||||
#include "widget/horizontal-scroller.cpp"
|
||||
#include "widget/horizontal-scroll-bar.cpp"
|
||||
#include "widget/horizontal-slider.cpp"
|
||||
#include "widget/label.cpp"
|
||||
#include "widget/line-edit.cpp"
|
||||
|
@ -53,7 +53,7 @@
|
|||
#include "widget/tab-frame.cpp"
|
||||
#include "widget/tab-frame-item.cpp"
|
||||
#include "widget/text-edit.cpp"
|
||||
#include "widget/vertical-scroller.cpp"
|
||||
#include "widget/vertical-scroll-bar.cpp"
|
||||
#include "widget/vertical-slider.cpp"
|
||||
#include "widget/viewport.cpp"
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ static vector<wObject> windows;
|
|||
#include "widget/combo-button-item.hpp"
|
||||
#include "widget/frame.hpp"
|
||||
#include "widget/hex-edit.hpp"
|
||||
#include "widget/horizontal-scroller.hpp"
|
||||
#include "widget/horizontal-scroll-bar.hpp"
|
||||
#include "widget/horizontal-slider.hpp"
|
||||
#include "widget/label.hpp"
|
||||
#include "widget/line-edit.hpp"
|
||||
|
@ -82,7 +82,7 @@ static vector<wObject> windows;
|
|||
#include "widget/tab-frame.hpp"
|
||||
#include "widget/tab-frame-item.hpp"
|
||||
#include "widget/text-edit.hpp"
|
||||
#include "widget/vertical-scroller.hpp"
|
||||
#include "widget/vertical-scroll-bar.hpp"
|
||||
#include "widget/vertical-slider.hpp"
|
||||
#include "widget/viewport.hpp"
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ static auto ScrollEvent(HWND hwnd, WPARAM wparam) -> unsigned {
|
|||
info.fMask = SIF_POS;
|
||||
SetScrollInfo(hwnd, SB_CTL, &info, TRUE);
|
||||
|
||||
//Windows may clamp position to scroller range
|
||||
//Windows may clamp position to scrollbar range
|
||||
GetScrollInfo(hwnd, SB_CTL, &info);
|
||||
return info.nPos;
|
||||
}
|
||||
|
@ -351,9 +351,9 @@ static auto CALLBACK Shared_windowProc(WindowProc windowProc, HWND hwnd, UINT ms
|
|||
auto object = (mObject*)GetWindowLongPtr((HWND)lparam, GWLP_USERDATA);
|
||||
if(!object) break;
|
||||
|
||||
#if defined(Hiro_HorizontalScroller)
|
||||
if(auto horizontalScroller = dynamic_cast<mHorizontalScroller*>(object)) {
|
||||
return horizontalScroller->self()->onChange(wparam), true;
|
||||
#if defined(Hiro_HorizontalScrollBar)
|
||||
if(auto horizontalScrollBar = dynamic_cast<mHorizontalScrollBar*>(object)) {
|
||||
return horizontalScrollBar->self()->onChange(wparam), true;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -363,9 +363,9 @@ static auto CALLBACK Shared_windowProc(WindowProc windowProc, HWND hwnd, UINT ms
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined(Hiro_VerticalScroller)
|
||||
if(auto verticalScroller = dynamic_cast<mVerticalScroller*>(object)) {
|
||||
return verticalScroller->self()->onChange(wparam), true;
|
||||
#if defined(Hiro_VerticalScrollBar)
|
||||
if(auto verticalScrollBar = dynamic_cast<mVerticalScrollBar*>(object)) {
|
||||
return verticalScrollBar->self()->onChange(wparam), true;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ auto pCheckButton::destruct() -> void {
|
|||
DestroyWindow(hwnd);
|
||||
}
|
||||
|
||||
auto pCheckButton::minimumSize() -> Size {
|
||||
auto pCheckButton::minimumSize() const -> Size {
|
||||
auto size = pFont::size(hfont, state().text);
|
||||
|
||||
if(state().orientation == Orientation::Horizontal) {
|
||||
|
|
|
@ -5,7 +5,7 @@ namespace hiro {
|
|||
struct pCheckButton : pWidget {
|
||||
Declare(CheckButton, Widget)
|
||||
|
||||
auto minimumSize() -> Size;
|
||||
auto minimumSize() const -> Size override;
|
||||
auto setBordered(bool bordered) -> void;
|
||||
auto setChecked(bool checked) -> void;
|
||||
auto setIcon(const image& icon) -> void;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#if defined(Hiro_HorizontalScroller)
|
||||
#if defined(Hiro_HorizontalScrollBar)
|
||||
|
||||
namespace hiro {
|
||||
|
||||
auto pHorizontalScroller::construct() -> void {
|
||||
auto pHorizontalScrollBar::construct() -> void {
|
||||
hwnd = CreateWindow(
|
||||
L"SCROLLBAR", L"", WS_CHILD | WS_TABSTOP | SBS_HORZ,
|
||||
0, 0, 0, 0, _parentHandle(), nullptr, GetModuleHandle(0), 0
|
||||
|
@ -13,24 +13,24 @@ auto pHorizontalScroller::construct() -> void {
|
|||
setPosition(state().position);
|
||||
}
|
||||
|
||||
auto pHorizontalScroller::destruct() -> void {
|
||||
auto pHorizontalScrollBar::destruct() -> void {
|
||||
DestroyWindow(hwnd);
|
||||
}
|
||||
|
||||
auto pHorizontalScroller::minimumSize() const -> Size {
|
||||
auto pHorizontalScrollBar::minimumSize() const -> Size {
|
||||
return {0, 18};
|
||||
}
|
||||
|
||||
auto pHorizontalScroller::setLength(unsigned length) -> void {
|
||||
auto pHorizontalScrollBar::setLength(unsigned length) -> void {
|
||||
length += (length == 0);
|
||||
SetScrollRange(hwnd, SB_CTL, 0, length - 1, TRUE);
|
||||
}
|
||||
|
||||
auto pHorizontalScroller::setPosition(unsigned position) -> void {
|
||||
auto pHorizontalScrollBar::setPosition(unsigned position) -> void {
|
||||
SetScrollPos(hwnd, SB_CTL, position, TRUE);
|
||||
}
|
||||
|
||||
auto pHorizontalScroller::onChange(WPARAM wparam) -> void {
|
||||
auto pHorizontalScrollBar::onChange(WPARAM wparam) -> void {
|
||||
unsigned position = ScrollEvent(hwnd, wparam);
|
||||
if(position == state().position) return;
|
||||
state().position = position;
|
|
@ -1,9 +1,9 @@
|
|||
#if defined(Hiro_HorizontalScroller)
|
||||
#if defined(Hiro_HorizontalScrollBar)
|
||||
|
||||
namespace hiro {
|
||||
|
||||
struct pHorizontalScroller : pWidget {
|
||||
Declare(HorizontalScroller, Widget)
|
||||
struct pHorizontalScrollBar : pWidget {
|
||||
Declare(HorizontalScrollBar, Widget)
|
||||
|
||||
auto minimumSize() const -> Size override;
|
||||
auto setLength(unsigned length) -> void;
|
|
@ -57,15 +57,6 @@ auto pListView::remove(sListViewHeader header) -> void {
|
|||
auto pListView::remove(sListViewItem item) -> void {
|
||||
}
|
||||
|
||||
auto pListView::reset() -> void {
|
||||
lock();
|
||||
ListView_DeleteAllItems(hwnd);
|
||||
LVCOLUMN lvColumn{LVCF_WIDTH};
|
||||
while(ListView_GetColumn(hwnd, 0, &lvColumn)) ListView_DeleteColumn(hwnd, 0);
|
||||
_setIcons(); //free icon resources
|
||||
unlock();
|
||||
}
|
||||
|
||||
auto pListView::resizeColumns() -> void {
|
||||
lock();
|
||||
|
||||
|
@ -200,7 +191,12 @@ auto pListView::onCustomDraw(LPARAM lparam) -> LRESULT {
|
|||
bool selected = state().items(row)->state.selected;
|
||||
|
||||
if(auto cell = self().item(row)->cell(column)) {
|
||||
HBRUSH brush = CreateSolidBrush(selected ? GetSysColor(COLOR_HIGHLIGHT) : CreateRGB(cell->backgroundColor(true)));
|
||||
auto backgroundColor = cell->backgroundColor(true);
|
||||
HBRUSH brush = CreateSolidBrush(
|
||||
selected ? GetSysColor(COLOR_HIGHLIGHT)
|
||||
: backgroundColor ? CreateRGB(backgroundColor)
|
||||
: GetSysColor(COLOR_WINDOW)
|
||||
);
|
||||
FillRect(hdc, &rc, brush);
|
||||
DeleteObject(brush);
|
||||
|
||||
|
@ -235,7 +231,12 @@ auto pListView::onCustomDraw(LPARAM lparam) -> LRESULT {
|
|||
if(!alignment) alignment = {0.0, 0.5};
|
||||
utf16_t wText(text);
|
||||
SetBkMode(hdc, TRANSPARENT);
|
||||
SetTextColor(hdc, selected ? GetSysColor(COLOR_HIGHLIGHTTEXT) : CreateRGB(cell->foregroundColor(true)));
|
||||
auto foregroundColor = cell->foregroundColor(true);
|
||||
SetTextColor(hdc,
|
||||
selected ? GetSysColor(COLOR_HIGHLIGHTTEXT)
|
||||
: foregroundColor ? CreateRGB(foregroundColor)
|
||||
: GetSysColor(COLOR_WINDOWTEXT)
|
||||
);
|
||||
auto style = DT_SINGLELINE | DT_NOPREFIX | DT_END_ELLIPSIS;
|
||||
style |= alignment.horizontal() < 0.333 ? DT_LEFT : alignment.horizontal() > 0.666 ? DT_RIGHT : DT_CENTER;
|
||||
style |= alignment.vertical() < 0.333 ? DT_TOP : alignment.vertical() > 0.666 ? DT_BOTTOM : DT_VCENTER;
|
||||
|
@ -246,9 +247,12 @@ auto pListView::onCustomDraw(LPARAM lparam) -> LRESULT {
|
|||
DeleteObject(font);
|
||||
}
|
||||
} else {
|
||||
auto color = state().backgroundColor;
|
||||
if(!color) color = {255, 255, 255};
|
||||
HBRUSH brush = CreateSolidBrush(selected ? GetSysColor(COLOR_HIGHLIGHT) : CreateRGB(color));
|
||||
auto backgroundColor = state().backgroundColor;
|
||||
HBRUSH brush = CreateSolidBrush(
|
||||
selected ? GetSysColor(COLOR_HIGHLIGHT)
|
||||
: backgroundColor ? CreateRGB(backgroundColor)
|
||||
: GetSysColor(COLOR_WINDOW)
|
||||
);
|
||||
FillRect(hdc, &rc, brush);
|
||||
DeleteObject(brush);
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@ struct pListView : pWidget {
|
|||
auto append(sListViewItem item) -> void;
|
||||
auto remove(sListViewHeader header) -> void;
|
||||
auto remove(sListViewItem item) -> void;
|
||||
auto reset() -> void;
|
||||
auto resizeColumns() -> void;
|
||||
auto setAlignment(Alignment alignment) -> void;
|
||||
auto setBackgroundColor(Color color) -> void;
|
||||
|
|
|
@ -19,7 +19,7 @@ auto pRadioButton::destruct() -> void {
|
|||
DestroyWindow(hwnd);
|
||||
}
|
||||
|
||||
auto pRadioButton::minimumSize() -> Size {
|
||||
auto pRadioButton::minimumSize() const -> Size {
|
||||
auto size = pFont::size(hfont, state().text);
|
||||
|
||||
if(state().orientation == Orientation::Horizontal) {
|
||||
|
|
|
@ -5,7 +5,7 @@ namespace hiro {
|
|||
struct pRadioButton : pWidget {
|
||||
Declare(RadioButton, Widget)
|
||||
|
||||
auto minimumSize() -> Size;
|
||||
auto minimumSize() const -> Size override;
|
||||
auto setBordered(bool bordered) -> void;
|
||||
auto setChecked() -> void;
|
||||
auto setGroup(sGroup group) -> void override;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#if defined(Hiro_VerticalScroller)
|
||||
#if defined(Hiro_VerticalScrollBar)
|
||||
|
||||
namespace hiro {
|
||||
|
||||
auto pVerticalScroller::construct() -> void {
|
||||
auto pVerticalScrollBar::construct() -> void {
|
||||
hwnd = CreateWindow(
|
||||
L"SCROLLBAR", L"", WS_CHILD | SBS_VERT,
|
||||
0, 0, 0, 0, _parentHandle(), nullptr, GetModuleHandle(0), 0
|
||||
|
@ -13,24 +13,24 @@ auto pVerticalScroller::construct() -> void {
|
|||
setPosition(state().position);
|
||||
}
|
||||
|
||||
auto pVerticalScroller::destruct() -> void {
|
||||
auto pVerticalScrollBar::destruct() -> void {
|
||||
DestroyWindow(hwnd);
|
||||
}
|
||||
|
||||
auto pVerticalScroller::minimumSize() const -> Size {
|
||||
auto pVerticalScrollBar::minimumSize() const -> Size {
|
||||
return {18, 0};
|
||||
}
|
||||
|
||||
auto pVerticalScroller::setLength(unsigned length) -> void {
|
||||
auto pVerticalScrollBar::setLength(unsigned length) -> void {
|
||||
length += (length == 0);
|
||||
SetScrollRange(hwnd, SB_CTL, 0, length - 1, TRUE);
|
||||
}
|
||||
|
||||
auto pVerticalScroller::setPosition(unsigned position) -> void {
|
||||
auto pVerticalScrollBar::setPosition(unsigned position) -> void {
|
||||
SetScrollPos(hwnd, SB_CTL, position, TRUE);
|
||||
}
|
||||
|
||||
auto pVerticalScroller::onChange(WPARAM wparam) -> void {
|
||||
auto pVerticalScrollBar::onChange(WPARAM wparam) -> void {
|
||||
unsigned position = ScrollEvent(hwnd, wparam);
|
||||
if(position == state().position) return;
|
||||
state().position = position;
|
|
@ -1,9 +1,9 @@
|
|||
#if defined(Hiro_VerticalScroller)
|
||||
#if defined(Hiro_VerticalScrollBar)
|
||||
|
||||
namespace hiro {
|
||||
|
||||
struct pVerticalScroller : pWidget {
|
||||
Declare(VerticalScroller, Widget)
|
||||
struct pVerticalScrollBar : pWidget {
|
||||
Declare(VerticalScrollBar, Widget)
|
||||
|
||||
auto minimumSize() const -> Size override;
|
||||
auto setLength(unsigned length) -> void;
|
|
@ -18,7 +18,7 @@ auto pVerticalSlider::destruct() -> void {
|
|||
}
|
||||
|
||||
auto pVerticalSlider::minimumSize() const -> Size {
|
||||
return {0, 25};
|
||||
return {25, 0};
|
||||
}
|
||||
|
||||
auto pVerticalSlider::setLength(unsigned length) -> void {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
namespace nall {
|
||||
|
||||
auto image::scale(unsigned outputWidth, unsigned outputHeight, bool linear) -> void {
|
||||
if(!_data) return;
|
||||
if(_width == outputWidth && _height == outputHeight) return; //no scaling necessary
|
||||
if(linear == false) return scaleNearest(outputWidth, outputHeight);
|
||||
|
||||
|
|
|
@ -35,7 +35,8 @@ inline auto range(signed offset, signed size, signed step) {
|
|||
return range_t{offset, size, step};
|
||||
}
|
||||
|
||||
inline auto rangeReverse(signed size) {
|
||||
//reverse-range
|
||||
inline auto rrange(signed size) {
|
||||
return range_t{size - 1, -1, -1};
|
||||
}
|
||||
|
||||
|
@ -43,6 +44,10 @@ template<typename T> inline auto range(const vector<T>& container) {
|
|||
return range_t{0, (signed)container.size(), 1};
|
||||
}
|
||||
|
||||
template<typename T> inline auto rrange(const vector<T>& container) {
|
||||
return range_t{(signed)container.size() - 1, -1, -1};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include "utility.cpp"
|
||||
Program* program = nullptr;
|
||||
|
||||
Program::Program() {
|
||||
Program::Program(lstring args) {
|
||||
program = this;
|
||||
directory::create({configpath(), "tomoko/"});
|
||||
Application::onMain({&Program::main, this});
|
||||
|
@ -67,6 +67,10 @@ Program::Program() {
|
|||
presentation->drawSplashScreen();
|
||||
|
||||
updateVideoFilter();
|
||||
|
||||
if(args.size() == 2 && directory::exists(args[1])) {
|
||||
loadMedia(args[1]);
|
||||
}
|
||||
}
|
||||
|
||||
auto Program::main() -> void {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
struct Program : Emulator::Interface::Bind {
|
||||
//program.cpp
|
||||
Program();
|
||||
Program(lstring args);
|
||||
auto main() -> void;
|
||||
auto quit() -> void;
|
||||
|
||||
|
|
|
@ -15,6 +15,6 @@ auto locate(string pathname, string filename) -> string {
|
|||
#include <nall/main.hpp>
|
||||
auto nall::main(lstring args) -> void {
|
||||
Application::setName("tomoko");
|
||||
new Program;
|
||||
new Program(args);
|
||||
Application::run();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue