Re: API for putting close buttons on tabs (proposal)



> What do you think about this?

I think this is mostly going too far.

It is attractive to let the notebook provide close buttons,
which leads to consistency. And of course also less dublicated code.
That's why I particularly like an api that merely toggles such buttons
on tabs.

> /* Globally show|hide action areas on tabs */
> void     gtk_notebook_set_show_action_areas (GtkNotebook *notebook, 
> gboolean show);
> gboolean gtk_notebook_get_show_action_areas (GtkNotebook *notebook);
> 
> /* Show|hide action area for a tab */
> void     gtk_notebook_set_show_action_area (GtkNotebook *notebook, 
> gboolean show, gint at_position);
> gboolean gtk_notebook_get_show_action_area (GtkNotebook *notebook,
> gint at_position);

These are redundant. If we decide for embedding arbitrary widgets in
tabs, it's totally sufficient that whatever widget was provided by the
application can be hidden or shown. The notebook wouldn't do anything
else.

> /* Predefined action area types */
> typedef enum
> {
>      GTK_NOTEBOOK_ACTION_AREA_CLOSE
>      /* other types */
> } GtkNotebookActionAreaType;
> 
> /* Set|get action area content for a tab by type */
> void gtk_notebook_set_action_area_type (GtkNotebook *notebook, 
> GtkNotebookActionAreaType type, gint at_position);

However regarding ActionAreaType, I'm not sure what other types you
have in mind but I don't think that's very helpful. That makes only the
API rather complex for a rather limited use case.
If you have particular ideas in mind that are particularly suffering
from the problems you have with custom close buttons, go ahead. But
generalizing this doesn't seem worth the effort.

ciao,
    Christian


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]