Beispiel #1
0
		ZoomControl(MainWindow *mw) : Gtk::Frame("Zoom control"), _mw(mw) {
			mode = RE_AX;
			set_border_width(10);
			tbl = Gtk::manage(new Gtk::Table(2,4));
			Gtk::RadioButton *b;
#define RADIO(LABEL,X1,Y1,MODE) do {							\
	b = Gtk::manage(new Gtk::RadioButton(grp, LABEL));			\
	tbl->attach(*b, X1, X1+1, Y1, Y1+1);						\
	b->signal_toggled().connect(sigc::bind<Gtk::ToggleButton*, mode_t>(	\
				sigc::mem_fun(*this, &ZoomControl::do_toggle), 	\
				b, MODE));										\
} while(0)

			RADIO("Real (x) axis length", 0, 0, RE_AX);
			RADIO("Imag (y) axis length", 1, 0, IM_AX);
			RADIO("Real (x) pixel size", 0, 1, RE_PIX);
			RADIO("Imag (y) pixel size", 1, 1, IM_PIX);
			RADIO("Zoom factor", 0, 2, ZOOM);

			field = Gtk::manage(new Util::HandyEntry<Fractal::Value>());
			field->set_activates_default(true);
			tbl->attach(*field, 0, 2, 3, 4);

			add(*tbl);
		}
