finish basic work of fit-content
This commit is contained in:
@@ -19,11 +19,8 @@
|
||||
#include <nana/config.hpp>
|
||||
#include <nana/stdc++.hpp>
|
||||
|
||||
|
||||
#include <stdexcept>
|
||||
#include <nana/charset.hpp>
|
||||
|
||||
|
||||
namespace nana
|
||||
{
|
||||
/// move to *.h ??
|
||||
|
||||
@@ -30,11 +30,18 @@ namespace nana
|
||||
|
||||
/// Measures content
|
||||
/**
|
||||
* @param limit_width true if limits the width, false if limits the height.
|
||||
* @param limit_pixels the number of pixels of the limited edge. If this parameter is zero, it is ignored
|
||||
* @return the size of content
|
||||
*/
|
||||
virtual optional<size> measure(graph_reference, bool limit_width, unsigned limit_pixels) const = 0;
|
||||
* @param graph The graphics for the operation.
|
||||
* @param limit_pixels The number of pixels of the limited edge. If this parameter is zero, it is ignored.
|
||||
* @param limit_width True if limits the width, false if limits the height.
|
||||
* @return the size of content.
|
||||
*/
|
||||
virtual optional<size> measure(graph_reference graph, unsigned limit_pixels, bool limit_width) const = 0;
|
||||
|
||||
/// Returns the extension to the size of widget from content extent
|
||||
/**
|
||||
* @return the width and height of extension to the widget size.
|
||||
*/
|
||||
virtual size extension() const = 0;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -403,6 +403,17 @@ namespace API
|
||||
bool ignore_mouse_focus(window); ///< Determines whether the mouse focus is enabled
|
||||
|
||||
void at_safe_place(window, std::function<void()>);
|
||||
|
||||
/// Returns a widget content extent size
|
||||
/**
|
||||
* @param wd A handle to a window that returns its content extent size.
|
||||
* @param limited_px Specifies the max pixels of width or height. If this parameter is zero, this parameter will be ignored.
|
||||
* @param limit_width Indicates whether the it limits the width or height. If this parameter is *true*, the width is limited.
|
||||
* If the parameter is *false*, the height is limited. This parameter is ignored if limited_px = 0.
|
||||
* @return if optional has a value, the first size indicates the content extent, the second size indicates the size of
|
||||
* widget by the content extent.
|
||||
*/
|
||||
optional<std::pair<::nana::size, ::nana::size>> content_extent(window wd, unsigned limited_px, bool limit_width);
|
||||
}//end namespace API
|
||||
|
||||
}//end namespace nana
|
||||
|
||||
@@ -59,6 +59,8 @@ namespace nana{
|
||||
|
||||
element::cite_bground cite_{"button"};
|
||||
|
||||
std::unique_ptr<measurer> measurer_;
|
||||
|
||||
struct attr_tag
|
||||
{
|
||||
element_state e_state;
|
||||
|
||||
Reference in New Issue
Block a user