diff --git a/uppsrc/Core/Convert.h b/uppsrc/Core/Convert.h index d64996b03..9bb77d67e 100644 --- a/uppsrc/Core/Convert.h +++ b/uppsrc/Core/Convert.h @@ -177,6 +177,7 @@ public: Time GetMin() const { return minval; } Time GetMax() const { return maxval; } bool IsNotNull() const { return notnull; } + bool IsSeconds() const { return seconds; } ConvertTime(Time minval = ToTime(Date::Low()), Time maxval = ToTime(Date::High()), bool notnull = false); virtual ~ConvertTime(); @@ -202,6 +203,8 @@ public: ConvertString& TrimLeft(bool b = true) { trimleft = b; return *this; } ConvertString& TrimRight(bool b = true) { trimright = b; return *this; } ConvertString& TrimBoth(bool b = true) { return TrimLeft(b).TrimRight(b); } + bool IsTrimLeft() const { return trimleft; } + bool IsTrimRight() const { return trimright; } #ifdef flagSO ConvertString(int maxlen = INT_MAX, bool notnull = false); diff --git a/uppsrc/Core/Gtypes.h b/uppsrc/Core/Gtypes.h index 9b8f901df..00db5c7f7 100644 --- a/uppsrc/Core/Gtypes.h +++ b/uppsrc/Core/Gtypes.h @@ -9,7 +9,7 @@ struct Size_ : Moveable< Size_ > { void Clear() { cx = cy = 0; } bool IsEmpty() const { return cx == 0 || cy == 0; } - void SetNull() { cx = Null; } + void SetNull() { cx = cy = Null; } bool IsNullInstance() const { return UPP::IsNull(cx); } Size_& operator+=(Size_ p) { cx += p.cx; cy += p.cy; return *this; } @@ -213,6 +213,7 @@ struct Rect_ : Moveable< Rect_ > { void Clear() { left = top = right = bottom = 0; } bool IsEmpty() const { return right <= left || bottom <= top; } + void SetNull() { left = top = right = bottom = Null; } bool IsNullInstance() const; Pt TopLeft() const { return Pt(left, top); } @@ -369,7 +370,7 @@ struct Rect_ : Moveable< Rect_ > { template inline Rect_::Rect_(const Nuller&) { - left = top = right = bottom = Null; + SetNull(); } template <> diff --git a/uppsrc/CtrlCore/Win32Clip.cpp b/uppsrc/CtrlCore/Win32Clip.cpp index bc0c8e00e..8db418f97 100644 --- a/uppsrc/CtrlCore/Win32Clip.cpp +++ b/uppsrc/CtrlCore/Win32Clip.cpp @@ -80,7 +80,7 @@ bool ClipboardOpen() // Win32 has serious race condition problem with clipboard; system or other apps open it // right after we close it thus blocking us to send more formats // So the solution is to wait and retry... (mirek, 2011-01-09) - int delay = 1; + int delay = 5; for(int i = 0; i < 5; i++) { if(OpenClipboard(utilityHWND)) return true; diff --git a/uppsrc/CtrlLib/Button.cpp b/uppsrc/CtrlLib/Button.cpp index e071d3161..416a03d77 100644 --- a/uppsrc/CtrlLib/Button.cpp +++ b/uppsrc/CtrlLib/Button.cpp @@ -458,16 +458,25 @@ void SpinButtons::FrameLayout(Rect& r) dec.Show(); Size sz = r.Size(); int h = r.Height(); - int h2 = h / 2; int h7 = min(sz.cx / 2, style->width); - inc.SetFrameRect(r.right - h7, r.top, h7, h2); - dec.SetFrameRect(r.right - h7, r.top + h2, h7, r.Height() - h2); - r.right -= h7; + + if(onsides) { + dec.SetFrameRect(r.left, r.top, h7, h); + inc.SetFrameRect(r.right - h7, r.top, h7, h); + r.left += h7; + r.right -= h7; + } + else { + int h2 = h / 2; + inc.SetFrameRect(r.right - h7, r.top, h7, h2); + dec.SetFrameRect(r.right - h7, r.top + h2, h7, h - h2); + r.right -= h7; + } } void SpinButtons::FrameAddSize(Size& sz) { - sz.cx += min(sz.cx / 2, 12); + sz.cx += (1 + onsides) * min(sz.cx / 2, style->width); } void SpinButtons::FrameAdd(Ctrl& ctrl) @@ -500,6 +509,7 @@ SpinButtons& SpinButtons::SetStyle(const Style& s) SpinButtons::SpinButtons() { visible = true; + onsides = false; inc.NoWantFocus(); dec.NoWantFocus(); style = NULL; diff --git a/uppsrc/CtrlLib/ColumnList.h b/uppsrc/CtrlLib/ColumnList.h index e1105731c..0f183a7ed 100644 --- a/uppsrc/CtrlLib/ColumnList.h +++ b/uppsrc/CtrlLib/ColumnList.h @@ -145,8 +145,8 @@ public: void Set(int ii, const Value& val, bool canselect = true); void Set(int ii, const Value& val, const Display& display, bool canselect = true); - void Set(const Value& key, const Value& val, const Display& display, bool canselect); - void Set(const Value& key, const Value& val, bool canselect); + void Set(const Value& key, const Value& val, const Display& display, bool canselect = true); + void Set(const Value& key, const Value& val, bool canselect = true); void Insert(int ii, const Value& val, bool canselect = true); void Insert(int ii, const Value& val, const Display& display, bool canselect = true); diff --git a/uppsrc/CtrlLib/EditCtrl.h b/uppsrc/CtrlLib/EditCtrl.h index 5948833cf..07dacec65 100644 --- a/uppsrc/CtrlLib/EditCtrl.h +++ b/uppsrc/CtrlLib/EditCtrl.h @@ -203,20 +203,25 @@ public: void Error(bool error = true) { errorbg = error; } EditField& Password(bool pwd = true) { password = pwd; Finish(); return *this; } + bool IsPassword() const { return password; } EditField& SetFilter(int (*f)(int)) { filter = f; return *this; } EditField& SetConvert(const Convert& c) { convert = &c; Refresh(); return *this; } EditField& SetInactiveConvert(const Convert& c) { inactive_convert = &c; Refresh(); return *this; } EditField& AutoFormat(bool b = true) { autoformat = b; return *this; } EditField& NoAutoFormat() { return AutoFormat(false); } + bool IsAutoFormat() const { return autoformat; } EditField& SetCharset(byte cs) { charset = cs; return *this; } EditField& SetFont(Font _font); EditField& ClickSelect(bool b = true) { clickselect = b; return *this; } + bool IsClickSelect() const { return clickselect; } EditField& InitCaps(bool b = true) { initcaps = b; return *this; } + bool IsInitCaps() const { return initcaps; } EditField& NullText(const Image& icon, const char *text = t_("(default)"), Color ink = SColorDisabled); EditField& NullText(const Image& icon, const char *text, Font fnt, Color ink); EditField& NullText(const char *text = t_("(default)"), Color ink = SColorDisabled); EditField& NullText(const char *text, Font fnt, Color ink); EditField& MaxChars(int mc) { maxlen = mc; return *this; } + int GetMaxChars() const { return maxlen; } EditField& AutoSize(int maxcx = INT_MAX) { autosize = maxcx; Finish(); return *this; } EditField& NoBackground(bool b = true) { nobg = b; Transparent(); Refresh(); return *this; } EditField& AlignRight(bool b = true) { alignright = b; Refresh(); return *this; } @@ -250,20 +255,22 @@ public: EditMinMax& Min(DataType min) { Cv::Min(min); Ctrl::Refresh(); return *this; } EditMinMax& Max(DataType max) { Cv::Max(max); Ctrl::Refresh(); return *this; } + EditMinMax& MinMax(DataType min, DataType max) { Min(min); return Max(max); } EditMinMax& NotNull(bool nn = true) { Cv::NotNull(nn); Ctrl::Refresh(); return *this; } }; -template -class EditMinMaxNotNull : public EditValue { +template +class EditMinMaxNotNull : public Base { public: EditMinMaxNotNull& operator=(const DataType& t) { EditField::SetData(t); return *this; } - EditMinMaxNotNull() { Cv::NotNull(); } - EditMinMaxNotNull(DataType min, DataType max) { Cv::NotNull(); Cv::MinMax(min, max); } + EditMinMaxNotNull() { Base::NotNull(); } + EditMinMaxNotNull(DataType min, DataType max) { Base::NotNull(); Base::MinMax(min, max); } - EditMinMaxNotNull& Min(DataType min) { Cv::Min(min); Ctrl::Refresh(); return *this; } - EditMinMaxNotNull& Max(DataType max) { Cv::Max(max); Ctrl::Refresh(); return *this; } - EditMinMaxNotNull& NotNull(bool nn = true) { Cv::NotNull(nn); Ctrl::Refresh(); return *this; } + EditMinMaxNotNull& Min(DataType min) { Base::Min(min); return *this; } + EditMinMaxNotNull& Max(DataType max) { Base::Max(max); return *this; } + EditMinMaxNotNull& MinMax(DataType max) { Base::MinMax(min, max); return *this; } + EditMinMaxNotNull& NotNull(bool nn = true) { Base::NotNull(nn); return *this; } }; typedef EditMinMax EditInt; @@ -271,10 +278,10 @@ typedef EditMinMax EditInt64; typedef EditMinMax EditDouble; typedef EditMinMax EditDate; typedef EditMinMax EditTime; -typedef EditMinMaxNotNull EditIntNotNull; -typedef EditMinMaxNotNull EditDoubleNotNull; -typedef EditMinMaxNotNull EditDateNotNull; -typedef EditMinMaxNotNull EditTimeNotNull; +typedef EditMinMaxNotNull EditIntNotNull; +typedef EditMinMaxNotNull EditDoubleNotNull; +typedef EditMinMaxNotNull EditDateNotNull; +typedef EditMinMaxNotNull EditTimeNotNull; class EditString : public EditValue { public: @@ -317,9 +324,15 @@ protected: void Init(); public: - EditIntSpin& ShowSpin(bool s = true) { sb.Show(s); return *this; } - EditIntSpin& SetInc(int _inc) { inc = _inc; return *this; } - int GetInc() const { return inc; } + EditIntSpin& SetInc(int _inc) { inc = _inc; return *this; } + int GetInc() const { return inc; } + EditIntSpin& OnSides(bool b = true) { sb.OnSides(b); return *this; } + bool IsOnSides() const { return sb.IsOnSides(); } + + EditIntSpin& ShowSpin(bool s = true) { sb.Show(s); return *this; } + + SpinButtons& SpinButtonsObject() { return sb; } + const SpinButtons& SpinButtonsObject() const { return sb; } EditIntSpin(); EditIntSpin(int min, int max); @@ -338,19 +351,26 @@ protected: void Init(); private: - SpinButtons spin; + SpinButtons sb; double inc; -public: typedef EditDoubleSpin CLASSNAME; +public: + + EditDoubleSpin& SetInc(double _inc = 0.1) { inc = _inc; return *this; } + double GetInc() const { return inc; } + + EditDoubleSpin& OnSides(bool b = true) { sb.OnSides(b); return *this; } + bool IsOnSides() const { return sb.IsOnSides(); } + + EditDoubleSpin& ShowSpin(bool s = true) { sb.Show(s); return *this; } + + SpinButtons& SpinButtonsObject() { return sb; } + const SpinButtons& SpinButtonsObject() const { return sb; } + EditDoubleSpin(double inc = 0.1); EditDoubleSpin(double min, double max, double inc = 0.1); virtual ~EditDoubleSpin(); - - EditDoubleSpin& SetInc(double _inc = 0.1) { inc = _inc; return *this; } - double GetInc() const { return inc; } - - EditDoubleSpin& ShowSpin(bool s = true) { spin.Show(s); return *this; } }; class EditDoubleNotNullSpin : public EditDoubleSpin diff --git a/uppsrc/CtrlLib/EditField.cpp b/uppsrc/CtrlLib/EditField.cpp index a73818d2e..8d0307808 100644 --- a/uppsrc/CtrlLib/EditField.cpp +++ b/uppsrc/CtrlLib/EditField.cpp @@ -1103,9 +1103,9 @@ EditDoubleSpin::~EditDoubleSpin() {} void EditDoubleSpin::Init() { - AddFrame(spin); - spin.inc.WhenRepeat = spin.inc.WhenAction = THISBACK(Inc); - spin.dec.WhenRepeat = spin.dec.WhenAction = THISBACK(Dec); + AddFrame(sb); + sb.inc.WhenRepeat = sb.inc.WhenAction = THISBACK(Inc); + sb.dec.WhenRepeat = sb.dec.WhenAction = THISBACK(Dec); } void EditDoubleSpin::Inc() diff --git a/uppsrc/CtrlLib/PushCtrl.h b/uppsrc/CtrlLib/PushCtrl.h index 9943691e4..5aab7ffd6 100644 --- a/uppsrc/CtrlLib/PushCtrl.h +++ b/uppsrc/CtrlLib/PushCtrl.h @@ -138,7 +138,7 @@ public: }; private: - bool visible; + bool visible, onsides; const Style *style; public: @@ -150,6 +150,9 @@ public: static const Style& StyleDefault(); SpinButtons& SetStyle(const Style& s); + + SpinButtons& OnSides(bool b = true) { onsides = b; inc.RefreshParentLayout(); return *this; } + bool IsOnSides() const { return onsides; } SpinButtons(); virtual ~SpinButtons(); @@ -186,11 +189,16 @@ public: void operator=(int b) { Set(b); } Option& BlackEdge(bool b = true) { blackedge = b; Refresh(); return *this; } + bool IsBlackEdge() const { return blackedge; } Option& SwitchImage(bool b = true) { switchimage = b; Refresh(); return *this; } + bool IsSwitchImage() const { return switchimage; } Option& ThreeState(bool b = true) { threestate = b; notnull = false; return *this; } + bool IsThreeState() const { return threestate; } Option& ShowLabel(bool b = true) { showlabel = b; Refresh(); return *this; } + bool IsShowLabel() const { return showlabel; } Option& NotNull(bool nn = true) { notnull = nn; Refresh(); return *this; } Option& NoNotNull() { return NotNull(false); } + bool IsNotNull() const { return notnull; } Option(); virtual ~Option(); diff --git a/uppsrc/CtrlLib/StaticCtrl.h b/uppsrc/CtrlLib/StaticCtrl.h index 6005bdc84..a9db4bf64 100644 --- a/uppsrc/CtrlLib/StaticCtrl.h +++ b/uppsrc/CtrlLib/StaticCtrl.h @@ -77,6 +77,8 @@ public: StaticRect& Background(const Value& chvalue); StaticRect& Color(class Color c) { Background(c); return *this; } + Value GetBackground() const { return bg; } + StaticRect(); virtual ~StaticRect(); }; diff --git a/uppsrc/CtrlLib/TextEdit.h b/uppsrc/CtrlLib/TextEdit.h index 4df90fa01..034d507ab 100644 --- a/uppsrc/CtrlLib/TextEdit.h +++ b/uppsrc/CtrlLib/TextEdit.h @@ -176,12 +176,15 @@ public: Color GetColor(int i) const { return color[i]; } TextCtrl& UndoSteps(int n) { undosteps = n; Undodo(); return *this; } + int GetUndoSteps() const { return undosteps; } TextCtrl& ProcessTab(bool b = true) { processtab = b; return *this; } TextCtrl& NoProcessTab() { return ProcessTab(false); } TextCtrl& ProcessEnter(bool b = true) { processenter = b; return *this; } TextCtrl& NoProcessEnter() { return ProcessEnter(false); } TextCtrl& NoBackground(bool b = true) { nobg = b; Transparent(); Refresh(); return *this; } - bool IsProcessTab() { return processtab; } + bool IsNoBackground() const { return nobg; } + bool IsProcessTab() const { return processtab; } + bool IsProcessEnter() const { return processenter; } typedef TextCtrl CLASSNAME; @@ -331,10 +334,12 @@ public: LineEdit& SetFont(Font f); Font GetFont() const { return font; } LineEdit& NoHorzScrollbar(bool b = true) { nohbar = b; ScrollIntoCursor(); return *this; } + bool IsNoHorzScrollbar() const { return nohbar; } LineEdit& ShowTabs(bool st = true) { showtabs = st; Refresh(); return *this; } bool IsShowTabs() const { return showtabs; } LineEdit& WithCutLine(bool b) { cutline = b; return *this; } LineEdit& NoCutLine() { return WithCutLine(false); } + bool IsWithCutLine() const { return cutline; } LineEdit& SetFilter(int (*f)(int c)) { filter = f; return *this; } LineEdit& SetScrollBarStyle(const ScrollBar::Style& s) { sb.SetStyle(s); return *this; } @@ -420,12 +425,14 @@ public: DocEdit& SetFont(Font f) { font = f; RefreshStyle(); return *this; } DocEdit& SetFilter(int (*f)(int c)) { filter = f; return *this; } DocEdit& AutoHideSb(bool b = true) { sb.AutoHide(b); return *this; } + bool IsAutoHideSb() const { return sb.IsAutoHide(); } DocEdit& UpDownLeave(bool u = true) { updownleave = u; return *this; } DocEdit& NoUpDownLeave() { return UpDownLeave(false); } bool IsUpDownLeave() const { return updownleave; } DocEdit& SetScrollBarStyle(const ScrollBar::Style& s) { sb.SetStyle(s); return *this; } DocEdit& EofLine(bool b = true) { eofline = b; return *this; } DocEdit& NoEofLine() { return EofLine(false); } + bool IsEofLine() const { return eofline; } typedef DocEdit CLASSNAME;