Beispiel #2
0
static cb_ret_t
panel_listing_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
{
    WDialog *h = DIALOG (w);

    switch (msg)
    {
    case MSG_NOTIFY:
        if (sender != NULL && sender->id == panel_listing_types_id)
        {
            WCheck *ch;
            WInput *in1, *in2, *in3;

            in1 = INPUT (dlg_find_by_id (h, panel_user_format_id));
            in2 = INPUT (dlg_find_by_id (h, panel_brief_cols_id));
            ch = CHECK (dlg_find_by_id (h, mini_user_status_id));
            in3 = INPUT (dlg_find_by_id (h, mini_user_format_id));

            if (!(ch->state & C_BOOL))
                input_assign_text (in3, status_format[RADIO (sender)->sel]);
            input_update (in1, FALSE);
            input_update (in2, FALSE);
            input_update (in3, FALSE);
            widget_disable (WIDGET (in1), RADIO (sender)->sel != panel_listing_user_idx);
            widget_disable (WIDGET (in2), RADIO (sender)->sel != panel_listing_brief_idx);
            return MSG_HANDLED;
        }

        if (sender != NULL && sender->id == mini_user_status_id)
        {
            WInput *in;

            in = INPUT (dlg_find_by_id (h, mini_user_format_id));

            if (CHECK (sender)->state & C_BOOL)
            {
                widget_disable (WIDGET (in), FALSE);
                input_assign_text (in, status_format[3]);
            }
            else
            {
                WRadio *r;

                r = RADIO (dlg_find_by_id (h, panel_listing_types_id));
                widget_disable (WIDGET (in), TRUE);
                input_assign_text (in, status_format[r->sel]);
            }
            /* input_update (in, FALSE); */
            return MSG_HANDLED;
        }

        return MSG_NOT_HANDLED;

    default:
        return dlg_default_callback (w, sender, msg, parm, data);
    }
}
static void
_fill_zone_config(E_Zone               *zone,
                  E_Config_Dialog_Data *cfdata)
{
   E_Radio_Group *rg;
   Evas *evas = cfdata->evas;
   int i;

   /* Clear old entries first */
   evas_object_del(cfdata->o_desklist);
   cfdata->o_desklist = e_widget_list_add(evas, 1, 0);
   e_scrollframe_child_set(e_widget_scrollframe_object_get(cfdata->o_deskscroll), cfdata->o_desklist);
   e_widget_sub_object_add(cfdata->o_deskscroll, cfdata->o_desklist);

   for (i = 0; i < zone->desk_y_count * zone->desk_x_count; i++)
     {
        E_Desk *desk = zone->desks[i];
        if (!desk) continue;

        struct _E_Config_vdesk *vd = get_vdesk(cfdata, desk->x, desk->y, zone->num);
        if (!vd)
          {
             vd = malloc(sizeof(struct _E_Config_vdesk));
             vd->x = desk->x;
             vd->y = desk->y;
             vd->zone_num = zone->num;
             vd->layout = TILE_NONE;
             cfdata->vdesks = eina_list_append(cfdata->vdesks, vd);
          }

        rg = e_widget_radio_group_new(&(vd->layout));
        Evas_Object *radiolist = e_widget_list_add(evas, 0, 1);

        LIST_ADD(radiolist, e_widget_label_add(evas, desk->name));
        LIST_ADD(radiolist, RADIO("None", TILE_NONE, rg));
        LIST_ADD(radiolist, RADIO("Bigmain", TILE_BIGMAIN, rg));
        LIST_ADD(radiolist, RADIO("Grid", TILE_GRID, rg));
        LIST_ADD(cfdata->o_desklist, radiolist);
     }

   /* Get the correct sizes of desklist and scrollframe */
   int mw, mh;
   e_widget_size_min_get(cfdata->o_desklist, &mw, &mh);
   evas_object_resize(cfdata->o_desklist, mw, mh);
   if (mh > 150)
     mh = 150;
   mw += 32;
   mh += 32;
   e_widget_size_min_set(cfdata->o_deskscroll, mw, mh);
}
Beispiel #4
0
Datei: radio.c Projekt: LubkaB/mc
static int
radio_event (Gpm_Event * event, void *data)
{
    Widget *w = WIDGET (data);

    if (!mouse_global_in_widget (event, w))
        return MOU_UNHANDLED;

    if ((event->type & (GPM_DOWN | GPM_UP)) != 0)
    {
        WRadio *r = RADIO (data);
        Gpm_Event local;

        local = mouse_get_local (event, w);

        r->pos = local.y - 1;
        dlg_select_widget (w);
        if ((event->type & GPM_UP) != 0)
        {
            radio_callback (w, NULL, MSG_KEY, ' ', NULL);
            send_message (w->owner, w, MSG_POST_KEY, ' ', NULL);
        }
    }

    return MOU_NORMAL;
}
Beispiel #5
0
void WINAPI XBtn_SetCheck(HELE hEle,BOOL bCheck)
{
	IsButtonDebug(hEle,__FUNCTION__);
	if(BUTTON(hEle)->bCheck==bCheck)
		return ;

	BUTTON(hEle)->bCheck=bCheck;
	if(XC_RADIO==((ele_*)hEle)->eleType)
	{
		if(RADIO(hEle)->hBindEle)
		{
			if (BUTTON(hEle)->bCheck)
			{
				XEle_ShowEle(RADIO(hEle)->hBindEle,TRUE);
				XEle_RedrawEle(RADIO(hEle)->hBindEle);
			}else
			{
				XEle_RedrawEle(RADIO(hEle)->hBindEle);
				XEle_ShowEle(RADIO(hEle)->hBindEle,FALSE);
			}
		}
	}
}
Beispiel #6
0
static void menu_cb_font (EDITOR_ARGS) {
	EDITOR_IAM (HyperPage);
	EDITOR_FORM (L"Font", 0)
		RADIO (L"Font", 1)
			RADIOBUTTON (L"Times")
			RADIOBUTTON (L"Helvetica")
	EDITOR_OK
		SET_INTEGER (L"Font", my font == kGraphics_font_TIMES ? 1 :
				my font == kGraphics_font_HELVETICA ? 2 : my font == kGraphics_font_PALATINO ? 3 : 1);
	EDITOR_DO
		int font = GET_INTEGER (L"Font");
		prefs_font = my font = font == 1 ? kGraphics_font_TIMES : kGraphics_font_HELVETICA;
		if (my g) Graphics_updateWs (my g);
	EDITOR_END
}
Beispiel #7
0
/*
 * update callback
 */
