* Description: A bitmap table uses a single bitmap to simulate a 2d array
* of bitmap buttons. It can be used to build bitmap menus.
*
- * Copyright (C) 1995,1996 Alejandro Aguilar Sierra
+ * Copyright 1995,1996 Alejandro Aguilar Sierra
*
* You are free to use and modify this code under the terms of
* the GNU General Public Licence version 2 or later.
#include <config.h>
-// $Id: bmtable.C,v 1.1 1999/09/27 18:44:37 larsbj Exp $
-
-#if !defined(lint) && !defined(WITH_WARNINGS)
-static char vcid[] = "$Id: bmtable.C,v 1.1 1999/09/27 18:44:37 larsbj Exp $";
-#endif /* lint */
-
-#include <stdlib.h>
+#include <cstdlib>
#include "bmtable.h"
#include XPM_H_LOCATION
int dx, dy; /* Size of each item */
int bx, by; /* Bitmap's position */
int bw, bh; /* Bitmap dimensions */
- char* bdata; /* Bitmap data */
+ unsigned char * bdata; /* Bitmap data */
int maxi; /* Number of items */
int i; /* Current position */
int mousebut; /* mouse button pushed */
} BMTABLE_SPEC;
-static int handle_bitmaptable(FL_OBJECT *ob, int event, FL_Coord mx,
- FL_Coord my, int key, void *xev);
+extern "C" int handle_bitmaptable(FL_OBJECT *ob, int event, FL_Coord mx,
+ FL_Coord my, int key, void *xev);
FL_OBJECT *fl_create_bmtable(int type, FL_Coord x, FL_Coord y,
if (sp->bdata) {
if (!sp->pix) {
sp->pix = XCreatePixmapFromBitmapData(fl_display, fl_winget(),
- sp->bdata, sp->bw, sp->bh,
+ reinterpret_cast<char*>(sp->bdata),
+ sp->bw, sp->bh,
fl_get_flcolor(ob->lcol), fl_get_flcolor(ob->col1),
DefaultDepth(fl_display, DefaultScreen(fl_display)));
XFlush(fl_display);
}
-static int handle_bitmaptable(FL_OBJECT *ob, int event, FL_Coord mx,
- FL_Coord my, int key, void */*xev*/)
+extern "C" int handle_bitmaptable(FL_OBJECT *ob, int event, FL_Coord mx,
+ FL_Coord my, int key, void */*xev*/)
{
int i, j;
BMTABLE_SPEC *sp = (BMTABLE_SPEC *)ob->spec;
* The user could change these later. See below.
*/
void fl_set_bmtable_data(FL_OBJECT *ob, int nx, int ny, int bw, int bh,
- char *bdata)
+ unsigned char * bdata)
{
BMTABLE_SPEC *sp = (BMTABLE_SPEC *)ob->spec;
if (sp) {
void fl_set_bmtable_file(FL_OBJECT *ob, int nx, int ny, char const *filename)
{
- int bw, bh, xh, yh;
- char *bdata;
+ int xh, yh;
+ unsigned int bw, bh;
+ unsigned char *bdata;
- if(XReadBitmapFileData(filename, (unsigned int *) &bw, (unsigned int *) &bh,
- (unsigned char **) &bdata, &xh, &yh)==BitmapSuccess)
+ if(XReadBitmapFileData(filename, &bw, &bh,
+ &bdata, &xh, &yh)==BitmapSuccess)
fl_set_bmtable_data(ob, nx, ny, bw, bh, bdata);
XFlush(fl_display);
}