1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-20 03:51:18 +00:00
conky/src/specials.h
Phil Sutter 08122354a9 convert some special printing functions to common signature
Also add a little hack to $scroll to omit the need to call new_fg() from
inside print_scroll(). Instead of inserting a new special after printing
the scrolled text, insert a new object after the scroll object when
parsing text objects to handle the color reset.
2009-11-29 22:21:48 +01:00

124 lines
3.5 KiB
C

/* -*- mode: c; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
*
* Conky, a system monitor, based on torsmo
*
* Any original torsmo code is licensed under the BSD license
*
* All code written since the fork of torsmo is licensed under the GPL
*
* Please see COPYING for details
*
* Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen
* Copyright (c) 2005-2009 Brenden Matthews, Philip Kovacs, et. al.
* (see AUTHORS)
* All rights reserved.
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef _SPECIALS_H
#define _SPECIALS_H
/* special stuff in text_buffer */
#define SPECIAL_CHAR '\x01'
#define MAX_GRAPH_DEPTH 512
// don't use spaces in LOGGRAPH or NORMGRAPH if you change them
#define LOGGRAPH "-l"
#define TEMPGRAD "-t"
enum special_types {
NONSPECIAL = 0,
HORIZONTAL_LINE = 1,
STIPPLED_HR,
BAR,
FG,
BG,
OUTLINE,
ALIGNR,
ALIGNC,
GAUGE,
GRAPH,
OFFSET,
VOFFSET,
FONT,
GOTO,
TAB,
};
struct special_t {
int type;
short height;
short width;
long arg;
double *graph;
double graph_scale;
short show_scale;
int graph_width;
int scaled;
unsigned long first_colour; // for graph gradient
unsigned long last_colour;
short font_added;
char tempgrad;
};
/* direct access to the registered specials (FIXME: bad encapsulation) */
extern struct special_t *specials;
extern int special_count;
extern int default_bar_width;
extern int default_bar_height;
#ifdef X11
extern int default_graph_width;
extern int default_graph_height;
extern int default_gauge_width;
extern int default_gauge_height;
#endif
/* forward declare to avoid mutual inclusion between specials.h and text_object.h */
struct text_object;
/* max number of specials allowed (TODO: use linked list instead) */
extern int max_specials;
/* scanning special arguments */
const char *scan_bar(struct text_object *, const char *);
const char *scan_gauge(struct text_object *, const char *);
#ifdef X11
char *scan_font(const char *);
char *scan_graph(struct text_object *, const char *, int);
void scan_tab(struct text_object *, const char *);
void scan_stippled_hr(struct text_object *, const char*);
/* printing specials */
void new_font(char *, char *);
void new_graph(struct text_object *, char *, int, double);
void new_hr(struct text_object *, char *, int);
void new_stippled_hr(struct text_object *, char *, int);
#endif
void new_gauge(struct text_object *, char *, int, int);
void new_bar(struct text_object *, char *, int, int);
void new_fg(struct text_object *, char *, int);
void new_bg(struct text_object *, char *, int);
void new_outline(struct text_object *, char *, int);
void new_offset(struct text_object *, char *, int);
void new_voffset(struct text_object *, char *, int);
void new_alignr(struct text_object *, char *, int);
void new_alignc(struct text_object *, char *, int);
void new_goto(struct text_object *, char *, int);
void new_tab(struct text_object *, char *, int);
#endif /* _SPECIALS_H */