GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — xplot/include/xplot/xtooltip.hpp at master · QuantStack/xplot Expand file tree/ Copy pathxtooltip.hppMore file actions 117 lines (90 loc) · 3.42 KB / Copy pathxtooltip.hppFile metadata and controls117 lines (90 loc) · 3.42 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 /*************************************************************************** * Copyright (c) 2017, Sylvain Corlay and Johan Mabille * * * * Distributed under the terms of the BSD 3-Clause License. * * * * The full license is in the file LICENSE, distributed with this software. * ****************************************************************************/ #ifndef XPLOT_DEFAULT_TOOLTIP_HPP #define XPLOT_DEFAULT_TOOLTIP_HPP #include <string> #include <vector> #include "nlohmann/json.hpp" #include "xproperty/xjson.hpp" #include "xwidgets/xwidget.hpp" #include "xplot_config.hpp" namespace nl = nlohmann; namespace xpl { /************************ * xtooltip declaration * ************************/ template <class D> class xtooltip : public xw::xwidget<D> { public: using base_type = xw::xwidget<D>; using derived_type = D; using data_type = std::vector<xtl::xoptional<std::string>>; void serialize_state(nl::json&, xeus::buffer_sequence&) const; void apply_patch(const nl::json&, const xeus::buffer_sequence&); XPROPERTY(data_type, derived_type, fields); XPROPERTY(data_type, derived_type, formats); XPROPERTY(data_type, derived_type, labels); XPROPERTY(bool, derived_type, show_labels, true); protected: xtooltip(); using base_type::base_type; private: void set_defaults(); }; using tooltip = xw::xmaterialize<xtooltip>; /*************************** * xtooltip implementation * ***************************/ template <class D> inline void xtooltip<D>::apply_patch(const nl::json& patch, const xeus::buffer_sequence& buffers) { using xw::set_property_from_patch; base_type::apply_patch(patch, buffers); set_property_from_patch(fields, patch, buffers); set_property_from_patch(formats, patch, buffers); set_property_from_patch(labels, patch, buffers); set_property_from_patch(show_labels, patch, buffers); } template <class D> inline void xtooltip<D>::serialize_state(nl::json& state, xeus::buffer_sequence& buffers) const { using xw::xwidgets_serialize; base_type::serialize_state(state, buffers); xwidgets_serialize(fields, state["fields"], buffers); xwidgets_serialize(formats, state["formats"], buffers); xwidgets_serialize(labels, state["labels"], buffers); xwidgets_serialize(show_labels, state["show_labels"], buffers); } template <class D> inline xtooltip<D>::xtooltip() : base_type() { set_defaults(); } template <class D> inline void xtooltip<D>::set_defaults() { this->_view_name() = "Tooltip"; this->_model_module() = "bqplot"; this->_model_module_version() = bqplot_semver(); this->_model_name() = "TooltipModel"; this->_view_module() = "bqplot"; this->_view_module_version() = bqplot_semver(); } } /********************* * precompiled types * *********************/ #ifndef _WIN32 extern template class xw::xmaterialize<xpl::xtooltip>; extern template class xw::xtransport<xw::xmaterialize<xpl::xtooltip>>; extern template xw::xmaterialize<xpl::xtooltip>::xmaterialize(); #endif #endif |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |