From 55d37178a051c6263491390d10a3d6d01bea06a4 Mon Sep 17 00:00:00 2001 From: kojima Date: Wed, 4 Dec 2002 15:40:32 +0000 Subject: [PATCH] added cback for set button in fontpanel --- ChangeLog | 3 ++- WINGs/WINGs/WINGs.h | 2 ++ WINGs/wfontpanel.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 56243bc7..52dd40a0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -31,13 +31,14 @@ Changes since version 0.80.1: - Fixed wrlib to not accept too large images (fixes buffer overflow) - Patched FAQ (David Coe ) - Fixed bug with resizebars appearing out of nothing when reloading configs -- Fixed sloppy focus bug (Pawel S. Veselov ) +- Fixed sloppy focus bug (Pawel S. Veselov ) - Applied Xinerama patch (after fixes) from (Peter Zijlstra ) - Added switch to enable/disable antialiased fonts in WPrefs's Expert Settings panel. (Temporary until the Font Settings panel in WPrefs is finished). - Added a check that only %d is used in a font specification in WMGLOBAL and at most once for each font in a fontset (eliminates a possible security exploit) +- Added fontpanel callback Changes since version 0.80.0: diff --git a/WINGs/WINGs/WINGs.h b/WINGs/WINGs/WINGs.h index 22659349..74cb39a9 100644 --- a/WINGs/WINGs/WINGs.h +++ b/WINGs/WINGs/WINGs.h @@ -1865,6 +1865,8 @@ void WMShowFontPanel(WMFontPanel *panel); void WMHideFontPanel(WMFontPanel *panel); +void WMSetFontPanelAction(WMFontPanel *panel, WMAction2 *action, void *data); + void WMSetFontPanelFont(WMFontPanel *panel, WMFont *font); /* you can free the returned string */ diff --git a/WINGs/wfontpanel.c b/WINGs/wfontpanel.c index 168a8a02..868522a4 100644 --- a/WINGs/wfontpanel.c +++ b/WINGs/wfontpanel.c @@ -10,6 +10,13 @@ #include + +/* XXX TODO */ +char *WMFontPanelFontChangedNotification = "WMFontPanelFontChangedNotification"; + + + + typedef struct W_FontPanel { WMWindow *win; @@ -27,6 +34,9 @@ typedef struct W_FontPanel { WMTextField *sizT; WMList *sizLs; + WMAction2 *action; + void *data; + WMButton *revertB; WMButton *setB; @@ -150,6 +160,26 @@ closeWindow(WMWidget *w, void *data) + +static void +setClickedAction(WMWidget *w, void *data) +{ + FontPanel *panel = (FontPanel*)data; + + if (panel->action) + (*panel->action)(panel, panel->data); +} + + +static void +revertClickedAction(WMWidget *w, void *data) +{ + FontPanel *panel = (FontPanel*)data; + /* XXX TODO */ +} + + + WMFontPanel* WMGetFontPanel(WMScreen *scr) { @@ -250,11 +280,14 @@ WMGetFontPanel(WMScreen *scr) WMResizeWidget(panel->setB, 70, 24); WMMoveWidget(panel->setB, 240, DEF_HEIGHT - (BUTTON_SPACE_HEIGHT-5)); WMSetButtonText(panel->setB, _("Set")); + WMSetButtonAction(panel->setB, setClickedAction, panel); panel->revertB = WMCreateCommandButton(panel->win); WMResizeWidget(panel->revertB, 70, 24); WMMoveWidget(panel->revertB, 80, DEF_HEIGHT - (BUTTON_SPACE_HEIGHT-5)); WMSetButtonText(panel->revertB, _("Revert")); + WMSetButtonAction(panel->revertB, revertClickedAction, panel); + WMRealizeWidget(panel->win); @@ -350,6 +383,17 @@ WMGetFontPanelFontName(WMFontPanel *panel) +void +WMSetFontPanelAction(WMFontPanel *panel, WMAction2 *action, void *data) +{ + panel->action = action; + panel->actionData = data; +} + + + + + static void arrangeLowerFrame(FontPanel *panel) { -- 2.11.4.GIT