| 1 | /* $Id$ |
|---|
| 2 | * $URL$ |
|---|
| 3 | * |
|---|
| 4 | * generic driver helper for keypads |
|---|
| 5 | * |
|---|
| 6 | * Copyright (C) 2006 Chris Maj <cmaj@freedomcorpse.com> |
|---|
| 7 | * Copyright (C) 2006 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net> |
|---|
| 8 | * |
|---|
| 9 | * This file is part of LCD4Linux. |
|---|
| 10 | * |
|---|
| 11 | * LCD4Linux is free software; you can redistribute it and/or modify |
|---|
| 12 | * it under the terms of the GNU General Public License as published by |
|---|
| 13 | * the Free Software Foundation; either version 2, or (at your option) |
|---|
| 14 | * any later version. |
|---|
| 15 | * |
|---|
| 16 | * LCD4Linux is distributed in the hope that it will be useful, |
|---|
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 19 | * GNU General Public License for more details. |
|---|
| 20 | * |
|---|
| 21 | * You should have received a copy of the GNU General Public License |
|---|
| 22 | * along with this program; if not, write to the Free Software |
|---|
| 23 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
|---|
| 24 | * |
|---|
| 25 | */ |
|---|
| 26 | |
|---|
| 27 | #include <stdio.h> |
|---|
| 28 | |
|---|
| 29 | #include "debug.h" |
|---|
| 30 | #include "widget.h" |
|---|
| 31 | #include "widget_keypad.h" |
|---|
| 32 | |
|---|
| 33 | #include "drv_generic_keypad.h" |
|---|
| 34 | |
|---|
| 35 | static char *Section = NULL; |
|---|
| 36 | static char *Driver = NULL; |
|---|
| 37 | |
|---|
| 38 | int (*drv_generic_keypad_real_press) () = NULL; |
|---|
| 39 | |
|---|
| 40 | int drv_generic_keypad_init(const char *section, const char *driver) |
|---|
| 41 | { |
|---|
| 42 | WIDGET_CLASS wc; |
|---|
| 43 | |
|---|
| 44 | Section = (char *) section; |
|---|
| 45 | Driver = (char *) driver; |
|---|
| 46 | |
|---|
| 47 | /* register keypad widget */ |
|---|
| 48 | wc = Widget_Keypad; |
|---|
| 49 | widget_register(&wc); |
|---|
| 50 | |
|---|
| 51 | return 0; |
|---|
| 52 | } |
|---|
| 53 | |
|---|
| 54 | int drv_generic_keypad_press(const int num) |
|---|
| 55 | { |
|---|
| 56 | WIDGET *w; |
|---|
| 57 | int val = 0; |
|---|
| 58 | |
|---|
| 59 | if (drv_generic_keypad_real_press) |
|---|
| 60 | val = drv_generic_keypad_real_press(num); |
|---|
| 61 | |
|---|
| 62 | w = widget_find(WIDGET_TYPE_KEYPAD, &val); |
|---|
| 63 | |
|---|
| 64 | if (w && w->class->draw) |
|---|
| 65 | w->class->draw(w); |
|---|
| 66 | |
|---|
| 67 | return val; |
|---|
| 68 | } |
|---|
| 69 | |
|---|
| 70 | int drv_generic_keypad_quit(void) |
|---|
| 71 | { |
|---|
| 72 | return 0; |
|---|
| 73 | } |
|---|