dbwind: DBWAddButtonHandler() cb_database_buttonhandler_t

constify API call arguments as appropiate
This commit is contained in:
Darryl L. Miles 2025-01-31 19:00:57 +00:00 committed by Tim Edwards
parent 4f54bcf4f4
commit 81d526562c
2 changed files with 12 additions and 8 deletions

View File

@ -58,7 +58,7 @@ static char *dbwButtonDoc[MAXBUTTONHANDLERS];
/* A documentation string for each handler: tells
* what the button pushes and releases mean.
*/
static void (*dbwButtonProcs[MAXBUTTONHANDLERS])();
static cb_database_buttonhandler_t dbwButtonProcs[MAXBUTTONHANDLERS];
/* A procedure for each handler that is invoked
* on button presses and releases when that handler
* is the current one.
@ -68,7 +68,7 @@ static int dbwButtonCursors[MAXBUTTONHANDLERS];
static int dbwButtonCurrentIndex;
/* Index of current handler. */
void (*DBWButtonCurrentProc)();
cb_database_buttonhandler_t DBWButtonCurrentProc;
/* Current button-handling procedure. */
static int buttonCorner = TOOL_ILG; /* Nearest corner when button went
@ -108,18 +108,19 @@ static int buttonCorner = TOOL_ILG; /* Nearest corner when button went
*/
void
DBWAddButtonHandler(name, proc, cursor, doc)
char *name; /* Name of this button handler. This name
DBWAddButtonHandler(
const char *name, /* Name of this button handler. This name
* is what's passed to DBWChangeButtonHandler
* to activate the handler.
*/
void (*proc)(); /* Procedure to call on button actions when
const cb_database_buttonhandler_t proc,
/* Procedure to call on button actions when
* this handler is active.
*/
int cursor; /* Cursor shape (e.g. STYLE_CURS_NORMAL) to
int cursor, /* Cursor shape (e.g. STYLE_CURS_NORMAL) to
* use when this handler is active.
*/
char *doc; /* A documentation string for this handler:
const char *doc) /* A documentation string for this handler:
* describes what the button pushes do when
* this handler is active.
*/

View File

@ -25,6 +25,7 @@
#include "database/database.h"
#include "windows/windows.h"
#include "textio/txcommands.h" /* TxCommand */
/*--------------------------- Window Client Data ----------------------------
* The dbwind package keeps special client data that it uses to
@ -141,7 +142,9 @@ extern char *DBWStyleType;
*/
extern void (*DBWButtonCurrentProc)();
extern void DBWAddButtonHandler();
typedef void (*cb_database_buttonhandler_t)(MagWindow *w, TxCommand *cmd);
extern void DBWAddButtonHandler(const char *name, const cb_database_buttonhandler_t proc,
int cursor, const char *doc);
extern char *DBWChangeButtonHandler();
extern void DBWPrintButtonDoc();
extern void DBWBoxHandler();