1
0

xuiqueryline.cpp 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #include <precomp.h>
  2. #include "xuiqueryline.h"
  3. #include <api/skin/widgets/db/xuiquerylist.h>
  4. #define CB_SETQUERYLIST 0x1978
  5. char QueryLineXuiObjectStr[] = "QueryLine"; // This is the xml tag
  6. char QueryLineXuiSvcName[] = "QueryLine xui object";
  7. ScriptQueryLine::ScriptQueryLine() {
  8. myxuihandle = newXuiHandle();
  9. addParam(myxuihandle, "querylist", QUERYLINE_SETQUERYLIST, XUI_ATTRIBUTE_IMPLIED);
  10. addParam(myxuihandle, "query", QUERYLINE_SETQUERY, XUI_ATTRIBUTE_IMPLIED);
  11. addParam(myxuihandle, "auto", QUERYLINE_SETAUTO, XUI_ATTRIBUTE_IMPLIED);
  12. }
  13. ScriptQueryLine::~ScriptQueryLine() { }
  14. /*int ScriptQueryLine::onInit() {
  15. SCRIPTQUERYLINE_PARENT::onInit();
  16. if (!querylist_id.isempty())
  17. postDeferredCallback(CB_SETQUERYLIST, 0, 500);
  18. return 1;
  19. }*/
  20. int ScriptQueryLine::setXuiParam(int xuihandle, int xmlattributeid, const wchar_t *xmlattributename, const wchar_t *value) {
  21. if (xuihandle != myxuihandle)
  22. return SCRIPTQUERYLINE_PARENT::setXuiParam(xuihandle, xmlattributeid, xmlattributename, value);
  23. switch (xmlattributeid) {
  24. case QUERYLINE_SETQUERYLIST:
  25. setXuiQueryList(value);
  26. break;
  27. case QUERYLINE_SETQUERY:
  28. ql_setQuery(value);
  29. break;
  30. case QUERYLINE_SETAUTO:
  31. setAuto(WTOI(value));
  32. break;
  33. default:
  34. return 0;
  35. }
  36. return 1;
  37. }
  38. void ScriptQueryLine::ql_setQuery(const char *q) {
  39. ensureConnected();
  40. setQuery(q);
  41. }
  42. void ScriptQueryLine::ensureConnected() {
  43. api_window *o = findWindow(querylist_id);
  44. if (!o) return;
  45. ScriptQueryList *querylist = static_cast<ScriptQueryList *>(o->getInterface(queryListGuid));
  46. if (!querylist) return;
  47. sqs_setMultiQueryServer(querylist);
  48. }
  49. void ScriptQueryLine::setXuiQueryList(const char *v) {
  50. querylist_id = v;
  51. }
  52. /*int ScriptQueryLine::onDeferredCallback(intptr_t p1, intptr_t p2) {
  53. switch (p1) {
  54. case CB_SETQUERYLIST:
  55. break;
  56. default:
  57. return SCRIPTQUERYLINE_PARENT::onDeferredCallback(p1, p2);
  58. }
  59. return 1;
  60. }
  61. */