Skip to content

Commit

Permalink
normal commit
Browse files Browse the repository at this point in the history
dustpg committed Jun 3, 2020
1 parent 7ca269b commit 079eddd
Showing 7 changed files with 27 additions and 26 deletions.
7 changes: 4 additions & 3 deletions demo/demo5_fullcontrol/xul/textbox2.xul
Original file line number Diff line number Diff line change
@@ -7,8 +7,9 @@


<textbox cache="true" flex="1" style="font-size:30px" id="textbox1"
placeholder="Hello, world!"
increment="0.01" decimalplaces="7" multiline="true" type="number" />
placeholder="Hello, world!"
increment="0.01" decimalplaces="7" multiline="true" />
<button label="Check it out" id="button"/>
<!-- <textbox flex="1" cache="true" style="font-size:30px" id="textbox2" multiline="true" /> -->
<!-- <textbox flex="1" rows="2" cols="70" cache="true" type="number"
style="font-size:30px" id="textbox2" multiline="true" /> -->
</window>
2 changes: 1 addition & 1 deletion include/control/ui_control.h
Original file line number Diff line number Diff line change
@@ -210,7 +210,7 @@ namespace LongUI {
// clear appearance and all margin/padding/border
void ClearAppearance() noexcept;
// set xul-string as content
// remarks: SetXul accept null-terminated-string only
// remarks: SetXul accepts null-terminated-string only
// 注: SetXul目前只接受 NUL 结尾字符串
void SetXul(const char* xul) noexcept;
// set xul-file as content, return false if not-found
4 changes: 2 additions & 2 deletions include/control/ui_scrollarea.h
Original file line number Diff line number Diff line change
@@ -95,8 +95,8 @@ namespace LongUI {
protected:
// min scroll size
Size2F m_minScrollSize;
// min scroll size
Size2F m_maxValue;
// max scroll size
Size2F m_maxScrollSize;
// horizontal scroll bar
UIScrollBar* m_pSBHorizontal = nullptr;
// vertical scroll bar
24 changes: 12 additions & 12 deletions src/control/ui_scrollarea.cpp
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@ namespace LongUI {
LongUI::UIScrollArea::UIScrollArea(const MetaControl& meta) noexcept: Super(meta) {
this->line_size = { EMPTY_HEIGHT_PER_ROW, EMPTY_HEIGHT_PER_ROW };
m_minScrollSize = { };
m_maxValue = { };
m_maxScrollSize = { };
}


@@ -117,7 +117,7 @@ auto LongUI::UIScrollArea::DoEvent(
/// <param name="wheel">The wheel.</param>
/// <returns></returns>
auto LongUI::UIScrollArea::do_wheel(int index, float wheel) noexcept ->EventAccept {
const auto maxv = index[&m_maxValue.width];
const auto maxv = index[&m_maxScrollSize.width];
if (maxv > 0) {
// 位置变动检查
auto& offset = index[&m_ptChildOffset.x];
@@ -201,13 +201,13 @@ void LongUI::UIScrollArea::sync_scroll_bar() noexcept {
hok ? m_pSBHorizontal->GetMinSize().height : 0.f
};
const auto csize = m_oBox.GetContentSize();
m_maxValue = { 0, 0 };
m_maxScrollSize = { 0, 0 };
// 水平滚动条
if (hok) {
m_pSBHorizontal->SetIncrement(this->line_size.width);
m_pSBHorizontal->SetPageIncrement(csize.width - corner.width);
m_maxValue.width = m_minScrollSize.width - csize.width + corner.width;
m_pSBHorizontal->SetMax(m_maxValue.width);
m_maxScrollSize.width = m_minScrollSize.width - csize.width + corner.width;
m_pSBHorizontal->SetMax(m_maxScrollSize.width);
m_pSBHorizontal->SetValue(m_ptChildOffset.x);
//m_pSBHorizontal->SetSingleStep(m_szSingleStep.width);
}
@@ -216,8 +216,8 @@ void LongUI::UIScrollArea::sync_scroll_bar() noexcept {
if (vok) {
m_pSBVertical->SetIncrement(this->line_size.height);
m_pSBVertical->SetPageIncrement(csize.height - corner.height);
m_maxValue.height = m_minScrollSize.height - csize.height + corner.height;
m_pSBVertical->SetMax(m_maxValue.height);
m_maxScrollSize.height = m_minScrollSize.height - csize.height + corner.height;
m_pSBVertical->SetMax(m_maxScrollSize.height);
m_pSBVertical->SetValue(m_ptChildOffset.y);
//m_pSBVertical->SetSingleStep(m_szSingleStep.height);
}
@@ -303,6 +303,7 @@ auto LongUI::UIScrollArea::layout_vscrollbar(bool notenough) noexcept -> float {
return m_pSBVertical ? m_pSBVertical->GetMinSize().width : 0.0f;
}

PCN_NOINLINE
/// <summary>
/// Creates the scrollbar.
/// </summary>
@@ -319,7 +320,6 @@ auto LongUI::UIScrollArea::create_scrollbar(AttributeOrient o) noexcept -> UIScr
this->resize_child(*bar, {});
this->set_child_fixed_attachment(*bar);
UIControlPrivate::SetGuiEvent2Parent(*bar);
//bar->Init();
return bar;
}
return nullptr;
@@ -366,18 +366,18 @@ auto LongUI::UIScrollArea::layout_scroll_bar() noexcept -> Size2F {
// 设置VSB位置: 正向-右侧 反向-左侧
if (vsbar > 0.f) {
resize_child(*m_pSBVertical, { vsbar, content_size.height - hsbar });
Point2F pos = {};
Point2F pos = this->RefBox().GetContentPos();
const bool normaldir = m_state.direction == Dir_Normal;
if (normaldir) pos.x = content_size.width - vsbar;
if (normaldir) pos.x += content_size.width - vsbar;
m_pSBVertical->SetPos(pos);
m_pSBVertical->SetVisible(true);
}
// 设置HSB位置: 正向-下侧 反向-上侧
if (hsbar > 0.f) {
resize_child(*m_pSBHorizontal, { content_size.width - vsbar, hsbar });
Point2F pos = {};
Point2F pos = this->RefBox().GetContentPos();
const bool normaldir = m_state.direction == Dir_Normal;
if (normaldir) pos.y = content_size.height - hsbar;
if (normaldir) pos.y += content_size.height - hsbar;
m_pSBHorizontal->SetPos(pos);
m_pSBHorizontal->SetVisible(true);
}
2 changes: 1 addition & 1 deletion src/control/ui_stackdeck.cpp
Original file line number Diff line number Diff line change
@@ -124,7 +124,7 @@ void LongUI::UIStack::Update(UpdateReason reason) noexcept {
// 重新布局
this->relayout_stack();
}
// 其他的交给父类处理
// 其他的交给超类处理
Super::Update(reason);
}

8 changes: 4 additions & 4 deletions src/control/ui_tree.cpp
Original file line number Diff line number Diff line change
@@ -109,7 +109,7 @@ void LongUI::UITree::Update(UpdateReason reason) noexcept {
// 截断消息
return UIControl::Update(reason);
}
// 其他的交给父类处理
// 其他的交给超类处理
Super::Update(reason);
}

@@ -152,7 +152,7 @@ void LongUI::UITree::add_attribute(uint32_t key, U8View value) noexcept {
m_displayRow = value.ToInt32();
break;
default:
// 其他交给父类处理
// 其他交给超类处理
return Super::add_attribute(key, value);
}
}
@@ -566,7 +566,7 @@ void LongUI::UITreeRow::Update(UpdateReason reason) noexcept {
// 重新布局
this->relayout();
}
// 其他的交给父类处理
// 其他的交给超类处理
Super::Update(reason);
}

@@ -852,7 +852,7 @@ void LongUI::UITreeItem::Update(UpdateReason reason) noexcept {
m_pRow->SetLevelOffset(m_fLevelOffset);
}
}
// 其他的交给父类处理
// 其他的交给超类处理
Super::Update(reason);
}

6 changes: 3 additions & 3 deletions src/core/ui_manager.cpp
Original file line number Diff line number Diff line change
@@ -971,9 +971,9 @@ void LongUI::CUIManager::LoadDataFromUrl(
void ui_endian_runtime_assert() noexcept {
using namespace LongUI;
enum : uint32_t {
LITTLE_ENDIAN = 0x03020100ul,
BIG_ENDIAN = 0x00010203ul,
PDP_ENDIAN = 0x01000302ul,
LITTLE_ENDIAN = 0x03020100_ui32,
BIG_ENDIAN = 0x00010203_ui32,
PDP_ENDIAN = 0x01000302_ui32,
};
const union { unsigned char bytes[4]; uint32_t value; }
host_order{ { 0, 1, 2, 3 } };

0 comments on commit 079eddd

Please sign in to comment.