本文整理汇总了C++中Fl_Box::image方法的典型用法代码示例。如果您正苦于以下问题:C++ Fl_Box::image方法的具体用法?C++ Fl_Box::image怎么用?C++ Fl_Box::image使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fl_Box
的用法示例。
在下文中一共展示了Fl_Box::image方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: start_dialog
static int start_dialog(int argc, char** argv) {
LaunchWindow* win = new LaunchWindow(370, 195, _("Run Command"));
win->begin();
Fl_Box* icon = new Fl_Box(10, 10, 55, 55);
icon->image(image_run);
Fl_Box* txt = new Fl_Box(70, 10, 290, 69, _("Enter the name of the application "
"you would like to run or the URL you would like to view"));
txt->align(132|FL_ALIGN_INSIDE);
dialog_input = new Fl_Input(70, 90, 290, 25, _("Open:"));
Resource rc;
char buf[128];
if(rc.load("ede-launch-history") && rc.get("History", "open", buf, sizeof(buf))) {
dialog_input->value(buf);
/* make text appear selected */
dialog_input->position(0, dialog_input->size());
}
in_term = new Fl_Check_Button(70, 125, 290, 25, _("Run in terminal"));
in_term->down_box(FL_DOWN_BOX);
Fl_Button* ok = new Fl_Button(175, 160, 90, 25, _("&OK"));
ok->callback(ok_cb, win);
Fl_Button* cancel = new Fl_Button(270, 160, 90, 25, _("&Cancel"));
cancel->callback(cancel_cb, win);
win->end();
win->window_icon(run_xpm);
win->show(argc, argv);
return Fl::run();
}
示例2: CBaseLuaWidget
CLuaImage::CLuaImage(const char *file) : CBaseLuaWidget(""), m_iImageW(0), m_iImageH(0)
{
Fl_Shared_Image *img = Fl_Shared_Image::get(file);
if (img)
{
if ((img->w() > MaxImageW()) || (img->h() > MaxImageH()))
{
int neww, newh;
GetScaledImageSize(img->w(), img->h(), MaxImageW(), MaxImageH(), neww, newh);
Fl_Image *temp = img->copy(neww, newh);
img->release();
img = (Fl_Shared_Image *)temp;
}
Fl_Box *imgbox = new Fl_Box(0, 0, img->w(), img->h());
imgbox->align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE);
imgbox->image(img);
GetGroup()->add(imgbox);
m_iImageW = img->w();
m_iImageH = img->h();
}
else
GetGroup()->hide();
}
示例3: run
void Splash::run(void) {
E_ASSERT(slist != NULL);
if(!show_splash) {
while(next_client_nosplash())
;
return;
}
fl_register_images();
String path, splash_theme_path;
#ifdef USE_LOCAL_CONFIG
splash_theme_path = "splash-themes/";
#else
splash_theme_path = Resource::find_data("themes/splash-themes", RES_SYS_ONLY);
if(splash_theme_path.empty()) {
E_WARNING(E_STRLOC ": Unable to locate splash themes in $XDG_DATA_DIRS directories\n");
return;
}
#endif
splash_theme_path += E_DIR_SEPARATOR;
splash_theme_path += *splash_theme;
if(!file_test(splash_theme_path.c_str(), FILE_TEST_IS_DIR)) {
E_WARNING(E_STRLOC ": Unable to locate '%s' in '%s' theme directory\n",
splash_theme->c_str(), splash_theme_path.c_str());
return;
}
/* setup widgets */
begin();
Fl_Box* bimg = new Fl_Box(0, 0, w(), h());
Fl_Image* splash_img = 0;
path = build_filename(splash_theme_path.c_str(), "background.png");
splash_img = Fl_Shared_Image::get(path.c_str());
if(splash_img) {
int W = splash_img->w();
int H = splash_img->h();
/* update window and Box sizes */
size(W, H);
bimg->size(W, H);
bimg->image(splash_img);
}
/*
* place message box at the bottom with
* nice offset (10 px) from window borders
*/
msgbox = new Fl_Box(10, h() - 25 - 10, w() - 20, 25);
/*
* Setup icons positions, based on position of msgbox assuming someone
* will not abuse splash to start hundrets of programs, since icons will
* be placed only in horizontal order, one line, so in case their large
* number, some of them will go out of window borders.
*
* Icon box will be 64x64 so larger icons can fit too.
*
* This code will use Fl_Group (moving group, later, will move all icons
* saving me from code mess), but will not update it's w() for two reasons:
* icons does not use it, and will be drawn correctly, and second, setting
* width will initiate fltk layout engine which will mess everything up.
*/
Fl_Group* icon_group = new Fl_Group(10, msgbox->y() - 10 - 64, 0, 64);
int X = icon_group->x();
int Y = icon_group->y();
/* offset between icons */
int ioffset = 5;
/* FIXME: use malloc/something instead this */
icons = new Fl_Box*[slist->size()];
icon_group->begin();
int i = 0;
const char* imgpath;
Fl_Image* iconimg = 0;
for(StartupItemListIter it = slist->begin(); it != slist->end(); ++it, ++i) {
Fl_Box* bb = new Fl_Box(X, Y, 64, 64);
path = build_filename(splash_theme_path.c_str(), (*it)->icon.c_str());
imgpath = path.c_str();
iconimg = Fl_Shared_Image::get(imgpath);
if(!iconimg) {
bb->label(_("No image"));
bb->align(FL_ALIGN_INSIDE | FL_ALIGN_WRAP);
} else
bb->image(iconimg);
bb->hide();
X += bb->w() + ioffset;
icons[i] = bb;
//.........这里部分代码省略.........
示例4: p
JACK_Module::JACK_Module ( bool log )
: Module ( 25, 25, name() )
{
_prefix = 0;
_connection_handle_outputs[0][0] = 0;
_connection_handle_outputs[0][1] = 0;
_connection_handle_outputs[1][0] = 0;
_connection_handle_outputs[1][1] = 0;
align( FL_ALIGN_TOP | FL_ALIGN_INSIDE );
if ( log )
{
/* FIXME: how do Controls find out that a connected value has changed? How does this work in ladspa? */
{
Port p( this, Port::INPUT, Port::CONTROL, "Inputs" );
p.hints.type = Port::Hints::INTEGER;
p.hints.minimum = 0;
p.hints.maximum = 16;
p.hints.ranged = true;
p.hints.visible = false;
p.connect_to( new float );
p.control_value_no_callback( 0 );
add_port( p );
}
{
Port p( this, Port::INPUT, Port::CONTROL, "Outputs" );
p.hints.type = Port::Hints::INTEGER;
p.hints.minimum = 0;
p.hints.maximum = 16;
p.hints.ranged = true;
p.hints.visible = false;
p.connect_to( new float );
p.control_value_no_callback( 0 );
add_port( p );
}
color( FL_DARK1 );
log_create();
}
{ Fl_Scalepack *o = new Fl_Scalepack( x() + Fl::box_dx(box()),
y() + Fl::box_dy(box()),
w() - Fl::box_dw(box()),
h() - Fl::box_dh(box()) );
o->type( Fl_Pack::VERTICAL );
o->spacing(0);
{ Fl_Scalepack *o = new Fl_Scalepack( x() + Fl::box_dx(box()),
y() + Fl::box_dy(box()),
w(),
24 - Fl::box_dh(box()) );
o->type( Fl_Pack::HORIZONTAL );
o->spacing( 0 );
{ Fl_Box *o = input_connection_handle = new Fl_Box( x(), y(), 18, 18 );
o->tooltip( "Drag and drop to make and break JACK connections.");
o->hide();
o->image( input_connector_image ? input_connector_image : input_connector_image = new Fl_PNG_Image( "input_connector", img_io_input_connector_10x10_png, img_io_input_connector_10x10_png_len ) );
}
{ Fl_Box *o = new Fl_Box( x() + 10, y(), w() - 20, h() );
Fl_Group::current()->resizable(o);
}
{ Fl_Button *o = dec_button = new Fl_Button( 0, 0, 12, h(), "-" );
o->callback( cb_button, this );
o->labelsize(10);
o->labelfont( FL_HELVETICA_BOLD );
o->hide();
}
{ Fl_Button *o = inc_button = new Fl_Button( 0,0, 12, h(), "+" );
o->labelsize(10);
o->labelfont( FL_HELVETICA_BOLD );
o->callback( cb_button, this );
o->hide();
}
{ Fl_Box *o = output_connection_handle = new Fl_Box( x(), y(), 12, 12 );
o->tooltip( "Drag and drop to make and break JACK connections.");
o->image( output_connector_image ? output_connector_image : output_connector_image = new Fl_PNG_Image( "output_connector", img_io_output_connector_10x10_png, img_io_output_connector_10x10_png_len ) );
o->hide();
}
{ Fl_Box *o = output_connection2_handle = new Fl_Box( x(), y(), 12, 12 );
o->tooltip( "Drag and drop to make and break JACK connections.");
//.........这里部分代码省略.........
示例5: main
int main(int argc, char** argv)
{
// Check config option, if showing is disabled, exit
Fl_Config conf("EDE Team", "etip");
if(argc == 2 && (!strcmp(argv[1], "-f") || !strcmp(argv[1], "--force")))
{
// nothing, to simplify omiting those '!'
}
else
{
bool show = true;
conf.set_section("Tips");
conf.read("Show", show, true);
if (!show)
return 0;
}
conf_global = &conf;
srand(time(NULL));
fl_init_locale_support("etip", PREFIX"/share/locale");
Fl_Window* win = new Fl_Window(420, 169, _("Tips..."));
win->shortcut(0xff1b);
win->begin();
Fl_Group* gr = new Fl_Group(5, 5, 410, 130);
gr->box(FL_DOWN_BOX);
Fl_Box* img = new Fl_Box(5, 5, 70, 65);
Fl_Image pix(hint_xpm);
img->image(pix);
Fl_Box* title = new Fl_Box(80, 10, 320, 25, random_txt(title_tips, TITLE_TIPS_NUM));
title->label_font(fl_fonts+1);
title->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
title->box(FL_FLAT_BOX);
Fl_Box* tiptxt = new Fl_Box(80, 45, 320, 75, random_txt(tiplist, TIPS_NUM));
tiptxt->align(FL_ALIGN_LEFT|FL_ALIGN_TOP|FL_ALIGN_INSIDE|FL_ALIGN_WRAP);
tiptxt->box(FL_FLAT_BOX);
gr->end();
Fl_Check_Button* ch = new Fl_Check_Button(5, 140, 150, 25, _(" Do not bother me"));
show_check = ch;
Fl_Button* prev = new Fl_Button(160, 140, 80, 25, "<-");
prev->label_font(fl_fonts+1);
prev->callback(prev_cb, tiptxt);
Fl_Button* next = new Fl_Button(245, 140, 80, 25, "->");
next->label_font(fl_fonts+1);
next->callback(next_cb, tiptxt);
Fl_Button* close = new Fl_Button(335, 140, 80, 25, _("&Close"));
close->callback(close_cb, win);
win->end();
win->set_modal();
win->show();
return Fl::run();
}
示例6: folderScroll
FolderWindow::FolderWindow(int x, int y, int wid, int hgt,
const char *label, int folderIndex) :
Fl_Group(x, y, wid, hgt, label),
folderScroll(NULL), folderPack(NULL),
fileOpsLabel(NULL), fileLabel(NULL)
{
// label configuration:
//labelcolor(GUI_TEXT_COLOR);
labelfont(LOCAL_BFFONT);
labelsize(LOCAL_TEXT_SIZE);
// icon configuration:
structureIcon = new Fl_RGB_Image(StructureOperationIcon.pixel_data,
StructureOperationIcon.width, StructureOperationIcon.height,
StructureOperationIcon.bytes_per_pixel);
Fl_Box *structIconBox = new Fl_Box(x, y - 39, structureIcon->w(), structureIcon->h());
structIconBox->image(structureIcon);
int dividerTextHeight = 0, spacingHeight = NAVBUTTONS_SPACING;
int fileOpsLabelHeight = 2 * NAVBUTTONS_BHEIGHT;
int fileOpsLabelWidth = 2 * NAVBUTTONS_BWIDTH + 2 * NAVBUTTONS_SPACING;
int initYOffset = NAVBUTTONS_OFFSETY + RNAStructVizLogo.height + 5; // y + 36 + dividerTextHeight
const char *fileOpsLabelText = "@reload Structure Operations.\nEach operation opens a new window.";
fileOpsLabel = new Fl_Box(x + NAVBUTTONS_SPACING, initYOffset,
fileOpsLabelWidth, fileOpsLabelHeight,
fileOpsLabelText);
fileOpsLabel->align(FL_ALIGN_CENTER | FL_ALIGN_INSIDE | FL_ALIGN_LEFT);
fileOpsLabel->color(GUI_BGCOLOR);
fileOpsLabel->labelcolor(GUI_BTEXT_COLOR);
fileOpsLabel->labelfont(LOCAL_BFFONT);
fileOpsLabel->labelsize(LOCAL_TEXT_SIZE);
fileOpsLabel->box(FL_RSHADOW_BOX);
int opButtonWidth = 110;
int yOffset = initYOffset + fileOpsLabelHeight;
Fl_Button* diagramButton = new Fl_Button(x + 20, yOffset + spacingHeight,
opButtonWidth, 30,
"Diagram @>|");
diagramButton->callback(DiagramCallback);
diagramButton->labelcolor(GUI_BTEXT_COLOR);
Fl_Button* statsButton = new Fl_Button(x + 20 + opButtonWidth +
spacingHeight, yOffset + spacingHeight,
opButtonWidth, 30,
"Statistics @>|");
statsButton->callback(StatsCallback);
statsButton->labelcolor(GUI_BTEXT_COLOR);
const char *fileInstText = "@filenew Files.\nClick on the file buttons to view\nCT file contents in new window.";
fileLabel = new Fl_Box(x + NAVBUTTONS_SPACING, y + yOffset + spacingHeight,
fileOpsLabelWidth, fileOpsLabelHeight, fileInstText);
fileLabel->align(FL_ALIGN_CENTER | FL_ALIGN_INSIDE | FL_ALIGN_LEFT);
fileLabel->color(GUI_BGCOLOR);
fileLabel->labelcolor(GUI_BTEXT_COLOR);
fileLabel->labelfont(LOCAL_BFFONT);
fileLabel->labelsize(LOCAL_TEXT_SIZE);
fileLabel->box(FL_RSHADOW_BOX);
folderScroll = new Fl_Scroll(x+10, y + yOffset + fileOpsLabelHeight +
dividerTextHeight + 3 * spacingHeight,
280, 310 - 2 * fileOpsLabelHeight - dividerTextHeight -
2 * spacingHeight - NAVBUTTONS_BHEIGHT);
folderScroll->type(Fl_Scroll::VERTICAL_ALWAYS);
folderPack = new Fl_Pack(x+10, y + yOffset + fileOpsLabelHeight +
dividerTextHeight + 3 * spacingHeight, 260,
290 - 2 * fileOpsLabelHeight - dividerTextHeight -
2 * spacingHeight - NAVBUTTONS_BHEIGHT);
folderPack->type(Fl_Pack::VERTICAL);
folderScroll->color((Fl_Color) GUI_WINDOW_BGCOLOR);
folderScroll->labelcolor((Fl_Color) GUI_BTEXT_COLOR);
this->resizable(folderScroll);
this->color(GUI_WINDOW_BGCOLOR);
SetStructures(folderIndex);
}