Nana - a C++ framework project  

The Programmer's Guide 
nana::gui::dragger

Description

The dragger is a helper class that allows the user to drag windows. If a user presses the mouse on the specified window and moves the mouse, the specified window is dragged.

Model of

None. 

Public base classes

None.

Members

dragger() The default constructor.
~dragger() The destructor.
void target(nana::gui::window wd) Sets the windows to be moved.
void trigger(nana::gui::window wd) Sets the trigger window that the mouse drags it.

File

nana/gui/dragger.hpp

Notes

1. The drag target window and trigger window can be set more than one. For example.

#include <nana/gui/wvl.hpp>
#include <nana/gui/widgets/button.hpp>
#include <nana/gui/dragger.hpp>

int main()
{
    using namespace nana::gui;
    form fm;
    button btn(fm, 10, 10, 100, 20);
    btn.caption(STR("Drag Me"));

    form & adherent = form_loader<form>()();
    adherent.show();

    dragger dg;
    dg.target(fm);
    dg.target(adherent);
    dg.trigger(btn);
    dg.trigger(adherent);

    fm.show();
    exec();
}

This example sets the btn and the adherent to be triggers, and dragger will move the form and adherent when the user is dragging the trigger widgets.

See also

None.


Move to The Nana Programmer's Guide Main Page