/** * Copyright Mikael Högdahl - triyana@users.sourceforge.net * * This source is distributed under the terms of the Q Public License version 1.0, * created by Trolltech (www.trolltech.com). */ #include "Fl_Choice2.h" #include #include /** * */ Fl_Choice2::Fl_Choice2 (Fl_Table_Data* datafeed, int x, int y, int w, int h, const char* s) : Fl_Choice (x, y, w, h, s) { aDataFeed = datafeed; aInteractive = true; callback (Fl_Choice2::cb1_, this); memset (aBuffer, '\0', 256); aBufferPos = 0; } /** * */ void Fl_Choice2::cb1 () { /*int f; for (f = 0;f < aSize; f++) { if (STRCASECMP (aList[f], aInput->value()) >= 0) break; }*/ //aBrowser->value (f + (f < aSize ? 1 : 0));*/ } /** * */ int Fl_Choice2::handle (int event) { /* printf ("%d\n", event); if (event == FL_KEYDOWN) { int key = Fl::event_key (); if (key >= 33 && key < 256) { if (aBufferPos < 255) aBuffer[aBufferPos++] = key; printf ("%d - %s\n", key, aBuffer); return 1; } else if (key == FL_BackSpace) { memset (aBuffer, '\0', 256); aBufferPos = 0; } } */ return Fl_Choice::handle (event); } /** * */ bool Fl_Choice2::populate (int row, int col) { int sel; char label[100]; aList = aDataFeed->choice (row, col, aSize, sel, label); if (!aList || aSize < 1) return false; for (int f = 0; f < aSize; f++) add (aList[f]); value (sel); return true; }