Exemple #1
0
void
widget_redraw (Widget * w)
{
    if (w != NULL)
    {
        WDialog *h = w->owner;

        if (h != NULL && widget_get_state (WIDGET (h), WST_ACTIVE))
            w->callback (w, NULL, MSG_DRAW, 0, NULL);
    }
}
Exemple #2
0
/**
 * Put widget on top or bottom of Z-order.
 */
static void
widget_reorder (GList * l, gboolean set_top)
{
    WDialog *h = WIDGET (l->data)->owner;

    h->widgets = g_list_remove_link (h->widgets, l);
    if (set_top)
        h->widgets = g_list_concat (h->widgets, l);
    else
        h->widgets = g_list_concat (l, h->widgets);
}
Exemple #3
0
void
widget_set_size (Widget * widget, int y, int x, int lines, int cols)
{
    widget->x = x;
    widget->y = y;
    widget->cols = cols;
    widget->lines = lines;
    send_message (widget, NULL, MSG_RESIZE, 0, NULL);
    if (widget->owner != NULL && widget_get_state (WIDGET (widget->owner), WST_ACTIVE))
        send_message (widget, NULL, MSG_DRAW, 0, NULL);
}
Exemple #4
0
void scrollbar_set_range( object_t *w, int min, int max )
{
	scrollbar_widget_t *sb = (scrollbar_widget_t *)w;
	
	assert_valid_scrollbar_widget( w, "w" );
	
	sb->min = min;
	sb->max = max;
	
	cgraphics_scrollbar_set_range( WIDGET(w) );
}
Exemple #5
0
void cgraphics_workspace_window_widget_create( widget_t *widget )
{
	widget_t *parent = WIDGET(OBJECT(widget)->parent);
		
	widget->native = gtk_layout_new( NULL, NULL );
		
	cgraphics_widget_create( widget );
    
    gtk_notebook_set_tab_reorderable(GTK_NOTEBOOK(parent->native), GTK_WIDGET(widget->native), TRUE);
	gtk_notebook_set_tab_detachable(GTK_NOTEBOOK(parent->native), GTK_WIDGET(widget->native), TRUE);
}
void
contact_list_editor_cancel_button_clicked_cb (GtkWidget *widget)
{
	EContactListEditor *editor;
	GtkWindow *window;

	editor = contact_list_editor_extract (widget);
	window = GTK_WINDOW (WIDGET (DIALOG));

	eab_editor_prompt_to_save_changes (EAB_EDITOR (editor), window);
}
Exemple #7
0
Fichier : menu.c Projet : iNode/mc
void
menubar_add_menu (WMenuBar * menubar, menu_t * menu)
{
    if (menu != NULL)
    {
        menu_arrange (menu, WIDGET (menubar)->owner->get_shortcut);
        menubar->menu = g_list_append (menubar->menu, menu);
    }

    menubar_arrange (menubar);
}
Exemple #8
0
static void
edit_reload_syntax (void *data, void *user_data)
{
    (void) user_data;

    if (edit_widget_is_editor (WIDGET (data)))
    {
        WEdit *edit = (WEdit *) data;
        edit_load_syntax (edit, NULL, edit->syntax_type);
    }
}
Exemple #9
0
void buttonInit(button *self, const char *id, int w, int h)
{
	// Buttons need to be redrawn when the following events fire
	int i, handlers[] = {
	    EVT_ENABLE,
	    EVT_DISABLE,
	    EVT_MOUSE_ENTER,
	    EVT_MOUSE_LEAVE,
	    EVT_MOUSE_DOWN,
	    EVT_MOUSE_UP
	};

	// Init our parent
	widgetInit((widget *)self, id);

	// Prepare our vtable
	buttonInitVtbl(self);

	// Set our type
	((widget *)self)->classInfo = &buttonClassInfo;

	// initialise button state
	self->state = BUTTON_STATE_NORMAL;

	// Mask for exact mouse events
	widgetEnableMask(WIDGET(self));

	// Install necessary event handlers
	for (i = 0; i < sizeof(handlers) / sizeof(int); i++)
	{
		widgetAddEventHandler(WIDGET(self), handlers[i],
		                      buttonSetButtonStateHandler, NULL, NULL);
	}

	buttonSetPatternsForState(self, BUTTON_STATE_NORMAL, "button/normal/fill", "button/normal/contour");
	buttonSetPatternsForState(self, BUTTON_STATE_DISABLED, "button/disabled/fill", "button/disabled/contour");
	buttonSetPatternsForState(self, BUTTON_STATE_MOUSEOVER, "button/mouseover/fill", "button/mouseover/contour");
	buttonSetPatternsForState(self, BUTTON_STATE_MOUSEDOWN, "button/mousedown/fill", "button/mousedown/contour");

	widgetResize(WIDGET(self), w, h);
}
Exemple #10
0
static void
widget_focus (Widget * w)
{
    WDialog *h = DIALOG (w->owner);

    if (h == NULL)
        return;

    if (WIDGET (h->current->data) != w)
    {
        widget_do_focus (WIDGET (h->current->data), FALSE);
        /* Test if focus lost was allowed and focus has really been loose */
        if (h->current == NULL || !widget_get_state (WIDGET (h->current->data), WST_FOCUSED))
        {
            widget_do_focus (w, TRUE);
            h->current = dlg_find (h, w);
        }
    }
    else if (!widget_get_state (w, WST_FOCUSED))
        widget_do_focus (w, TRUE);
}
Exemple #11
0
Fichier : lib.c Projet : iNode/mc
void
mcview_toggle_hex_mode (mcview_t * view)
{
    view->hex_mode = !view->hex_mode;

    if (view->hex_mode)
    {
        view->hex_cursor = view->dpy_start;
        view->dpy_start = mcview_offset_rounddown (view->dpy_start, view->bytes_per_line);
        widget_want_cursor (WIDGET (view), TRUE);
    }
    else
    {
        view->dpy_start = mcview_bol (view, view->hex_cursor, 0);
        view->hex_cursor = view->dpy_start;
        widget_want_cursor (WIDGET (view), FALSE);
    }
    mcview_altered_hex_mode = 1;
    view->dpy_bbar_dirty = TRUE;
    view->dirty++;
}
Exemple #12
0
void
hline_set_text (WHLine * l, const char *text)
{
    g_free (l->text);

    if (text == NULL || *text == '\0')
        l->text = NULL;
    else
        l->text = g_strdup (text);

    widget_redraw (WIDGET (l));
}
Exemple #13
0
void box_add ( box *box, widget *child, gboolean expand )
{
    if ( box == NULL ) {
        return;
    }
    // Make sure box is width/heigh enough.
    if ( box->type == ROFI_ORIENTATION_VERTICAL ) {
        int width = box->widget.w;
        width         = MAX ( width, child->w + widget_padding_get_padding_width ( WIDGET ( box ) ) );
        box->widget.w = width;
    }
    else {
        int height = box->widget.h;
        height        = MAX ( height, child->h + widget_padding_get_padding_height ( WIDGET ( box ) ) );
        box->widget.h = height;
    }
    child->expand = rofi_theme_get_boolean ( child, "expand", expand );
    g_assert ( child->parent == WIDGET ( box ) );
    box->children = g_list_append ( box->children, (void *) child );
    widget_update ( WIDGET ( box ) );
}
Exemple #14
0
/* Selects the last entry and scrolls the list to the bottom */
void
listbox_select_last (WListbox * l)
{
    int lines = WIDGET (l)->lines;
    int length = 0;

    if (!listbox_is_empty (l))
        length = g_queue_get_length (l->list);

    l->pos = length > 0 ? length - 1 : 0;
    l->top = length > lines ? length - lines : 0;
}
Exemple #15
0
static void
PollWidgets(AG_Event *event)
{
	AG_Tlist *tl = AG_SELF();
	AG_Driver *drv = WIDGET(tl)->drv;
	AG_Window *win;

	AG_TlistClear(tl);
	AG_LockVFS(drv);
	AG_FOREACH_WINDOW_REVERSE(win, drv) {
		FindWindows(tl, win, 0);
	}
Exemple #16
0
void
edit_update_screen (WEdit * e)
{
    WDialog *h = WIDGET (e)->owner;

    edit_scroll_screen_over_cursor (e);
    edit_update_curs_col (e);
    edit_status (e, widget_get_state (WIDGET (e), WST_FOCUSED));

    /* pop all events for this window for internal handling */
    if (!is_idle ())
        e->force |= REDRAW_PAGE;
    else
    {
        if ((e->force & REDRAW_COMPLETELY) != 0)
            e->force |= REDRAW_PAGE;
        edit_render_keypress (e);
    }

    widget_redraw (WIDGET (find_buttonbar (h)));
}
Exemple #17
0
static void listview_nav_down_int ( listview *lv )
{
    if ( lv == NULL ) {
        return;
    }
    if ( lv->req_elements == 0 || ( lv->selected == ( lv->req_elements - 1 ) && !lv->cycle ) ) {
        return;
    }
    lv->selected = lv->selected < lv->req_elements - 1 ? MIN ( lv->req_elements - 1, lv->selected + 1 ) : 0;

    widget_queue_redraw ( WIDGET ( lv ) );
}
Exemple #18
0
void
gauge_set_value (WGauge * g, int max, int current)
{
    if (g->current == current && g->max == max)
        return;                 /* Do not flicker */

    if (max == 0)
        max = 1;                /* I do not like division by zero :) */
    g->current = current;
    g->max = max;
    widget_redraw (WIDGET (g));
}
Exemple #19
0
void
setup_cmdline (void)
{
    int prompt_len;
    int y;
    char *tmp_prompt = (char *) mc_prompt;

#ifdef ENABLE_SUBSHELL
    if (mc_global.tty.use_subshell)
    {
        tmp_prompt = g_string_free (subshell_prompt, FALSE);
        (void) strip_ctrl_codes (tmp_prompt);
    }
#endif

    prompt_len = str_term_width1 (tmp_prompt);

    /* Check for prompts too big */
    if (COLS > 8 && prompt_len > COLS - 8)
    {
        prompt_len = COLS - 8;
        tmp_prompt[prompt_len] = '\0';
    }

#ifdef ENABLE_SUBSHELL
    if (mc_global.tty.use_subshell)
    {
        subshell_prompt = g_string_new (tmp_prompt);
        g_free (tmp_prompt);
        mc_prompt = subshell_prompt->str;
    }
#endif

    y = LINES - 1 - mc_global.keybar_visible;

    widget_set_size (WIDGET (the_prompt), y, 0, 1, prompt_len);
    label_set_text (the_prompt, mc_prompt);
    widget_set_size (WIDGET (cmdline), y, prompt_len, 1, COLS - prompt_len);
    input_set_origin (cmdline, prompt_len, COLS - prompt_len);
}
Exemple #20
0
static void
do_select_widget (WDialog * h, GList * w, select_dir_t dir)
{
    Widget *w0 = WIDGET (h->current->data);

    if (!dlg_unfocus (h))
        return;

    h->current = w;

    do
    {
        if (dlg_focus (h))
            break;

        switch (dir)
        {
        case SELECT_EXACT:
            h->current = g_list_find (h->widgets, w0);
            if (dlg_focus (h))
                return;
            /* try find another widget that can take focus */
            dir = SELECT_NEXT;
            /* fallthrough */
        case SELECT_NEXT:
            h->current = dlg_widget_next (h, h->current);
            break;
        case SELECT_PREV:
            h->current = dlg_widget_prev (h, h->current);
            break;
        }
    }
    while (h->current != w /* && (WIDGET (h->current->data)->options & W_DISABLED) == 0 */ );

    if (widget_overlapped (w0, WIDGET (h->current->data)))
    {
        send_message (h->current->data, NULL, MSG_DRAW, 0, NULL);
        send_message (h->current->data, NULL, MSG_FOCUS, 0, NULL);
    }
}
Exemple #21
0
static gboolean listview_clicked ( widget *wid, xcb_button_press_event_t *xce, G_GNUC_UNUSED void *udata )
{
    listview *lv = (listview *) wid;
    lv->scrollbar_scroll = FALSE;
    if ( widget_enabled ( WIDGET ( lv->scrollbar ) ) && widget_intersect ( WIDGET ( lv->scrollbar ), xce->event_x, xce->event_y ) ) {
        // Forward to handler of scrollbar.
        xcb_button_press_event_t xce2 = *xce;
        xce->event_x        -= widget_get_x_pos ( WIDGET ( lv->scrollbar ) );
        xce->event_y        -= widget_get_y_pos ( WIDGET ( lv->scrollbar ) );
        lv->scrollbar_scroll = TRUE;
        return widget_clicked ( WIDGET ( lv->scrollbar ), &xce2 );
    }
    // Handle the boxes.
    unsigned int max = MIN ( lv->cur_elements, lv->req_elements - lv->last_offset );
    for ( unsigned int i = 0; i < max; i++ ) {
        widget *w = WIDGET ( lv->boxes[i] );
        if ( widget_intersect ( w, xce->event_x, xce->event_y ) ) {
            if ( ( lv->last_offset + i ) == lv->selected ) {
                if ( ( xce->time - lv->last_click ) < 200 ) {
                    // Somehow signal we accepted item.
                    lv->mouse_activated ( lv, xce, lv->mouse_activated_data );
                }
            }
            else {
                listview_set_selected ( lv, lv->last_offset + i );
            }
            lv->last_click = xce->time;
            return TRUE;
        }
    }
    return FALSE;
}
Exemple #22
0
/*
** Pad the requested row from the current width to 'newWidth' with spaces...
*/
void
_DtTermPrimBufferPadLineWc
(
    const TermBuffer  tb,
    const short       row,
    const short       width
)
{
    short       i;
    short       widthInc;
    TermLine    line;
    wchar_t    *pwc;
    
    line = LINE_OF_TBUF(tb, row);

    if (isDebugFSet('i', 1)) {
#ifdef	BBA
#pragma BBA_IGNORE
#endif	/*BBA*/
	(void) _termBufferValidateLineWc(tb, row);
    }

    /*
    ** if this line is part of the selection, disown the selection...
    */
    if (IS_IN_SELECTION(line, MIN(width, WIDTH(line)),
			MAX(width, WIDTH(line))))
    {
	(void) _DtTermPrimSelectDisown(WIDGET(tb));
    }

    widthInc = MIN(COLS(tb), width) - WIDTH(line);

    for (i = 0, pwc = (wchar_t *)BUFFER(line) + MAX(0, LENGTH(line));
         i < widthInc;
         i++, pwc++)
    {
        *pwc = L' ';
	LENGTH(line)++;
    }
    if (CLEAR_ENH(tb))
    {
        (*CLEAR_ENH(tb))(tb, row, WIDTH(line), widthInc);
    }
    _DtTermPrimBufferSetLineWidth(tb, row, WIDTH(line) + widthInc);
    if (isDebugFSet('i', 1)) {
#ifdef	BBA
#pragma BBA_IGNORE
#endif	/*BBA*/
	_termBufferValidateLineWc(tb, row);
    }
}
Exemple #23
0
static void
menubar_finish (WMenuBar * menubar)
{
    Widget *w = WIDGET (menubar);

    menubar->is_dropped = FALSE;
    menubar->is_active = FALSE;
    w->lines = 1;
    widget_want_hotkey (w, 0);

    dlg_select_by_id (w->owner, menubar->previous_widget);
    do_refresh ();
}
Exemple #24
0
static void
MouseButtonUp(AG_Event *event)
{
	AG_Titlebar *tbar = AG_SELF();
	AG_DriverSw *dsw = (AG_DriverSw *)WIDGET(tbar)->drv;
	
	tbar->pressed = 0;
	
	if (AGDRIVER_SINGLE(dsw)) {
		dsw->winop = AG_WINOP_NONE;
		dsw->winSelected = NULL;
	}
}
Exemple #25
0
/** Real view only */
static int
mcview_event (Gpm_Event * event, void *data)
{
    mcview_t *view = (mcview_t *) data;
    int result;

    if (!mouse_global_in_widget (event, WIDGET (data)))
        return MOU_UNHANDLED;

    if (do_mcview_event (view, event, &result))
        mcview_update (view);
    return result;
}
Exemple #26
0
/**
 * Draws the button's shape and background using the delivered patterns.
 *
 * @param self The button object which will be drawn.
 * @param fillPattern The pattern to fill its shape.
 * @param contourPattern The pattern to outline its shape.
 */
static void buttonDrawFinally(button *self, pattern *fillPattern, pattern *contourPattern)
{
	// Get drawing context
	cairo_t *cr = WIDGET(self)->cr;

	assert(self != NULL);
	assert(fillPattern != NULL);
	assert(contourPattern != NULL);

	// Do the rounded rectangle path
	buttonDoButtonPath(self, cr);

	// Select normal state fill gradient
	patternManagerSetAsSource(cr, fillPattern, WIDGET(self)->size.x, WIDGET(self)->size.y);
	// Fill the path, preserving the path
	cairo_fill_preserve(cr);

	// Select normal state contour gradient
	patternManagerSetAsSource(cr, contourPattern, WIDGET(self)->size.x, WIDGET(self)->size.y);
	// Finally stroke the path
	cairo_stroke(cr);
}
void
contact_list_editor_email_entry_changed_cb (GtkWidget *widget)
{
	EContactListEditor *editor;
	const gchar *text;
	gboolean sensitive;

	editor = contact_list_editor_extract (widget);
	text = gtk_entry_get_text (GTK_ENTRY (widget));

	sensitive = (text != NULL && *text != '\0');
	gtk_widget_set_sensitive (WIDGET (ADD_BUTTON), sensitive);
}
Exemple #28
0
static void listview_nav_page_prev_int ( listview *lv )
{
    if ( lv == NULL ) {
        return;
    }
    if ( lv->selected < lv->max_elements ) {
        lv->selected = 0;
    }
    else{
        lv->selected -= ( lv->max_elements );
    }
    widget_queue_redraw ( WIDGET ( lv ) );
}
Exemple #29
0
void treeview_remove_row_handle( object_t *obj, event_t *event )
{
	treeview_widget_t *lw = (treeview_widget_t *)obj;
	list_item_t *item = (list_item_t *)event_get_arg_ptr( event, 0 );
	
	if ( lw->selected == item )
	{
		lw->selected = 0;
		event_send( OBJECT(lw), "selected", "p", 0 );
	}
	
	cgraphics_treeview_remove_row( WIDGET(obj), item );
}
const char *HistStretchGraph_vtoString(const void *vthis) {
	static char str_id[160];
	const HistStretchGraph *this = HIST_STRETCH_GRAPH(this);
	snprintf(str_id, sizeof(str_id), "HistStretchGraph: (x,y,w,h,maxx,maxy)=[%hu,%hu,%hu,%hu,%hu,%hu], (ax,ay)=[%hu,%hu], (tw,th)=[%hu,%hu], size=%hu",
		WIDGET(this)->pos.x, WIDGET(this)->pos.y, WIDGET(this)->pos.w, WIDGET(this)->pos.h, WIDGET(this)->maxx, WIDGET(this)->maxy, 
		this->ax, this->ay, WIDGET(&this->labelX)->pos.w, WIDGET(&this->labelX)->pos.h, this->size);
	return str_id;
}