static int
update(void * self, pkt_t *pkt, void *fh, int isnew)
{
    CONFIGDESC * config = CONFIG(self);
    FLOWDESC *x = F(fh); 

    if (isnew) {
	x->ts = COMO(ts) - COMO(ts) % TIME2TS(config->meas_ivl, 0);
	x->channel = -1; 
	x->signal = x->noise = 0;
        x->samples = 0; 

	/* now find the information in the management frame.
	 * get privacy bit to determine if wep is enabled
	 */
	x->wepmode = CAPINFO_PRIVACY(H16(MGMT_BODY(cap))) ? 1 : 0;

	/* get to the SSID information element */
	if (MGMT_BODY(ssid_len) > 0) { 
	    x->len = (MGMT_BODY(ssid_len)); 
	    bcopy(MGMT_BODY(ssid), x->ssid, x->len);
	} else { 
	    x->len = 3; 
	    sprintf(x->ssid, "ANY"); 
	}

	x->channel = MGMT_BODY(ch); 	
    }
    x->samples++;
    if (COMO(type) == COMOTYPE_RADIO) {
        x->signal += H32(RADIO(ssisignal)); 
        x->noise += H32(RADIO(ssinoise)); 
    }
    
    return 0; /* records are never full */
}
Beispiel #8
0
static void menu_cb_addToFixedMenu (ScriptEditor me, EDITOR_ARGS_FORM) {
	EDITOR_FORM (U"Add to fixed menu", U"Add to fixed menu...");
		RADIO (U"Window", 1)
			RADIOBUTTON (U"Objects")
			RADIOBUTTON (U"Picture")
		SENTENCE (U"Menu", U"New")
		SENTENCE (U"Command", U"Do it...")
		SENTENCE (U"After command", U"")
		INTEGER (U"Depth", U"0")
		LABEL (U"", U"Script file:")
		TEXTFIELD (U"Script", U"")
	EDITOR_OK
		if (my name [0])
			SET_STRING (U"Script", my name)
		else
			SET_STRING (U"Script", U"(please save your script first)")
	EDITOR_DO
		praat_addMenuCommandScript (GET_STRING (U"Window"),
			GET_STRING (U"Menu"), GET_STRING (U"Command"), GET_STRING (U"After command"),
			GET_INTEGER (U"Depth"), GET_STRING (U"Script"));
		praat_show ();
	EDITOR_END
}
Beispiel #9
0
Datei: quick.c Projekt: rutsky/mc
int
quick_dialog_skip (quick_dialog_t * quick_dlg, int nskip)
{
    int len;
    int blen = 0;
    int x, y;                   /* current positions */
    int y1 = 0;                 /* bottom of 1st column in case of two columns */
    int y2 = -1;                /* start of two columns */
    int width1 = 0;             /* width of single column */
    int width2 = 0;             /* width of each of two columns */
    gboolean have_groupbox = FALSE;
    gboolean two_columns = FALSE;
    gboolean put_buttons = FALSE;

    /* x position of 1st column is 3 */
    const int x1 = 3;
    /* x position of 2nd column is 4 and it will be fixed later, after creation of all widgets */
    int x2 = 4;

    GArray *widgets;
    size_t i;
    quick_widget_t *quick_widget;
    WGroupbox *g = NULL;
    WDialog *dd;
    int return_val;

    len = str_term_width1 (I18N (quick_dlg->title)) + 6;
    quick_dlg->cols = max (quick_dlg->cols, len);

    y = 1;
    x = x1;

    /* create widgets */
    widgets = g_array_sized_new (FALSE, FALSE, sizeof (quick_widget_item_t), 8);

    for (quick_widget = quick_dlg->widgets; quick_widget->widget_type != quick_end; quick_widget++)
    {
        quick_widget_item_t item = { NULL, quick_widget };
        int width = 0;

        switch (quick_widget->widget_type)
        {
        case quick_checkbox:
            item.widget =
                WIDGET (check_new
                        (++y, x, *quick_widget->u.checkbox.state,
                         I18N (quick_widget->u.checkbox.text)));
            g_array_append_val (widgets, item);
            width = item.widget->cols;
            if (g != NULL)
                width += 2;
            if (two_columns)
                width2 = max (width2, width);
            else
                width1 = max (width1, width);
            break;

        case quick_button:
            /* single button */
            item.widget = WIDGET (button_new (++y, x, quick_widget->u.button.action,
                                              quick_widget->u.button.action == B_ENTER ?
                                              DEFPUSH_BUTTON : NORMAL_BUTTON,
                                              I18N (quick_widget->u.button.text),
                                              quick_widget->u.button.callback));
            g_array_append_val (widgets, item);
            width = item.widget->cols;
            if (g != NULL)
                width += 2;
            if (two_columns)
                width2 = max (width2, width);
            else
                width1 = max (width1, width);
            break;

        case quick_input:
            *quick_widget->u.input.result = NULL;
            y++;
            if (quick_widget->u.input.label_location != input_label_none)
                quick_create_labeled_input (widgets, &y, x, quick_widget, &width);
            else
            {
                item.widget = WIDGET (quick_create_input (y, x, quick_widget));
                g_array_append_val (widgets, item);
                width = item.widget->cols;
            }
            if (g != NULL)
                width += 2;
            if (two_columns)
                width2 = max (width2, width);
            else
                width1 = max (width1, width);
            break;

        case quick_label:
            item.widget = WIDGET (label_new (++y, x, I18N (quick_widget->u.label.text)));
            g_array_append_val (widgets, item);
            y += item.widget->lines - 1;
            width = item.widget->cols;
            if (g != NULL)
                width += 2;
            if (two_columns)
                width2 = max (width2, width);
            else
                width1 = max (width1, width);
            break;

        case quick_radio:
        {
            WRadio *r;
            char **items = NULL;

            /* create the copy of radio_items to avoid mwmory leak */
            items = g_new (char *, quick_widget->u.radio.count + 1);
            for (i = 0; i < (size_t) quick_widget->u.radio.count; i++)
                items[i] = g_strdup (_(quick_widget->u.radio.items[i]));
            items[i] = NULL;

            r = radio_new (++y, x, quick_widget->u.radio.count, (const char **) items);
            r->pos = r->sel = *quick_widget->u.radio.value;
            g_strfreev (items);
            item.widget = WIDGET (r);
            g_array_append_val (widgets, item);
            y += item.widget->lines - 1;
            width = item.widget->cols;
            if (g != NULL)
                width += 2;
            if (two_columns)
                width2 = max (width2, width);
            else
                width1 = max (width1, width);
        }
        break;

        case quick_start_groupbox:
            I18N (quick_widget->u.groupbox.title);
            len = str_term_width1 (quick_widget->u.groupbox.title);
            g = groupbox_new (++y, x, 1, len + 4, quick_widget->u.groupbox.title);
            item.widget = WIDGET (g);
            g_array_append_val (widgets, item);
            have_groupbox = TRUE;
            break;

        case quick_stop_groupbox:
            if (g != NULL)
            {
                Widget *w = WIDGET (g);

                y++;
                w->lines = y + 1 - w->y;
                g = NULL;

                g_array_append_val (widgets, item);
            }
            break;

        case quick_separator:
            y++;
            if (quick_widget->u.separator.line)
            {
                item.widget = WIDGET (hline_new (y, x, 1));
                g_array_append_val (widgets, item);
            }
            break;

        case quick_start_columns:
            y2 = y;
            g_array_append_val (widgets, item);
            two_columns = TRUE;
            break;

        case quick_next_column:
            x = x2;
            y1 = y;
            y = y2;
            break;

        case quick_stop_columns:
            x = x1;
            y = max (y1, y);
            g_array_append_val (widgets, item);
            two_columns = FALSE;
            break;

        case quick_buttons:
            /* start put several buttons in bottom line */
            if (quick_widget->u.separator.space)
            {
                y++;

                if (quick_widget->u.separator.line)
                    item.widget = WIDGET (hline_new (y, 1, -1));
            }

            g_array_append_val (widgets, item);

            /* several buttons in bottom line */
            y++;
            quick_widget++;
            for (; quick_widget->widget_type == quick_button; quick_widget++)
            {
                item.widget = WIDGET (button_new (y, x++, quick_widget->u.button.action,
                                                  quick_widget->u.button.action == B_ENTER ?
                                                  DEFPUSH_BUTTON : NORMAL_BUTTON,
                                                  I18N (quick_widget->u.button.text),
                                                  quick_widget->u.button.callback));
                item.quick_widget = quick_widget;
                g_array_append_val (widgets, item);
                blen += item.widget->cols + 1;
            }

            /* stop dialog build here */
            blen--;
            quick_widget->widget_type = quick_end;
            quick_widget--;
            break;

        default:
            break;
        }
    }

    /* adjust dialog width */
    quick_dlg->cols = max (quick_dlg->cols, blen + 6);
    if (have_groupbox)
    {
        if (width1 != 0)
            width1 += 2;
        if (width2 != 0)
            width2 += 2;
    }
    if (width2 == 0)
        len = width1 + 6;
    else
    {
        len = width2 * 2 + 7;
        if (width1 != 0)
            len = max (len, width1 + 6);
    }

    quick_dlg->cols = max (quick_dlg->cols, len);
    width1 = quick_dlg->cols - 6;
    width2 = (quick_dlg->cols - 7) / 2;

    if (quick_dlg->x == -1 || quick_dlg->y == -1)
        dd = create_dlg (TRUE, 0, 0, y + 3, quick_dlg->cols,
                         dialog_colors, quick_dlg->callback, quick_dlg->mouse, quick_dlg->help,
                         quick_dlg->title, DLG_CENTER | DLG_TRYUP);
    else
        dd = create_dlg (TRUE, quick_dlg->y, quick_dlg->x, y + 3, quick_dlg->cols,
                         dialog_colors, quick_dlg->callback, quick_dlg->mouse, quick_dlg->help,
                         quick_dlg->title, DLG_NONE);

    /* add widgets into the dialog */
    x2 = x1 + width2 + 1;
    g = NULL;
    two_columns = FALSE;
    x = (WIDGET (dd)->cols - blen) / 2;

    for (i = 0; i < widgets->len; i++)
    {
        quick_widget_item_t *item;
        int column_width;

        item = &g_array_index (widgets, quick_widget_item_t, i);
        column_width = two_columns ? width2 : width1;

        /* adjust widget width and x position */
        switch (item->quick_widget->widget_type)
        {
        case quick_label:
        {
            quick_widget_t *input = item->quick_widget->u.label.input;

            if (input != NULL && input->u.input.label_location == input_label_right)
            {
                /* location of this label will be adjusted later */
                break;
            }
        }
        /* fall through */
        case quick_checkbox:
        case quick_radio:
            if (item->widget->x != x1)
                item->widget->x = x2;
            if (g != NULL)
                item->widget->x += 2;
            break;

        case quick_button:
            if (!put_buttons)
            {
                if (item->widget->x != x1)
                    item->widget->x = x2;
                if (g != NULL)
                    item->widget->x += 2;
            }
            else
            {
                item->widget->x = x;
                x += item->widget->cols + 1;
            }
            break;

        case quick_input:
        {
            Widget *label = WIDGET (INPUT (item->widget)->label);
            int width = column_width;

            if (g != NULL)
                width -= 4;

            switch (item->quick_widget->u.input.label_location)
            {
            case input_label_left:
                /* label was adjusted before; adjust input line */
                item->widget->x = label->x + label->cols + 1 - WIDGET (label->owner)->x;
                item->widget->cols = width - label->cols - 1;
                break;

            case input_label_right:
                label->x =
                    item->widget->x + item->widget->cols + 1 - WIDGET (item->widget->owner)->x;
                item->widget->cols = width - label->cols - 1;
                break;

            default:
                if (item->widget->x != x1)
                    item->widget->x = x2;
                if (g != NULL)
                    item->widget->x += 2;
                item->widget->cols = width;
                break;
            }

            /* forced update internal variables of inpuit line */
            input_set_origin (INPUT (item->widget), item->widget->x, item->widget->cols);
        }
        break;

        case quick_start_groupbox:
            g = GROUPBOX (item->widget);
            if (item->widget->x != x1)
                item->widget->x = x2;
            item->widget->cols = column_width;
            break;

        case quick_stop_groupbox:
            g = NULL;
            break;

        case quick_separator:
            if (item->widget != NULL)
            {
                if (g != NULL)
                {
                    Widget *wg = WIDGET (g);

                    HLINE (item->widget)->auto_adjust_cols = FALSE;
                    item->widget->x = wg->x + 1 - WIDGET (wg->owner)->x;
                    item->widget->cols = wg->cols;
                }
                else if (two_columns)
                {
                    HLINE (item->widget)->auto_adjust_cols = FALSE;
                    if (item->widget->x != x1)
                        item->widget->x = x2;
                    item->widget->x--;
                    item->widget->cols = column_width + 2;
                }
                else
                    HLINE (item->widget)->auto_adjust_cols = TRUE;
            }
            break;

        case quick_start_columns:
            two_columns = TRUE;
            break;

        case quick_stop_columns:
            two_columns = FALSE;
            break;

        case quick_buttons:
            /* several buttons in bottom line */
            put_buttons = TRUE;
            break;

        default:
            break;
        }

        if (item->widget != NULL)
        {
            unsigned long id;

            /* add widget into dialog */
            item->widget->options |= item->quick_widget->options;       /* FIXME: cannot reset flags, setup only */
            id = add_widget_autopos (dd, item->widget, item->quick_widget->pos_flags, NULL);
            if (item->quick_widget->id != NULL)
                *item->quick_widget->id = id;
        }
    }

    while (nskip-- != 0)
    {
        dd->current = g_list_next (dd->current);
        if (dd->current == NULL)
            dd->current = dd->widgets;
    }

    return_val = run_dlg (dd);

    /* Get the data if we found something interesting */
    if (return_val != B_CANCEL)
        for (i = 0; i < widgets->len; i++)
        {
            quick_widget_item_t *item;

            item = &g_array_index (widgets, quick_widget_item_t, i);

            switch (item->quick_widget->widget_type)
            {
            case quick_checkbox:
                *item->quick_widget->u.checkbox.state = CHECK (item->widget)->state & C_BOOL;
                break;

            case quick_input:
                if ((quick_widget->u.input.flags & 2) != 0)
                    *item->quick_widget->u.input.result =
                        tilde_expand (INPUT (item->widget)->buffer);
                else
                    *item->quick_widget->u.input.result = g_strdup (INPUT (item->widget)->buffer);
                break;

            case quick_radio:
                *item->quick_widget->u.radio.value = RADIO (item->widget)->sel;
                break;

            default:
                break;
            }
        }

    destroy_dlg (dd);

    /* destroy input labels created before */
    for (i = 0; i < widgets->len; i++)
    {
        quick_widget_item_t *item;

        item = &g_array_index (widgets, quick_widget_item_t, i);
        if (item->quick_widget->widget_type == quick_input)
            g_free (item->quick_widget->u.input.label);
    }

    g_array_free (widgets, TRUE);

    return return_val;
}
Beispiel #10
0
static cb_ret_t
panel_listing_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
{
    WDialog *h = DIALOG (w);

    switch (msg)
    {
    case MSG_KEY:
        if (parm == '\n')
        {
            Widget *wi;

            wi = dlg_find_by_id (h, panel_listing_types_id);
            if (widget_is_active (wi))
            {
                WInput *in;

                in = INPUT (dlg_find_by_id (h, mini_user_format_id));
                input_assign_text (in, status_format[RADIO (wi)->sel]);
                dlg_stop (h);
                return MSG_HANDLED;
            }

            wi = dlg_find_by_id (h, panel_user_format_id);
            if (widget_is_active (wi))
            {
                h->ret_value = B_USER + 6;
                dlg_stop (h);
                return MSG_HANDLED;
            }

            wi = dlg_find_by_id (h, mini_user_format_id);
            if (widget_is_active (wi))
            {
                h->ret_value = B_USER + 7;
                dlg_stop (h);
                return MSG_HANDLED;
            }
        }

        if (g_ascii_tolower (parm) == listing_user_hotkey)
        {
            Widget *wi;

            wi = dlg_find_by_id (h, panel_user_format_id);
            if (widget_is_active (wi))
            {
                wi = dlg_find_by_id (h, mini_user_format_id);
                if (widget_is_active (wi))
                {
                    WRadio *r;

                    r = RADIO (dlg_find_by_id (h, panel_listing_types_id));
                    r->pos = r->sel = panel_listing_user_idx;
                    dlg_select_widget (WIDGET (r));     /* force redraw */
                    send_message (h, r, MSG_ACTION, 0, NULL);
                    return MSG_HANDLED;
                }
            }
        }
        return MSG_NOT_HANDLED;

    case MSG_ACTION:
        if (sender != NULL && sender->id == panel_listing_types_id)
        {
            WCheck *ch;
            WInput *in1, *in2, *in3;

            in1 = INPUT (dlg_find_by_id (h, panel_user_format_id));
            in2 = INPUT (dlg_find_by_id (h, panel_brief_cols_id));
            ch = CHECK (dlg_find_by_id (h, mini_user_status_id));
            in3 = INPUT (dlg_find_by_id (h, mini_user_format_id));

            if (!(ch->state & C_BOOL))
                input_assign_text (in3, status_format[RADIO (sender)->sel]);
            input_update (in1, FALSE);
            input_update (in2, FALSE);
            input_update (in3, FALSE);
            widget_disable (WIDGET (in1), RADIO (sender)->sel != panel_listing_user_idx);
            widget_disable (WIDGET (in2), RADIO (sender)->sel != panel_listing_brief_idx);
            return MSG_HANDLED;
        }

        if (sender != NULL && sender->id == mini_user_status_id)
        {
            WInput *in;

            in = INPUT (dlg_find_by_id (h, mini_user_format_id));

            if (CHECK (sender)->state & C_BOOL)
            {
                widget_disable (WIDGET (in), FALSE);
                input_assign_text (in, status_format[3]);
            }
            else
            {
                WRadio *r;

                r = RADIO (dlg_find_by_id (h, panel_listing_types_id));
                widget_disable (WIDGET (in), TRUE);
                input_assign_text (in, status_format[r->sel]);
            }
            /* input_update (in, FALSE); */
            return MSG_HANDLED;
        }

        return MSG_NOT_HANDLED;

    default:
        return dlg_default_callback (w, sender, msg, parm, data);
    }
}
Beispiel #11
0
Datei: radio.c Projekt: LubkaB/mc
static cb_ret_t
radio_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
{
    WRadio *r = RADIO (w);
    int i;

    switch (msg)
    {
    case MSG_HOTKEY:
        {
            for (i = 0; i < r->count; i++)
            {
                if (r->texts[i].hotkey != NULL)
                {
                    int c = g_ascii_tolower ((gchar) r->texts[i].hotkey[0]);

                    if (c != parm)
                        continue;
                    r->pos = i;

                    /* Take action */
                    send_message (w, sender, MSG_KEY, ' ', data);
                    return MSG_HANDLED;
                }
            }
        }
        return MSG_NOT_HANDLED;

    case MSG_KEY:
        switch (parm)
        {
        case ' ':
            r->sel = r->pos;
            send_message (w->owner, w, MSG_ACTION, 0, NULL);
            send_message (w, sender, MSG_FOCUS, ' ', data);
            return MSG_HANDLED;

        case KEY_UP:
        case KEY_LEFT:
            if (r->pos > 0)
            {
                r->pos--;
                return MSG_HANDLED;
            }
            return MSG_NOT_HANDLED;

        case KEY_DOWN:
        case KEY_RIGHT:
            if (r->count - 1 > r->pos)
            {
                r->pos++;
                return MSG_HANDLED;
            }
        }
        return MSG_NOT_HANDLED;

    case MSG_CURSOR:
        send_message (w->owner, w, MSG_ACTION, 0, NULL);
        send_message (w, sender, MSG_FOCUS, ' ', data);
        widget_move (r, r->pos, 1);
        return MSG_HANDLED;

    case MSG_UNFOCUS:
    case MSG_FOCUS:
    case MSG_DRAW:
        for (i = 0; i < r->count; i++)
        {
            const gboolean focused = (i == r->pos && msg == MSG_FOCUS);

            widget_selectcolor (w, focused, FALSE);
            widget_move (r, i, 0);
            tty_draw_hline (w->y + i, w->x, ' ', w->cols);
            tty_print_string ((r->sel == i) ? "(*) " : "( ) ");
            hotkey_draw (w, r->texts[i], focused);
        }
        return MSG_HANDLED;

    case MSG_DESTROY:
        for (i = 0; i < r->count; i++)
            release_hotkey (r->texts[i]);
        g_free (r->texts);
        return MSG_HANDLED;

    default:
        return widget_default_callback (w, sender, msg, parm, data);
    }
}
static Evas_Object *
_basic_create_widgets(E_Config_Dialog      *cfd,
                      Evas                 *evas,
                      E_Config_Dialog_Data *cfdata)
{
   Evas_Object *o, *ob, *of, *osf, *ossf, *ot;
   E_Radio_Group *rg;
   E_Container *con = e_container_current_get(e_manager_current_get());
   E_Zone *zone;
   Eina_List *l;

   o = e_widget_list_add(evas, 0, 0);
   ot = e_widget_table_add(evas, 0);

   {  /* General settings */
      of = e_widget_framelist_add(evas, D_("General"), 0);
      FRAME_ADD(of, CHECK("Enable tiling", cfdata->tiling_enabled));
      FRAME_ADD(of, CHECK("Don't change window borders", cfdata->dont_touch_borders));
      FRAME_ADD(of, CHECK("Tile dialog windows aswell", cfdata->tile_dialogs));
      FRAME_ADD(of, CHECK("Set too big windows floating automatically", cfdata->float_too_big_windows));
      osf = e_widget_list_add(evas, 0, 0);
      ob = CHECK("Leave space between windows:", cfdata->space_between);
      e_widget_on_change_hook_set(ob, _cb_leave_space_change, cfdata);
      FRAME_ADD(of, ob);
      ossf = e_widget_list_add(evas, 0, 1);
      LIST_ADD(ossf, e_widget_label_add(evas, D_("Horizontal:")));
      LIST_ADD(ossf, e_widget_slider_add(evas, 1, 0, D_("%1.0f px"), 0.0, 50.0, 1.0, 0, NULL, &(cfdata->between_x), 200));
      LIST_ADD(osf, ossf);
      ossf = e_widget_list_add(evas, 0, 1);
      LIST_ADD(ossf, e_widget_label_add(evas, D_("Vertical:")));
      LIST_ADD(ossf, e_widget_slider_add(evas, 1, 0, D_("%1.0f px"), 0.0, 50.0, 1.0, 0, NULL, &(cfdata->between_y), 200));
      LIST_ADD(osf, ossf);
      cfdata->o_space_between = osf;
      recursively_set_disabled(osf, !cfdata->space_between);
      FRAME_ADD(of, osf);
      e_widget_table_object_append(ot, of, 0, 0, 1, 2, 1, 1, 1, 1);
   }

   {  /* Virtual desktop settings */
      of = e_widget_framelist_add(evas, D_("Virtual Desktops"), 0);
      rg = e_widget_radio_group_new(&(cfdata->tiling_mode));
      FRAME_ADD(of, RADIO("Don't tile by default", TILE_NONE, rg));
      FRAME_ADD(of, RADIO("Bigmain: Main window left, small windows right", TILE_BIGMAIN, rg));
      FRAME_ADD(of, RADIO("Grid: Distribute windows equally", TILE_GRID, rg));
      FRAME_ADD(of, RADIO("Individual modes:", TILE_INDIVIDUAL, rg));

      osf = e_widget_list_add(evas, 0, 1);

      {   /* Zone list */
         ILIST(100, 100);
         cfdata->o_zonelist = ob;
         e_widget_on_change_hook_set(ob, _cb_zone_change, cfdata);
         for (l = con->zones; l; l = l->next)
           {
              if (!(zone = l->data)) continue;
              e_widget_ilist_append(ob, NULL, zone->name, NULL, zone, NULL);
           }
         ILIST_GO(0);
         LIST_ADD(osf, ob);
      }

      {   /* List of individual tiling modes */
          /* Order is important here: Firstly create the list, then add it to the
           * scrollframe before any objects get added to the list */
           cfdata->o_desklist = e_widget_list_add(evas, 1, 0);
           cfdata->o_deskscroll = e_widget_scrollframe_simple_add(evas, cfdata->o_desklist);
           cfdata->evas = evas;

           _fill_zone_config(con->zones->data, cfdata);

           LIST_ADD(osf, cfdata->o_deskscroll);
      }
      FRAME_ADD(of, osf);
      e_widget_table_object_append(ot, of, 0, 2, 1, 1, 1, 1, 1, 1);
   }

   {  /* Grid mode settings */
      of = e_widget_framelist_add(evas, D_("Grid mode settings"), 0);
      rg = e_widget_radio_group_new(&(cfdata->grid_distribute_equally));
      FRAME_ADD(of, RADIO("Distribute space equally", 1, rg));
      FRAME_ADD(of, RADIO("Use this number of rows:", 0, rg));
      FRAME_ADD(of, e_widget_slider_add(evas, 1, 0, D_("%1.0f"), 1.0, 12.0, 1.0, 0, NULL, &(cfdata->grid_rows), 100));
      e_widget_table_object_append(ot, of, 1, 0, 1, 1, 1, 1, 1, 1);
   }

   {  /* Bigmain settings */
      of = e_widget_framelist_add(evas, D_("Bigmain settings"), 0);
      FRAME_ADD(of, e_widget_label_add(evas, D_("Big win takes percent of screen:")));
      FRAME_ADD(of, e_widget_slider_add(evas, 1, 0, D_("%.2f"), 0.1, 1.0, 0.01, 0, &(cfdata->big_perc), NULL, 100));
      e_widget_table_object_append(ot, of, 1, 1, 1, 1, 1, 1, 1, 1);
   }

   {  /* Tiling mode border style */
      osf = e_widget_list_add(evas, 0, 0);
      of = e_widget_framelist_add(evas, D_("Tiling border"), 0);
      ILIST(100, 75);
      e_widget_on_change_hook_set(ob, _cb_tiling_border_change, cfdata);
      int sel = -1, c = 0;
      for (l = e_theme_border_list(); l; l = l->next, c++)
        {
           e_widget_ilist_append(ob, NULL, l->data, NULL, NULL, NULL);
           if (cfdata->tiling_border && !strcmp(l->data, cfdata->tiling_border))
             sel = c;
        }
      ILIST_GO(sel);
      FRAME_ADD(of, ob);
      LIST_ADD(osf, of);

      of = e_widget_framelist_add(evas, D_("Floating border"), 0);
      ILIST(100, 75);
      e_widget_on_change_hook_set(ob, _cb_floating_border_change, cfdata);
      for (sel = -1, c = 0, l = e_theme_border_list(); l; l = l->next, c++)
        {
           e_widget_ilist_append(ob, NULL, l->data, NULL, NULL, NULL);
           if (cfdata->floating_border && !strcmp(l->data, cfdata->floating_border))
             sel = c;
        }
      ILIST_GO(sel);
      FRAME_ADD(of, ob);
      LIST_ADD(osf, of);
   }
   e_widget_table_object_append(ot, osf, 1, 2, 1, 1, 1, 1, 1, 1);
   LIST_ADD(o, ot);

   return o;
}