iconbox: remove
This can be replaced by textbox. Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
d9be65bb1b
commit
68f0eda193
|
@ -74,7 +74,6 @@ set(AWE_SRCS
|
|||
${SOURCE_DIR}/layouts/max.c
|
||||
${SOURCE_DIR}/layouts/tile.c
|
||||
${SOURCE_DIR}/widgets/graph.c
|
||||
${SOURCE_DIR}/widgets/iconbox.c
|
||||
${SOURCE_DIR}/widgets/progressbar.c
|
||||
${SOURCE_DIR}/widgets/taglist.c
|
||||
${SOURCE_DIR}/widgets/tasklist.c
|
||||
|
|
|
@ -41,7 +41,6 @@ WIDGETS
|
|||
-------
|
||||
The current list of available widget is:
|
||||
|
||||
- iconbox
|
||||
- graph
|
||||
- progressbar
|
||||
- taglist
|
||||
|
@ -52,14 +51,6 @@ The current list of available widget is:
|
|||
Each widget as its own set of properties, described below, that can bet modified with the set()
|
||||
method.
|
||||
|
||||
ICONBOX
|
||||
~~~~~~~
|
||||
*image*::
|
||||
The image path.
|
||||
|
||||
*resize*::
|
||||
True if you want the image to be auto-resized.
|
||||
|
||||
PROGRESSBAR
|
||||
~~~~~~~~~~~
|
||||
A progressbar widget can contain several bars, so some properties need a data section,
|
||||
|
|
|
@ -100,8 +100,8 @@ mytextbox:set("text", "<b><small> awesome " .. AWESOME_VERSION .. " </small></b>
|
|||
mypromptbox = widget.new({ type = "textbox", name = "mypromptbox", align = "left" })
|
||||
|
||||
-- Create an iconbox widget
|
||||
myiconbox = widget.new({ type = "iconbox", name = "myiconbox", align = "left" })
|
||||
myiconbox:set("image", "@AWESOME_ICON_PATH@/awesome16.png")
|
||||
myiconbox = widget.new({ type = "textbox", name = "myiconbox", align = "left" })
|
||||
myiconbox:set("text", "<bg image=\"@AWESOME_ICON_PATH@/awesome16.png\" resize=\"true\"/>")
|
||||
|
||||
-- Create a systray
|
||||
mysystray = widget.new({ type = "systray", name = "mysystray", align = "right" })
|
||||
|
@ -110,12 +110,12 @@ mysystray = widget.new({ type = "systray", name = "mysystray", align = "right" }
|
|||
-- We need one layoutbox per screen.
|
||||
mylayoutbox = {}
|
||||
for s = 1, screen.count() do
|
||||
mylayoutbox[s] = widget.new({ type = "iconbox", name = "mylayoutbox", align = "right" })
|
||||
mylayoutbox[s] = widget.new({ type = "textbox", name = "mylayoutbox", align = "right" })
|
||||
mylayoutbox[s]:mouse_add(mouse.new({ }, 1, function () awful.layout.inc(layouts, 1) end))
|
||||
mylayoutbox[s]:mouse_add(mouse.new({ }, 3, function () awful.layout.inc(layouts, -1) end))
|
||||
mylayoutbox[s]:mouse_add(mouse.new({ }, 4, function () awful.layout.inc(layouts, 1) end))
|
||||
mylayoutbox[s]:mouse_add(mouse.new({ }, 5, function () awful.layout.inc(layouts, -1) end))
|
||||
mylayoutbox[s]:set("image", "@AWESOME_ICON_PATH@/layouts/tilew.png")
|
||||
mylayoutbox[s]:set("text", "<bg image=\"@AWESOME_ICON_PATH@/layouts/tilew.png\" resize=\"true\"/>")
|
||||
end
|
||||
|
||||
-- Create a statusbar for each screen and add it
|
||||
|
@ -334,7 +334,7 @@ end
|
|||
-- (tag switch, new client, etc)
|
||||
function hook_arrange(screen)
|
||||
local layout = awful.layout.get(screen)
|
||||
mylayoutbox[screen]:set("image", "@AWESOME_ICON_PATH@/layouts/" .. layout .. "w.png")
|
||||
mylayoutbox[screen]:set("text", "<bg image=\"@AWESOME_ICON_PATH@/layouts/" .. layout .. "w.png\" resize=\"true\"/>")
|
||||
|
||||
-- Uncomment if you want mouse warping
|
||||
--[[
|
||||
|
|
|
@ -1040,6 +1040,12 @@ draw_text_extents(xcb_connection_t *conn, int phys_screen, font_t *font,
|
|||
geom.width = ext.width;
|
||||
geom.height = ext.height * 1.5;
|
||||
|
||||
if(parser_data->bg_image)
|
||||
{
|
||||
geom.width = MAX(geom.width, parser_data->bg_image->width);
|
||||
geom.height = MAX(geom.height, parser_data->bg_image->height);
|
||||
}
|
||||
|
||||
return geom;
|
||||
}
|
||||
|
||||
|
|
1
widget.h
1
widget.h
|
@ -41,7 +41,6 @@ int luaA_widget_userdata_new(lua_State *, widget_t *);
|
|||
|
||||
widget_constructor_t taglist_new;
|
||||
widget_constructor_t textbox_new;
|
||||
widget_constructor_t iconbox_new;
|
||||
widget_constructor_t progressbar_new;
|
||||
widget_constructor_t graph_new;
|
||||
widget_constructor_t tasklist_new;
|
||||
|
|
|
@ -1,119 +0,0 @@
|
|||
/*
|
||||
* iconbox.c - icon widget
|
||||
*
|
||||
* Copyright © 2007-2008 Julien Danjou <julien@danjou.info>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "widget.h"
|
||||
#include "common/util.h"
|
||||
#include "common/tokenize.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
draw_image_t *image;
|
||||
bool resize;
|
||||
} iconbox_data_t;
|
||||
|
||||
static int
|
||||
iconbox_draw(draw_context_t *ctx, int screen __attribute__ ((unused)),
|
||||
widget_node_t *w,
|
||||
int offset,
|
||||
int used __attribute__ ((unused)),
|
||||
void *p __attribute__ ((unused)))
|
||||
{
|
||||
iconbox_data_t *d = w->widget->data;
|
||||
draw_image_t *image = d->image;
|
||||
|
||||
/* image not valid */
|
||||
if(!image)
|
||||
return (w->area.width = 0);
|
||||
|
||||
if(d->resize)
|
||||
w->area.width = ((double) ctx->height / image->height) * image->width;
|
||||
else
|
||||
w->area.width = image->width;
|
||||
|
||||
if(w->area.width > ctx->width - used)
|
||||
return (w->area.width = 0);
|
||||
|
||||
w->area.height = ctx->height;
|
||||
|
||||
w->area.x = widget_calculate_offset(ctx->width,
|
||||
w->area.width,
|
||||
offset,
|
||||
w->widget->align);
|
||||
|
||||
w->area.y = 0;
|
||||
|
||||
draw_image(ctx, w->area.x, w->area.y,
|
||||
d->resize ? ctx->height : 0, image);
|
||||
|
||||
return w->area.width;
|
||||
}
|
||||
|
||||
static widget_tell_status_t
|
||||
iconbox_tell(widget_t *widget, const char *property, const char *new_value)
|
||||
{
|
||||
iconbox_data_t *d = widget->data;
|
||||
|
||||
if(!new_value)
|
||||
return WIDGET_ERROR_NOVALUE;
|
||||
|
||||
switch(a_tokenize(property, -1))
|
||||
{
|
||||
case A_TK_IMAGE:
|
||||
draw_image_delete(&d->image);
|
||||
d->image = draw_image_new(new_value);
|
||||
break;
|
||||
case A_TK_RESIZE:
|
||||
d->resize = a_strtobool(new_value, -1);
|
||||
break;
|
||||
default:
|
||||
return WIDGET_ERROR;
|
||||
}
|
||||
|
||||
return WIDGET_NOERROR;
|
||||
}
|
||||
|
||||
static void
|
||||
iconbox_destructor(widget_t *widget)
|
||||
{
|
||||
iconbox_data_t *d = widget->data;
|
||||
|
||||
draw_image_delete(&d->image);
|
||||
p_delete(&d);
|
||||
}
|
||||
|
||||
widget_t *
|
||||
iconbox_new(alignment_t align)
|
||||
{
|
||||
widget_t *w;
|
||||
iconbox_data_t *d;
|
||||
|
||||
w = p_new(widget_t, 1);
|
||||
widget_common_new(w);
|
||||
w->align = align;
|
||||
w->draw = iconbox_draw;
|
||||
w->tell = iconbox_tell;
|
||||
w->destructor = iconbox_destructor;
|
||||
w->data = d = p_new(iconbox_data_t, 1);
|
||||
d->resize = true;
|
||||
|
||||
return w;
|
||||
}
|
||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
Loading…
Reference in New Issue