Skip to content

Commit

Permalink
Merge pull request #6 from cnjinhao/develop-1.7
Browse files Browse the repository at this point in the history
Develop 1.7
  • Loading branch information
besh81 authored Feb 6, 2019
2 parents 91dfaa5 + 85c2bdb commit 66461d6
Show file tree
Hide file tree
Showing 16 changed files with 840 additions and 251 deletions.
7 changes: 3 additions & 4 deletions include/nana/gui/filebox.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Filebox
* Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2018 Jinhao([email protected])
* Copyright(C) 2003-2019 Jinhao([email protected])
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
Expand Down Expand Up @@ -69,11 +69,10 @@ namespace nana


const ::std::string& path() const;
const ::std::string& file() const;
#if defined(NANA_WINDOWS)
::std::string file() const;

const ::std::vector<::std::string>& files() const;
void allow_multi_select(bool allow);
#endif

/// Display the filebox dialog
bool show() const;
Expand Down
1 change: 1 addition & 0 deletions include/nana/gui/widgets/checkbox.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ namespace drawerbase
struct element_tag
{
checkbox * uiobj;
event_handle eh_clicked;
event_handle eh_checked;
event_handle eh_destroy;
event_handle eh_keyboard;
Expand Down
8 changes: 5 additions & 3 deletions include/nana/gui/widgets/detail/compset.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Concept of Component Set
* Copyright(C) 2003-2013 Jinhao([email protected])
* Copyright(C) 2003-2019 Jinhao([email protected])
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
Expand Down Expand Up @@ -60,17 +60,19 @@ namespace nana{ namespace widgets{ namespace detail
/// Widget scheme.
typedef WidgetScheme widget_scheme_t;

widget_scheme_t * wdg_scheme_ptr_{ nullptr };
//widget_scheme_t * wdg_scheme_ptr_{ nullptr }; //deprecated

public:
/// The destructor.
virtual ~compset_placer(){}

/*
/// Init the scheme pointer
void init_scheme(widget_scheme_t* wdg_scheme_ptr)
void init_scheme(widget_scheme_t* wdg_scheme_ptr) //deprecated
{
wdg_scheme_ptr_ = wdg_scheme_ptr;
}
*/

/// Enable/Disable the specified component.
virtual void enable(component_t, bool) = 0;
Expand Down
5 changes: 4 additions & 1 deletion include/nana/gui/widgets/group.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ namespace nana{
/// Determines whether a specified option is checked, it throws an out_of_range if !(pos < number of options)
bool option_checked(std::size_t pos) const;

/// Change typeface of caption label ( does not effect child widgets )
void typeface( const nana::paint::font& font );

group& enable_format_caption(bool format);

group& collocate() noexcept;
Expand All @@ -101,7 +104,7 @@ namespace nana{
void field_display(const char* field_name, bool display); ///<Displays/Discards an existing field.
bool field_display(const char* field_name) const; ///<Determines whether the specified field is displayed.
void erase(window handle); ///< Erases a window from field.

template<typename Widget, typename ...Args>
Widget* create_child(const char* field, Args && ... args)
{
Expand Down
20 changes: 17 additions & 3 deletions include/nana/gui/widgets/listbox.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* A List Box Implementation
* Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2018 Jinhao([email protected])
* Copyright(C) 2003-2019 Jinhao([email protected])
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
Expand Down Expand Up @@ -1461,7 +1461,19 @@ the nana::detail::basic_window member pointer scheme
/// Returns the number of columns
size_type column_size() const;

void column_resizable(bool resizable);
/// Move column to view_position
void move_column(size_type abs_pos, size_type view_pos);

/// Sort columns in range first_col to last_col inclusive using the values from a row
void reorder_columns(size_type first_col,
size_type last_col,
index_pair row, bool reverse,
std::function<bool(const std::string &cell1, size_type col1,
const std::string &cell2, size_type col2,
const nana::any *rowval,
bool reverse)> comp);

void column_resizable(bool resizable);
bool column_resizable() const;
void column_movable(bool);
bool column_movable() const;
Expand Down Expand Up @@ -1517,7 +1529,8 @@ the nana::detail::basic_window member pointer scheme

///Sets a strict weak ordering comparer for a column
void set_sort_compare( size_type col,
std::function<bool(const std::string&, nana::any*, const std::string&, nana::any*, bool reverse)> strick_ordering);
std::function<bool(const std::string&, nana::any*,
const std::string&, nana::any*, bool reverse)> strick_ordering);

/// sort() and ivalidate any existing reference from display position to absolute item, that is: after sort() display offset point to different items
void sort_col(size_type col, bool reverse = false);
Expand All @@ -1538,6 +1551,7 @@ the nana::detail::basic_window member pointer scheme

void enable_single(bool for_selection, bool category_limited);
void disable_single(bool for_selection);
bool is_single_enabled(bool for_selection) const noexcept; ///< Determines whether the single selection/check is enabled.
export_options& def_export_options();


Expand Down
8 changes: 7 additions & 1 deletion include/nana/gui/widgets/slider.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,13 @@ namespace nana
bool vertical() const;
void maximum(unsigned);
unsigned maximum() const;
void value(unsigned);

/** Set slider value
@param[in] v new value for slider.
v will be clipped to the range 0 to maximum
*/
void value(int );

unsigned value() const;
unsigned move_step(bool forward); ///< Increase or decrease the value of slider.
unsigned adorn() const;
Expand Down
2 changes: 1 addition & 1 deletion include/nana/gui/widgets/treebox.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* A Tree Box Implementation
* Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2018 Jinhao([email protected])
* Copyright(C) 2003-2019 Jinhao([email protected])
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE or copy at
Expand Down
30 changes: 13 additions & 17 deletions source/gui/detail/native_window_interface.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Platform Implementation
* Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2018 Jinhao([email protected])
* Copyright(C) 2003-2019 Jinhao([email protected])
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
Expand Down Expand Up @@ -29,6 +29,7 @@

#include "../../paint/image_accessor.hpp"


namespace nana{
namespace detail{

Expand Down Expand Up @@ -199,7 +200,7 @@ namespace nana{
namespace x11_wait
{
static Bool configure(Display *disp, XEvent *evt, char *arg)
{
{
return disp && evt && arg && (evt->type == ConfigureNotify) && (evt->xconfigure.window == *reinterpret_cast<Window*>(arg));
}

Expand Down Expand Up @@ -1019,15 +1020,11 @@ namespace nana{
auto const owner = restrict::spec.get_owner(wd);
if(owner && (owner != reinterpret_cast<native_window_type>(restrict::spec.root_window())))
{
auto origin = window_position(owner);
#if 0
x += origin.x;
y += origin.y;
#else
auto owner_extents = window_frame_extents(owner);
x += origin.x + owner_extents.left;
y += origin.y + owner_extents.top;
#endif
int origin_x, origin_y;
Window child_useless_for_API;
::XTranslateCoordinates(disp, reinterpret_cast<Window>(owner), restrict::spec.root_window(), 0, 0, &origin_x, &origin_y, &child_useless_for_API);
x += origin_x;
y += origin_y;
}

::XMoveWindow(disp, reinterpret_cast<Window>(wd), x, y);
Expand Down Expand Up @@ -1074,7 +1071,6 @@ namespace nana{
XSizeHints hints;
nana::detail::platform_scope_guard psg;


//Returns if the requested rectangle is same with the current rectangle.
//In some X-Server versions/implementations, XMapWindow() doesn't generate
//a ConfigureNotify if the requested rectangle is same with the current rectangle.
Expand Down Expand Up @@ -1114,11 +1110,11 @@ namespace nana{
auto const owner = restrict::spec.get_owner(wd);
if(owner && (owner != reinterpret_cast<native_window_type>(restrict::spec.root_window())))
{
auto origin = window_position(owner);

auto owner_extents = window_frame_extents(owner);
x += origin.x + owner_extents.left;
y += origin.y + owner_extents.top;
int origin_x, origin_y;
Window child_useless_for_API;
::XTranslateCoordinates(disp, reinterpret_cast<Window>(owner), restrict::spec.root_window(), 0, 0, &origin_x, &origin_y, &child_useless_for_API);
x += origin_x;
y += origin_y;
}

::XMoveResizeWindow(disp, reinterpret_cast<Window>(wd), x, y, r.width, r.height);
Expand Down
Loading

0 comments on commit 66461d6

Please sign in to comment.