mirror of https://github.com/CGAL/cgal
*** empty log message ***
This commit is contained in:
parent
be7eb71c08
commit
67b44e4ab0
|
|
@ -0,0 +1,54 @@
|
|||
#if defined(CGAL_USE_CGAL_WINDOW)
|
||||
|
||||
#include <CGAL/LEDA/window.h>
|
||||
#include <CGAL/LEDA/bitmaps/button32/voro.xbm>
|
||||
#include <list>
|
||||
|
||||
using namespace std;
|
||||
|
||||
/*
|
||||
#if defined(__KCC)
|
||||
list<CGAL::window_point> L1;
|
||||
list<std::string> L2;
|
||||
#endif
|
||||
*/
|
||||
|
||||
int main()
|
||||
{
|
||||
CGAL::window W(400,400);
|
||||
W.set_bg_color(CGAL::yellow);
|
||||
W.display();
|
||||
|
||||
// construct bitmap from the bitmap data in
|
||||
// <CGAL/LEDA/bitmaps/button32/voro.xbm>
|
||||
|
||||
char* bm = W.create_bitmap(32,
|
||||
32,
|
||||
voro_bits);
|
||||
|
||||
// copy copies of bm into the window
|
||||
|
||||
CGAL::window_point p;
|
||||
while (W.read_mouse(p) != MOUSE_BUTTON(3)) {
|
||||
W.put_bitmap(p.xcoord(),p.ycoord(),bm,CGAL::blue);
|
||||
}
|
||||
|
||||
W.del_bitmap(bm);
|
||||
|
||||
//W.screenshot("bitmap");
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
#include <iostream>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::cout << "CGAL::window is not available !\n";
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
#if defined(CGAL_USE_CGAL_WINDOW)
|
||||
|
||||
#include <CGAL/LEDA/window.h>
|
||||
#include <CGAL/LEDA/bitmaps/button32.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main()
|
||||
{
|
||||
CGAL::panel P("Bitmap Buttons");
|
||||
P.buttons_per_line(8);
|
||||
P.set_button_space(3);
|
||||
|
||||
for(int i=0; i < num_xbm_button32; i++)
|
||||
P.button(32,32,xbm_button32[i],string(name_xbm_button32[i]));
|
||||
|
||||
P.open();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
#include <iostream>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::cout << "CGAL::window is not available !\n";
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
#if defined(CGAL_USE_CGAL_WINDOW)
|
||||
|
||||
#include <CGAL/LEDA/window.h>
|
||||
#include <cmath>
|
||||
|
||||
int main()
|
||||
{
|
||||
CGAL::window W(450,500,"Event Demo");
|
||||
W.display();
|
||||
|
||||
W.start_buffering();
|
||||
|
||||
for(;;)
|
||||
{
|
||||
// read the first corner p of the rectangle
|
||||
// terminate if the right button was clicked
|
||||
|
||||
CGAL::window_point p;
|
||||
if (W.read_mouse(p) == MOUSE_BUTTON(3)) break;
|
||||
|
||||
// draw rectangle from p to current position while button down
|
||||
|
||||
int val;
|
||||
double x,y;
|
||||
|
||||
char* win_buf = W.get_window_pixrect();
|
||||
|
||||
while (W.read_event(val,x,y) != CGAL::button_release_event)
|
||||
{ CGAL::window_point q(x,y);
|
||||
W.put_pixrect(win_buf);
|
||||
W.draw_box(p,q,CGAL::yellow);
|
||||
W.draw_rectangle(p,q,CGAL::black);
|
||||
W.flush_buffer();
|
||||
}
|
||||
|
||||
W.del_pixrect(win_buf);
|
||||
}
|
||||
|
||||
W.stop_buffering();
|
||||
|
||||
W.screenshot("event");
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
#include <iostream>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::cout << "CGAL::window is not available !\n";
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
#if defined(CGAL_USE_CGAL_WINDOW)
|
||||
|
||||
#include <CGAL/LEDA/file_panel.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
void save_handler(string fn)
|
||||
{
|
||||
std::cout << "save_handler got parameter " << fn << "\n";
|
||||
}
|
||||
|
||||
void dummy(string fn)
|
||||
{
|
||||
std::cout << "dummy got parameter " << fn << "\n";
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
CGAL::window Win(600,600);
|
||||
Win.init(0,600,0);
|
||||
|
||||
Win.display();
|
||||
|
||||
// open a file panel ...
|
||||
std::string fname("test"), dname(".");
|
||||
|
||||
CGAL::file_panel P(Win, fname, dname);
|
||||
P.set_save_handler(save_handler);
|
||||
P.set_cancel_handler(dummy);
|
||||
P.set_pattern("C Files (*.C)","*.C");
|
||||
|
||||
P.open();
|
||||
|
||||
std::cout << fname << " " << dname << "\n";
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
#include <iostream>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::cout << "CGAL::window is not available !\n";
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
#if defined(CGAL_USE_CGAL_WINDOW)
|
||||
|
||||
#include <CGAL/LEDA/file_panel.h>
|
||||
#include <CGAL/LEDA/file.h>
|
||||
#include <fstream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
void load_handler(string fn)
|
||||
{
|
||||
std::cout << "load_handler got parameter " << fn << "\n";
|
||||
|
||||
if (CGAL::is_file(fn)) {
|
||||
std::cout << fn << " is a file!\n";
|
||||
|
||||
std::ifstream I(fn.c_str());
|
||||
|
||||
char ch;
|
||||
|
||||
while (I.get(ch)) cout << ch;
|
||||
|
||||
I.close();
|
||||
}
|
||||
}
|
||||
|
||||
void dummy(string fn)
|
||||
{
|
||||
std::cout << "dummy got parameter " << fn << "\n";
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
CGAL::window Win(600,600);
|
||||
Win.init(0,600,0);
|
||||
|
||||
Win.display();
|
||||
|
||||
// open a file panel ...
|
||||
std::string fname("test"), dname(".");
|
||||
|
||||
CGAL::file_panel P(Win, fname, dname);
|
||||
P.set_load_handler(load_handler);
|
||||
P.set_cancel_handler(dummy);
|
||||
P.set_pattern("C Files (*.C)","*.C");
|
||||
|
||||
|
||||
P.open();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
#include <iostream>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::cout << "CGAL::window is not available !\n";
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
#if defined(CGAL_USE_CGAL_WINDOW)
|
||||
|
||||
#include <CGAL/LEDA/window.h>
|
||||
#include <CGAL/LEDA/file.h>
|
||||
|
||||
|
||||
int main() {
|
||||
|
||||
CGAL::menu M;
|
||||
M.button("button 1");
|
||||
M.button("button 2");
|
||||
M.button("button 3");
|
||||
M.button("button 4");
|
||||
M.button("button 5");
|
||||
|
||||
CGAL::window W(400,300,"Menu Demo");
|
||||
|
||||
W.button("File",M);
|
||||
W.button("Edit",M);
|
||||
W.button("Help",M);
|
||||
W.button("exit");
|
||||
|
||||
W.make_menu_bar();
|
||||
|
||||
W.display();
|
||||
|
||||
W.read_mouse();
|
||||
|
||||
W.screenshot("menu_bar");
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
#include <iostream>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::cout << "CGAL::window is not available !\n";
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,116 @@
|
|||
#if defined(CGAL_USE_CGAL_WINDOW)
|
||||
|
||||
#include <CGAL/LEDA/window.h>
|
||||
#include <CGAL/LEDA/file.h>
|
||||
#include <CGAL/LEDA/bitmaps/button32.h>
|
||||
|
||||
static unsigned char* bm_bits [] = {
|
||||
triang_bits,
|
||||
voro_bits,
|
||||
empty_circle_bits,
|
||||
encl_circle_bits,
|
||||
grid_bits,
|
||||
hull_bits,
|
||||
};
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
bool B = false;
|
||||
CGAL::color col = CGAL::blue2;
|
||||
double R = 3.1415;
|
||||
int c = 0;
|
||||
int c1 = 0;
|
||||
int c2 = 0;
|
||||
int cm = 5;
|
||||
int N = 100;
|
||||
string s0 = "string0";
|
||||
string s = "dummy";
|
||||
string s1 = "menu";
|
||||
|
||||
int but_num = 5;
|
||||
|
||||
std::list<string> M1 = CGAL::get_files(".");
|
||||
std::list<string> M2 = CGAL::get_files(".");
|
||||
|
||||
|
||||
std::list<string> CML;
|
||||
CML.push_back("0");
|
||||
CML.push_back("1");
|
||||
CML.push_back("2");
|
||||
CML.push_back("3");
|
||||
CML.push_back("4");
|
||||
|
||||
|
||||
for(;;)
|
||||
{
|
||||
CGAL::panel P("PANEL DEMO");
|
||||
|
||||
string text;
|
||||
text += " The panel section of a window is used for displaying text";
|
||||
text += " and for updating the values of variables. It consists";
|
||||
text += " of a list of panel items and a list of buttons.";
|
||||
text += " All operations adding panel items or buttons to the panel";
|
||||
text += " section of a window have to be called before";
|
||||
text += " the window is displayed for the first time.";
|
||||
|
||||
P.text_item("");
|
||||
P.text_item("\\bf\\blue A Text Item");
|
||||
P.text_item("");
|
||||
P.text_item(text);
|
||||
|
||||
P.text_item("");
|
||||
P.text_item("\\bf\\blue A Bool Item");
|
||||
P.bool_item("bool item",B);
|
||||
|
||||
P.text_item("\\bf\\blue A Color Item");
|
||||
P.color_item("color item",col);
|
||||
|
||||
P.text_item("");
|
||||
P.text_item("\\bf\\blue A Slider Item");
|
||||
P.int_item("slider item(1,20)",but_num,-1,20);
|
||||
|
||||
P.text_item("");
|
||||
P.text_item("\\bf\\blue Simple Items");
|
||||
P.string_item("string item",s);
|
||||
P.int_item("int item",N);
|
||||
P.double_item("double item",R);
|
||||
|
||||
P.text_item("");
|
||||
P.text_item("\\bf\\blue String Menu Items");
|
||||
P.string_item("string menu",s0,M1,8);
|
||||
|
||||
P.text_item("");
|
||||
P.text_item("\\bf\\blue Choice Items");
|
||||
P.choice_item("simple choice",c,"one","two","three","four","five");
|
||||
P.choice_mult_item("multiple choice",cm,CML);
|
||||
P.int_item("integer choice",c1,0,80,20);
|
||||
P.choice_item("bitmap choice",c2,6,32,32,bm_bits);
|
||||
|
||||
P.text_item("");
|
||||
P.text_item("\\bf\\blue Buttons");
|
||||
|
||||
int i;
|
||||
for(i=0; i < but_num; i++) P.button(string("button"));
|
||||
|
||||
P.display();
|
||||
|
||||
if (P.open() == 0) break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
#include <iostream>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::cout << "CGAL::window is not available !\n";
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
#if defined(CGAL_USE_CGAL_WINDOW)
|
||||
|
||||
#include <CGAL/LEDA/window.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
CGAL::window W(400,100);
|
||||
W.set_item_width(300);
|
||||
W.int_item("progress",count,0,1000);
|
||||
W.display(CGAL::window::center,CGAL::window::center);
|
||||
|
||||
for(;;)
|
||||
{ count = 0;
|
||||
while (count < 1000)
|
||||
{ W.redraw_panel();
|
||||
W.flush();
|
||||
count++;
|
||||
}
|
||||
if (W.read_mouse() == MOUSE_BUTTON(3)) break;
|
||||
}
|
||||
|
||||
W.screenshot("progress");
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
#include <iostream>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::cout << "CGAL::window is not available !\n";
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Loading…
Reference in New Issue