added battery code
git-svn-id: http://tint2.googlecode.com/svn/trunk@74 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
This commit is contained in:
62
src/battery/battery.h
Normal file
62
src/battery/battery.h
Normal file
@@ -0,0 +1,62 @@
|
||||
/**************************************************************************
|
||||
* Copyright (C) 2009 Sebastian Reichel <elektranox@gmail.com>
|
||||
*
|
||||
* Battery with functional data (percentage, time to life) and drawing data
|
||||
* (area, font, ...). Each panel use his own drawing data.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef BATTERY_H
|
||||
#define BATTERY_H
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "area.h"
|
||||
|
||||
typedef struct Battery {
|
||||
// always start with area
|
||||
Area area;
|
||||
|
||||
config_color font;
|
||||
int bat1_posy;
|
||||
int bat2_posy;
|
||||
} Battery;
|
||||
|
||||
enum chargestate {
|
||||
BATTERY_UNKNOWN,
|
||||
BATTERY_CHARGING,
|
||||
BATTERY_DISCHARGING
|
||||
};
|
||||
|
||||
typedef struct battime {
|
||||
int16_t hours;
|
||||
int8_t minutes;
|
||||
int8_t seconds;
|
||||
} battime;
|
||||
|
||||
typedef struct batstate {
|
||||
int percentage;
|
||||
struct battime time;
|
||||
enum chargestate state;
|
||||
} batstate;
|
||||
|
||||
extern struct batstate battery_state;
|
||||
extern PangoFontDescription *bat1_font_desc;
|
||||
extern PangoFontDescription *bat2_font_desc;
|
||||
|
||||
extern int8_t battery_low_status;
|
||||
extern char* battery_low_cmd;
|
||||
|
||||
// initialize clock : y position, ...
|
||||
void update_battery(struct batstate *data);
|
||||
|
||||
void init_battery();
|
||||
|
||||
void draw_battery(void *obj, cairo_t *c, int active);
|
||||
|
||||
void resize_battery(void *obj);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user