mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-06-12 22:04:24 -06:00
Ide/LayDes: property pane is now scrollable with mouse wheel #1952
git-svn-id: svn://ultimatepp.org/upp/trunk@13056 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
afadbfc24d
commit
3f7b3e499d
2 changed files with 36 additions and 18 deletions
|
|
@ -151,10 +151,15 @@ struct RawProperty : public EditorProperty<EditString>
|
|||
}
|
||||
};
|
||||
|
||||
struct PropertyPane : public StaticRect {
|
||||
virtual void Layout();
|
||||
virtual void ChildGotFocus();
|
||||
class PropertyPane final : public StaticRect {
|
||||
public:
|
||||
virtual void Layout() override;
|
||||
virtual void ChildGotFocus() override;
|
||||
virtual void MouseWheel(Point, int zdelta, dword) override;
|
||||
|
||||
public:
|
||||
PropertyPane();
|
||||
|
||||
int y;
|
||||
StaticRect pane;
|
||||
ScrollBar sb;
|
||||
|
|
@ -164,10 +169,11 @@ struct PropertyPane : public StaticRect {
|
|||
void SetSb();
|
||||
void Scroll();
|
||||
void AfterCreate();
|
||||
|
||||
typedef PropertyPane CLASSNAME;
|
||||
|
||||
PropertyPane();
|
||||
|
||||
using CLASSNAME = PropertyPane;
|
||||
|
||||
private:
|
||||
int line_height;
|
||||
};
|
||||
|
||||
struct LayoutItem {
|
||||
|
|
@ -282,11 +288,11 @@ private:
|
|||
struct KeyMaster : public ParentCtrl {
|
||||
LayDes *d;
|
||||
|
||||
virtual bool HotKey(dword key) {
|
||||
virtual bool HotKey(dword key) override {
|
||||
return d->DoHotKey(key);
|
||||
}
|
||||
|
||||
virtual bool Key(dword key, int count) {
|
||||
virtual bool Key(dword key, int count) override {
|
||||
return d->DoKey(key, count);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,9 +1,23 @@
|
|||
#include "LayDes.h"
|
||||
|
||||
#include <limits>
|
||||
|
||||
PropertyPane::PropertyPane()
|
||||
: line_height(std::numeric_limits<int>::max())
|
||||
{
|
||||
Clear();
|
||||
SetFrame(sb);
|
||||
sb.AutoHide();
|
||||
sb.WhenScroll = THISBACK(Scroll);
|
||||
Color(SColorFace);
|
||||
}
|
||||
|
||||
void PropertyPane::Layout()
|
||||
{
|
||||
sb.SetTotal(y);
|
||||
sb.SetPage(GetSize().cy);
|
||||
if(line_height < std::numeric_limits<int>::max())
|
||||
sb.SetLine(line_height);
|
||||
}
|
||||
|
||||
void PropertyPane::Clear()
|
||||
|
|
@ -18,6 +32,8 @@ void PropertyPane::Add(ItemProperty& c)
|
|||
{
|
||||
pane.Add(c);
|
||||
int cy = c.GetHeight();
|
||||
if(cy < line_height)
|
||||
line_height = cy;
|
||||
c.HSizePos().TopPos(y, cy);
|
||||
y += cy;
|
||||
pane.TopPos(0, y);
|
||||
|
|
@ -40,16 +56,12 @@ void PropertyPane::ChildGotFocus()
|
|||
}
|
||||
}
|
||||
|
||||
void PropertyPane::MouseWheel(Point, int zdelta, dword)
|
||||
{
|
||||
sb.Wheel(zdelta);
|
||||
}
|
||||
|
||||
void PropertyPane::AfterCreate()
|
||||
{
|
||||
Ctrl::Add(pane.HSizePos());
|
||||
}
|
||||
|
||||
PropertyPane::PropertyPane()
|
||||
{
|
||||
Clear();
|
||||
SetFrame(sb);
|
||||
sb.AutoHide();
|
||||
sb.WhenScroll = THISBACK(Scroll);
|
||||
Color(SColorFace);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue