Example #1
0
DLL_LOCAL VALUE _busyinfo(int argc,VALUE *argv,VALUE self)
{
    VALUE message, parent, hash;
    rb_scan_args(argc, argv, "11:",&message, &parent, &hash);

    app_protected();
#ifdef HAVE_WXBUSYINFOFLAGS
    wxBusyInfoFlags flags;
    flags.Label(unwrap<wxString>(message));
    flags.Parent(unwrap<wxWindow*>(parent));

    if(rb_obj_is_kind_of(hash,rb_cHash))
    {

        set_obj_option(hash,"icon",&wxBusyInfoFlags::Icon, flags);
        set_obj_option(hash,"title",&wxBusyInfoFlags::Title, flags);
        set_obj_option(hash,"text",&wxBusyInfoFlags::Text, flags);
        set_obj_option(hash,"label",&wxBusyInfoFlags::Label, flags);
        set_obj_option(hash,"parent",&wxBusyInfoFlags::Parent, flags);
        set_obj_option(hash,"foreground",&wxBusyInfoFlags::Foreground, flags);
        set_obj_option(hash,"background",&wxBusyInfoFlags::Background, flags);
        //set_obj_option(hash,"transparency",&wxBusyInfoFlags::Transparency, flags, unwrap<unsigned int>);

    }

    wxBusyInfo info(flags);
#else
    wxBusyInfo info(unwrap<wxString>(message),unwrap<wxWindow*>(parent));
#endif
    rb_yield(Qnil);
    return self;
}
Example #2
0
/*
 * call-seq:
 *   dir_dialog([parent], [options]) -> String
 *
 * shows an DirDialog.
 * ===Arguments
 * * parent of this window or nil
 *
 * *options: Hash with possible options to set:
 *   * path String default path
 *   * message String
 *   * style Integer
 *   * pos WX::Point

 *   * must_exist Style Flag does set MUST_EXIST
 *   * change_dir Style Flag does set CHANGE_DIR
 * ===Return value
 * selected path
*/
DLL_LOCAL VALUE _getUserDir(int argc,VALUE *argv,VALUE self)
{
	VALUE parent,hash;
	rb_scan_args(argc, argv, "01:",&parent,&hash);

	app_protected();

	wxString message(wxDirSelectorPromptStr);
	wxString defaultPath(wxEmptyString);
	int style(wxDD_DEFAULT_STYLE);
	wxPoint pos(wxDefaultPosition);

	if(rb_obj_is_kind_of(hash,rb_cHash))
	{
		set_default_values(hash,message,defaultPath,style);

		set_hash_option(hash,"pos",pos);

		set_style_flags(hash,style);

	}

	return wrap(wxDirSelector(message,
			defaultPath,style,pos,
			unwrap<wxWindow*>(parent)));
}
Example #3
0
DLL_LOCAL VALUE _getUserColor(int argc,VALUE *argv,VALUE self)
{
	VALUE parent,caption;
	rb_scan_args(argc, argv, "11",&parent,&caption);

	app_protected();

	wxColor col = wxGetColourFromUser(unwrap<wxWindow*>(parent),*wxBLACK,unwrap<wxString>(caption));
	return col.IsOk() ? wrap(col) : Qnil;
}
Example #4
0
DLL_LOCAL VALUE _busy(int argc,VALUE *argv,VALUE self)
{
    VALUE cursor;
    rb_scan_args(argc, argv, "01",&cursor);

    app_protected();

    wxBeginBusyCursor(NIL_P(cursor) ? wxHOURGLASS_CURSOR : unwrap<wxCursor*>(cursor));
    rb_yield(Qnil);
    wxEndBusyCursor();
    return self;
}
Example #5
0
/*
 * call-seq:
 *   draw { | dc | } -> self
 *
 * create a DC for drawing in the image.
 *
 */
DLL_LOCAL VALUE _draw(VALUE self)
{
	app_protected();
	rb_check_frozen(self);

	wxDC *dc;

#if wxUSE_GRAPHICS_CONTEXT
	dc = new wxGCDC(wxGraphicsContext::Create(*_self));
#else
	wxBitmap bit(*_self);
	wxMemoryDC *mdc = new wxMemoryDC(bit);
	dc = mdc;
#endif
	rb_yield(wrap(dc));

#if !wxUSE_GRAPHICS_CONTEXT
	(*_self) = bit.ConvertToImage();
	mdc->SelectObject(wxNullBitmap);
#endif
	//TODO add a way to delete the DCs again
	return self;
}
Example #6
0
DLL_LOCAL VALUE _isBusy(VALUE self)
{
    app_protected();
    return wrap(wxIsBusy());
}