diff --git a/bazaar/BoostPyTest/BoostPyTest.h b/bazaar/BoostPyTest/BoostPyTest.h index 17e743a5d..d7a18d948 100644 --- a/bazaar/BoostPyTest/BoostPyTest.h +++ b/bazaar/BoostPyTest/BoostPyTest.h @@ -19,7 +19,8 @@ public: void ExitHandler(); - World w; + World w; + Progress pr; }; #endif diff --git a/bazaar/BoostPyTest/main.cpp b/bazaar/BoostPyTest/main.cpp index dd841935b..ece794c3b 100644 --- a/bazaar/BoostPyTest/main.cpp +++ b/bazaar/BoostPyTest/main.cpp @@ -52,6 +52,9 @@ BoostPyTest::BoostPyTest() es.SetData("Hello from Upp"); scope(upp_module).attr("es") = ptr(&es); + scope(upp_module).attr("pr") = ptr(&pr); + + //the additional import is needless String sc = @@ -70,8 +73,21 @@ BoostPyTest::BoostPyTest() "print upp.es.data\n" "c = upp.Color(123,124,125)\n" - "print c" + "print c\n" //"upp.vc.data = c\n" + + + "import time\n" + "upp.pr.create()\n" + "i = 0\n" + "while i < 10:\n" + " print i\n" + " upp.pr.text = str(i)\n" + " i = i+1\n" + " upp.pr.step(1)\n" + " time.sleep(1)\n" + "upp.pr.close()\n" + ; con.cmd.SetData(sc); diff --git a/bazaar/CoreBoostPy/Callback.cpp b/bazaar/CoreBoostPy/Callback.cpp new file mode 100644 index 000000000..90960e7ef --- /dev/null +++ b/bazaar/CoreBoostPy/Callback.cpp @@ -0,0 +1,14 @@ +#include "Callback.h" +using namespace boost::python; + +NAMESPACE_UPP + +void export_Callback() +{ +ONCELOCK +{ + +} +} + +END_UPP_NAMESPACE diff --git a/bazaar/CoreBoostPy/Callback.h b/bazaar/CoreBoostPy/Callback.h new file mode 100644 index 000000000..f34e707ea --- /dev/null +++ b/bazaar/CoreBoostPy/Callback.h @@ -0,0 +1,12 @@ +#ifndef _CoreBoostPy_Callback_h_ +#define _CoreBoostPy_Callback_h_ + +#include "Common.h" + +NAMESPACE_UPP + +void export_Callback(); + +END_UPP_NAMESPACE + +#endif diff --git a/bazaar/CoreBoostPy/CoreBoostPy.cpp b/bazaar/CoreBoostPy/CoreBoostPy.cpp index a36ff8c66..5266a516f 100644 --- a/bazaar/CoreBoostPy/CoreBoostPy.cpp +++ b/bazaar/CoreBoostPy/CoreBoostPy.cpp @@ -11,6 +11,8 @@ ONCELOCK export_Value(); export_ValueArray(); export_ValueMap(); + + export_Log(); } } diff --git a/bazaar/CoreBoostPy/CoreBoostPy.h b/bazaar/CoreBoostPy/CoreBoostPy.h index fdcb7d461..0daa1985e 100644 --- a/bazaar/CoreBoostPy/CoreBoostPy.h +++ b/bazaar/CoreBoostPy/CoreBoostPy.h @@ -1,9 +1,11 @@ #ifndef _CoreBoostPy_CoreBoostPy_h_ #define _CoreBoostPy_CoreBoostPy_h_ +#include "Misc.h" #include "GTypes.h" #include "String.h" #include "Value.h" +#include "Callback.h" NAMESPACE_UPP diff --git a/bazaar/CoreBoostPy/CoreBoostPy.upp b/bazaar/CoreBoostPy/CoreBoostPy.upp index 0395e779d..619c9aaa1 100644 --- a/bazaar/CoreBoostPy/CoreBoostPy.upp +++ b/bazaar/CoreBoostPy/CoreBoostPy.upp @@ -4,6 +4,10 @@ uses file Common.h, + Misc.h, + Misc.cpp, + Callback.h, + Callback.cpp, GTypes.h, GTypes.cpp, String.h, diff --git a/bazaar/CoreBoostPy/Misc.cpp b/bazaar/CoreBoostPy/Misc.cpp new file mode 100644 index 000000000..3aa04f175 --- /dev/null +++ b/bazaar/CoreBoostPy/Misc.cpp @@ -0,0 +1,20 @@ +#include "Misc.h" +using namespace boost::python; + +NAMESPACE_UPP + +void DoLog(const String& s) +{ + RLOG(s); +} + +void export_Log() +{ +ONCELOCK +{ + def("log", &DoLog, "Writes to the UppLog"); + +} +} + +END_UPP_NAMESPACE diff --git a/bazaar/CoreBoostPy/Misc.h b/bazaar/CoreBoostPy/Misc.h new file mode 100644 index 000000000..83a6046cb --- /dev/null +++ b/bazaar/CoreBoostPy/Misc.h @@ -0,0 +1,12 @@ +#ifndef _CoreBoostPy_Misc_h_ +#define _CoreBoostPy_Misc_h_ + +#include "Common.h" + +NAMESPACE_UPP + +void export_Log(); + +END_UPP_NAMESPACE + +#endif diff --git a/bazaar/CtrlLibBoostPy/CtrlCore.cpp b/bazaar/CtrlLibBoostPy/CtrlCore.cpp index 82588b33f..ff27d63eb 100644 --- a/bazaar/CtrlLibBoostPy/CtrlCore.cpp +++ b/bazaar/CtrlLibBoostPy/CtrlCore.cpp @@ -52,9 +52,15 @@ void CtrlReject(Ctrl& c) { c.Reject(); } void CtrlSetModify(Ctrl& c, bool b) { if (b) c.SetModify(); else c.ClearModify(); } bool CtrlIsModified(const Ctrl& c) { return c.IsModified(); } +Size CtrlGetMinSize(Ctrl& c) { return c.GetMinSize(); } +Size CtrlGetStdSize(Ctrl& c) { return c.GetStdSize(); } +Rect CtrlGetVoidRect(Ctrl& c) { return c.GetVoidRect(); } + Value CtrlGetData(const Ctrl& c) { return c.GetData(); } void CtrlSetData(Ctrl& c, const Value& data) { c.SetData(data); } +void CtrlClose(Ctrl& c) { c.Close(); } + //return ignorers void CtrlWantFocus(Ctrl& c, bool b) { c.WantFocus(b); } void CtrlInitFocus(Ctrl& c, bool b) { c.InitFocus(b); } @@ -118,6 +124,13 @@ ONCELOCK .add_property("rect", &Ctrl::GetRect, (void (Ctrl::*)(const Rect&))&Ctrl::SetRect) .add_property("size", &Ctrl::GetSize) + .add_property("minsize", &CtrlGetMinSize) + .add_property("stdsize", &CtrlGetStdSize) + .add_property("voidrect", &CtrlGetVoidRect) + + .add_property("inview", &Ctrl::InView) + .add_property("inframe", &Ctrl::InFrame) + .def("leftpos", &CtrlLeftPos) .def("rightpos", &CtrlRightPos) .def("toppos", &CtrlTopPos) @@ -141,12 +154,96 @@ ONCELOCK .def("action", &Ctrl::Action) .def("refresh", (void (Ctrl::*)(void))&Ctrl::Refresh) + .def("close", &CtrlClose) + .add_property("isopen", &Ctrl::IsOpen) + + .add_property("backpaint", &CtrlIsBackPaint, &CtrlSetBackPaint) .add_property("transparent", &Ctrl::IsTransparent, &CtrlTransparent) .add_property("tip", &Ctrl::GetTip, &CtrlSetTip) .def("__str__", &CtrlToString) ; + + def("showrepaint", &Ctrl::ShowRepaint, "Show Repaint process in Upp"); +} +} + +//virtuals +void TopWindowClose(TopWindow& c) { c.Close(); } + +//return ignore +void TopWindowSetTitle(TopWindow& c, const String& s) { c.Title(s); } +String TopWindowGetTitle(const TopWindow& c) { return c.GetTitle().ToString(); } + +void TopWindowFullScreen(TopWindow& c, bool b) { c.FullScreen(b); } +void TopWindowSizeable(TopWindow& c, bool b) { c.Sizeable(b); } +void TopWindowZoomable(TopWindow& c, bool b) { c.Zoomable(b); } +void TopWindowTopMost(TopWindow& c, bool b, bool d) { c.TopMost(b, d); } +void TopWindowToolWindow(TopWindow& c, bool b) { c.ToolWindow(b); } + +//enum helper, boost needs namespace +enum TopWindowEnum +{ + _IDOK = IDOK, + _IDCANCEL = IDCANCEL, + _IDABORT = IDABORT, + _IDRETRY = IDRETRY, + _IDIGNORE = IDIGNORE, + _IDYES = IDYES, + _IDNO = IDNO, + _IDCLOSE = IDCLOSE, + _IDHELP = IDHELP, + _IDEXIT = IDEXIT, +}; + +void export_TopWindow() +{ +ONCELOCK +{ + enum_("choice") + .value("idok", _IDOK) + .value("idcancel", _IDCANCEL) + .value("idabort", _IDABORT) + .value("idretry", _IDRETRY) + .value("idignore", _IDIGNORE) + .value("idyes", _IDYES) + .value("idno", _IDNO) + .value("idclose", _IDCLOSE) + .value("idhelp", _IDHELP) + .value("idexit", _IDEXIT) + ; + + class_, TopWindow, boost::noncopyable>("TopWindow", "Upp TopWindow", no_init) + .def("backup", &TopWindow::Backup) + .def("restore", &TopWindow::Restore) + .def("break", &TopWindow::Break) + .def("acceptbreak", &TopWindow::AcceptBreak) + .def("rejectbreak", &TopWindow::RejectBreak) + + .def("workareatrim", &TopWindow::WorkAreaTrim) + + .def("setminsize", &TopWindow::SetMinSize) + + .def("open", (void (TopWindow::*)())&TopWindow::Open) + .def("openmain", &TopWindow::OpenMain) + .def("run", &TopWindow::Run) + .def("runappmodal", &TopWindow::RunAppModal) + .def("execute", &TopWindow::Execute) + .def("executeok", &TopWindow::ExecuteOK) + .def("executecancel", &TopWindow::ExecuteCancel) + + .add_property("minimize", &TopWindow::IsMinimized, &TopWindow::Minimize) + .add_property("maximize", &TopWindow::IsMaximized, &TopWindow::Maximize) + .add_property("overlap", &TopWindow::IsOverlapped, &TopWindow::Overlap) + + .add_property("sizeable", &TopWindow::IsSizeable, &TopWindowSizeable) + .add_property("zoomable", &TopWindow::IsZoomable, &TopWindowZoomable) + .add_property("topmost", &TopWindow::IsTopMost, &TopWindowTopMost) + .add_property("toolwindow", &TopWindow::IsToolWindow, &TopWindowToolWindow) + + .add_property("fullscreen", &TopWindow::IsFullScreen, &TopWindowFullScreen) + ; } } diff --git a/bazaar/CtrlLibBoostPy/CtrlCore.h b/bazaar/CtrlLibBoostPy/CtrlCore.h index d5d897c6a..3e8ae4e66 100644 --- a/bazaar/CtrlLibBoostPy/CtrlCore.h +++ b/bazaar/CtrlLibBoostPy/CtrlCore.h @@ -8,6 +8,7 @@ NAMESPACE_UPP void export_Logc(); void export_LogPos(); void export_CtrlCore(); +void export_TopWindow(); END_UPP_NAMESPACE diff --git a/bazaar/CtrlLibBoostPy/CtrlLibBoostPy.cpp b/bazaar/CtrlLibBoostPy/CtrlLibBoostPy.cpp index c74695a7f..00e86c9e2 100644 --- a/bazaar/CtrlLibBoostPy/CtrlLibBoostPy.cpp +++ b/bazaar/CtrlLibBoostPy/CtrlLibBoostPy.cpp @@ -7,10 +7,14 @@ void export_CtrlLib() ONCELOCK { export_CtrlCore(); - export_EditCtrl(); + export_TopWindow(); + export_EditCtrl(); export_SliderCtrl(); export_ValueCtrl(); + export_Progress(); + + export_Prompts(); } } diff --git a/bazaar/CtrlLibBoostPy/CtrlLibBoostPy.h b/bazaar/CtrlLibBoostPy/CtrlLibBoostPy.h index 506d5e18c..8eac67cf6 100644 --- a/bazaar/CtrlLibBoostPy/CtrlLibBoostPy.h +++ b/bazaar/CtrlLibBoostPy/CtrlLibBoostPy.h @@ -2,9 +2,11 @@ #define _CtrlLibBoostPy_CtrlLibBoostPy_h_ #include "CtrlCore.h" +#include "Misc.h" #include "EditCtrl.h" #include "SliderCtrl.h" #include "ValueCtrl.h" +#include "Progress.h" NAMESPACE_UPP diff --git a/bazaar/CtrlLibBoostPy/CtrlLibBoostPy.upp b/bazaar/CtrlLibBoostPy/CtrlLibBoostPy.upp index b97ce215a..21783d42c 100644 --- a/bazaar/CtrlLibBoostPy/CtrlLibBoostPy.upp +++ b/bazaar/CtrlLibBoostPy/CtrlLibBoostPy.upp @@ -7,12 +7,16 @@ file Common.h, CtrlCore.h, CtrlCore.cpp, + Misc.h, + Misc.cpp, SliderCtrl.h, SliderCtrl.cpp, ValueCtrl.h, ValueCtrl.cpp, EditCtrl.h, EditCtrl.cpp, + Progress.h, + Progress.cpp, CtrlLibBoostPy.h, CtrlLibBoostPy.cpp; diff --git a/bazaar/CtrlLibBoostPy/Misc.cpp b/bazaar/CtrlLibBoostPy/Misc.cpp new file mode 100644 index 000000000..35c0a039c --- /dev/null +++ b/bazaar/CtrlLibBoostPy/Misc.cpp @@ -0,0 +1,21 @@ +#include "Misc.h" +using namespace boost::python; + +NAMESPACE_UPP + +void export_Prompts() +{ +ONCELOCK +{ + def("promptok", &PromptOK, "Prompts OK"); + def("promptokcancel", &PromptOKCancel, "Prompts OK/Cancel"); + def("promptabortretry", &PromptAbortRetry, "Prompts Abort/Retry"); + def("promptabortretryignore", &PromptAbortRetryIgnore, "Prompts Abort/Retry/Ignore"); + def("promptretrycancel", &PromptRetryCancel, "Prompts Retry/Cancel"); + def("promptyesno", &PromptYesNo, "Prompts Yes/No"); + def("promptyesnocancel", &PromptYesNoCancel, "Prompts Yes/No/Cancel"); + def("exclamation", &Exclamation, "Exclamates an Error Dialog"); +} +} + +END_UPP_NAMESPACE diff --git a/bazaar/CtrlLibBoostPy/Misc.h b/bazaar/CtrlLibBoostPy/Misc.h new file mode 100644 index 000000000..61ca6ec26 --- /dev/null +++ b/bazaar/CtrlLibBoostPy/Misc.h @@ -0,0 +1,12 @@ +#ifndef _CtrlLibBoostPy_Misc_h_ +#define _CtrlLibBoostPy_Misc_h_ + +#include "Common.h" + +NAMESPACE_UPP + +void export_Prompts(); + +END_UPP_NAMESPACE + +#endif diff --git a/bazaar/CtrlLibBoostPy/Progress.cpp b/bazaar/CtrlLibBoostPy/Progress.cpp new file mode 100644 index 000000000..67ff728fb --- /dev/null +++ b/bazaar/CtrlLibBoostPy/Progress.cpp @@ -0,0 +1,30 @@ +#include "Progress.h" +using namespace boost::python; + +NAMESPACE_UPP + +void export_Progress() +{ +ONCELOCK +{ + class_, Progress, boost::noncopyable>("Progress", "Upp Progress", no_init) + .add_property("pos", &Progress::GetPos, &Progress::SetPos) + .add_property("total", &Progress::GetTotal, &Progress::SetTotal) + .add_property("text", &Progress::GetText, (void (Progress::*)(const String&))&Progress::SetText) + + .def("create", &Progress::Create) + .def("cancel", &Progress::Cancel) + .def("reset", &Progress::Reset) + .def("set", &Progress::Set) + .def("step", &Progress::Step) + + .def("canceled", &Progress::Canceled) + .def("setcanceled", &Progress::SetCanceled) + .def("setposcanceled", &Progress::SetPosCanceled) + .def("stepcanceled", &Progress::StepCanceled) + ; + +} +} + +END_UPP_NAMESPACE diff --git a/bazaar/CtrlLibBoostPy/Progress.h b/bazaar/CtrlLibBoostPy/Progress.h new file mode 100644 index 000000000..7f92cd1a0 --- /dev/null +++ b/bazaar/CtrlLibBoostPy/Progress.h @@ -0,0 +1,12 @@ +#ifndef _CtrlLibBoostPy_Progress_h_ +#define _CtrlLibBoostPy_Progress_h_ + +#include "Common.h" + +NAMESPACE_UPP + +void export_Progress(); + +END_UPP_NAMESPACE + +#endif