Just in case anyone fancies playing along at home, and did not see the original
posts in the STR, here's the version of the test code I'm currently using,
based on the OP's post but tweaked to build on my system, and a small Makefile
to build it with...
------- source (qix.cxx) -----------
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Double_Window.H>
#include <FL/Fl_Button.H>
//#define BASE_WIN Fl_Window
#define BASE_WIN Fl_Double_Window
class CAtuoTestTime {
public:
CAtuoTestTime() {}
~CAtuoTestTime() {}
void Begin();
void End();
void SetText(const char* szText);
private:
struct timespec m_tm_begin;
struct timespec m_tm_end;
const char* m_szText;
};
void CAtuoTestTime::Begin() {
clock_gettime(CLOCK_REALTIME, &m_tm_begin);
}
void CAtuoTestTime::End() {
clock_gettime(CLOCK_REALTIME, &m_tm_end);
int msec_cost = (m_tm_end.tv_sec * 1000 + m_tm_end.tv_nsec / 1000 / 1000)
- (m_tm_begin.tv_sec * 1000 + m_tm_begin.tv_nsec / 1000 / 1000);
Fl::warning("%s cost %d(ms)", m_szText, msec_cost);
}
void CAtuoTestTime::SetText(const char* szText) {
m_szText = szText;
}
static void beepcb(Fl_Button*, void*)
{
puts("Beep!");
}
static void exitcb(Fl_Button*, void* v)
{
BASE_WIN *window = (BASE_WIN *)v;
window->hide();
}
int main(int argc, char ** argv) {
CAtuoTestTime att;
att.SetText("New control");
att.Begin();
BASE_WIN *window = new BASE_WIN(320,65);
Fl_Button *b1 = new Fl_Button(20, 20, 80, 25, "&Beep");
b1->callback((Fl_Callback*)beepcb, NULL);
/*Fl_Button *b2 =*/ new Fl_Button(120,20, 80, 25, "&no op");
Fl_Button *b3 = new Fl_Button(220,20, 80, 25, "E&xit");
att.End();
b3->callback((Fl_Callback*)exitcb, (void *)window);
window->end();
att.SetText("Show window");
att.Begin();
window->show(argc,argv);
att.End();
#if 0
Fl::add_fd(0, stdin_cb);
#endif
return Fl::run();
}
/* end of file */
------ Makefile ----------
#########################################################
CXX = $(shell fltk1-3-config --cxx)
CCFLAGS = -Wall -O2 -I. $(shell fltk1-3-config --cxxflags)
LIB = $(shell fltk1-3-config --ldstaticflags) -lrt
all: qix
qix: qix.cxx
$(CXX) -o $@ qix.cxx $(CCFLAGS) $(LIB) -s
# HOUSEKEEPING
clean:
@echo cleaning...
@rm -f *.o qix
# EOF #
------ end ---------------
SELEX Galileo Ltd
Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex SS14
3EL
A company registered in England & Wales. Company no. 02426132
********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk