mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-18 20:10:29 +01:00
WINGs: Make the Extras examples to compile
There is a table view example which is not compiling cause of a missing lib, also fixed some warnings.
This commit is contained in:
committed by
Carlos R. Mafra
parent
4c52232ee7
commit
0526ddfc54
@@ -10,7 +10,7 @@ include_HEADERS = wtableview.h wtabledelegates.h
|
||||
|
||||
lib_LTLIBRARIES = libExtraWINGs.la
|
||||
|
||||
noinst_PROGRAMS = test
|
||||
noinst_PROGRAMS = tableview
|
||||
|
||||
EXTRA_DIST =
|
||||
|
||||
@@ -25,6 +25,6 @@ AM_CPPFLAGS = -I$(top_srcdir)/wrlib -I$(top_srcdir)/WINGs \
|
||||
|
||||
LDADD= $(top_builddir)/WINGs/libWINGs.la $(top_builddir)/wrlib/libwraster.la \
|
||||
$(top_builddir)/WINGs/libWUtil.la \
|
||||
@XFT_LIBS@ @INTLIBS@
|
||||
@XFT_LIBS@ @INTLIBS@ @XLIBS@
|
||||
|
||||
test_LDADD = wtableview.o wtabledelegates.o $(LDADD)
|
||||
tableview_LDADD = wtableview.o wtabledelegates.o $(LDADD)
|
||||
|
||||
@@ -19,13 +19,18 @@ static char *options[] = {
|
||||
|
||||
int numberOfRows(WMTableViewDelegate * self, WMTableView * table)
|
||||
{
|
||||
(void) self;
|
||||
(void) table;
|
||||
|
||||
return 20;
|
||||
}
|
||||
|
||||
void *valueForCell(WMTableViewDelegate * self, WMTableColumn * column, int row)
|
||||
{
|
||||
(void) self;
|
||||
/*WMTableView *table = (WMTableView*)WMGetTableColumnTableView(column); */
|
||||
int i;
|
||||
|
||||
if (col1[0] == 0) {
|
||||
for (i = 0; i < 20; i++) {
|
||||
char buf[128];
|
||||
@@ -44,6 +49,8 @@ void *valueForCell(WMTableViewDelegate * self, WMTableColumn * column, int row)
|
||||
|
||||
void setValueForCell(WMTableViewDelegate * self, WMTableColumn * column, int row, void *data)
|
||||
{
|
||||
(void) self;
|
||||
|
||||
if ((uintptr_t)WMGetTableColumnId(column) == 1)
|
||||
col1[row] = data;
|
||||
else
|
||||
@@ -59,6 +66,7 @@ static WMTableViewDelegate delegate = {
|
||||
|
||||
void clickedTable(WMWidget * w, void *self)
|
||||
{
|
||||
(void) w;
|
||||
int row = WMGetTableViewClickedRow((WMTableView *) self);
|
||||
|
||||
WMEditTableViewRow(self, row);
|
||||
@@ -2,6 +2,8 @@
|
||||
#include <WINGs/WINGsP.h>
|
||||
#include <X11/cursorfont.h>
|
||||
#include <stdint.h>
|
||||
#include <math.h>
|
||||
#include <float.h>
|
||||
|
||||
#include "wtableview.h"
|
||||
|
||||
@@ -274,7 +276,7 @@ static void adjustScrollers(WMTableView * table)
|
||||
prop = 1.0;
|
||||
} else {
|
||||
oprop = WMGetScrollerKnobProportion(table->hscroll);
|
||||
if (oprop == 0.0)
|
||||
if (fabs(oprop) <= DBL_EPSILON)
|
||||
oprop = 1.0;
|
||||
ovalue = WMGetScrollerValue(table->hscroll);
|
||||
|
||||
@@ -290,7 +292,7 @@ static void adjustScrollers(WMTableView * table)
|
||||
prop = 1.0;
|
||||
} else {
|
||||
oprop = WMGetScrollerKnobProportion(table->vscroll);
|
||||
if (oprop == 0.0)
|
||||
if (fabs(oprop) <= DBL_EPSILON)
|
||||
oprop = 1.0;
|
||||
ovalue = WMGetScrollerValue(table->vscroll);
|
||||
|
||||
@@ -332,7 +334,7 @@ static void doScroll(WMWidget * self, void *data)
|
||||
case WSIncrementWheel:
|
||||
case WSIncrementLine:
|
||||
value += (float)table->rowHeight / size;
|
||||
if (value > 1.0)
|
||||
if (value > (float)1.0)
|
||||
value = 1.0;
|
||||
WMSetScrollerParameters(self, value, WMGetScrollerKnobProportion(self));
|
||||
repaintTable(table);
|
||||
@@ -344,7 +346,7 @@ static void doScroll(WMWidget * self, void *data)
|
||||
|
||||
case WSDecrementPage:
|
||||
value -= vpsize / size;
|
||||
if (value < 0.0)
|
||||
if (value < (float)0.0)
|
||||
value = 0.0;
|
||||
WMSetScrollerParameters(self, value, WMGetScrollerKnobProportion(self));
|
||||
repaintTable(table);
|
||||
@@ -352,7 +354,7 @@ static void doScroll(WMWidget * self, void *data)
|
||||
|
||||
case WSIncrementPage:
|
||||
value += vpsize / size;
|
||||
if (value > 1.0)
|
||||
if (value > (float)1.0)
|
||||
value = 1.0;
|
||||
WMSetScrollerParameters(self, value, WMGetScrollerKnobProportion(self));
|
||||
repaintTable(table);
|
||||
@@ -398,6 +400,7 @@ static void doScroll(WMWidget * self, void *data)
|
||||
|
||||
static void splitterHandler(XEvent * event, void *data)
|
||||
{
|
||||
(void) event;
|
||||
WMTableColumn *column = (WMTableColumn *) data;
|
||||
WMTableView *table = column->table;
|
||||
int done = 0;
|
||||
@@ -451,6 +454,8 @@ static void splitterHandler(XEvent * event, void *data)
|
||||
|
||||
static void realizeTable(void *data, WMNotification * notif)
|
||||
{
|
||||
(void) notif;
|
||||
|
||||
repaintTable(data);
|
||||
}
|
||||
|
||||
@@ -790,7 +795,6 @@ void WMSetTableViewRowHeight(WMTableView * table, int height)
|
||||
|
||||
void WMScrollTableViewRowToVisible(WMTableView * table, int row)
|
||||
{
|
||||
WMScroller *scroller;
|
||||
WMRange range;
|
||||
WMRect rect;
|
||||
int newY, tmp;
|
||||
@@ -798,7 +802,6 @@ void WMScrollTableViewRowToVisible(WMTableView * table, int row)
|
||||
rect = getVisibleRect(table);
|
||||
range = rowsInRect(table, rect);
|
||||
|
||||
scroller = table->vscroll;
|
||||
|
||||
if (row < range.position) {
|
||||
newY = row * table->rowHeight - rect.size.height / 2;
|
||||
@@ -1157,6 +1160,8 @@ static void handleEvents(XEvent * event, void *data)
|
||||
|
||||
static void handleResize(W_ViewDelegate * self, WMView * view)
|
||||
{
|
||||
(void) self;
|
||||
|
||||
reorganizeInterior(view->self);
|
||||
}
|
||||
|
||||
@@ -1167,7 +1172,8 @@ static void reorganizeInterior(WMTableView * table)
|
||||
WMSize size = getTotalSize(table);
|
||||
WMView *view = table->view;
|
||||
int vw, vh;
|
||||
int hsThickness, vsThickness;
|
||||
int hsThickness = 0;
|
||||
int vsThickness = 0;
|
||||
|
||||
if (table->vscroll)
|
||||
vsThickness = WMWidgetWidth(table->vscroll);
|
||||
|
||||
Reference in New Issue
Block a user