示例#1
0
	static int l_set_inner_widget(lua_State *l) {
		Scroller *s = LuaObject<UI::Scroller>::CheckFromLua(1);
		Context *c = s->GetContext();
		Widget *w = UI::Lua::CheckWidget(c, l, 2);
		s->SetInnerWidget(w);
		lua_pushvalue(l, 1);
		return 1;
	}
示例#2
0
// SetScrollSource
//
// Sets a new scroll source. Notifies the old and the new source
// of the change if necessary .
void
Scrollable::SetScrollSource(Scroller* source)
{
	Scroller* oldSource = fScrollSource;
	if (oldSource != source) {
		fScrollSource = NULL;
		// Notify the old source, if it doesn't know about the change.
		if (oldSource && oldSource->ScrollTarget() == this)
			fScrollSource->SetScrollTarget(NULL);
		fScrollSource = source;
		// Notify the new source, if it doesn't know about the change.
		if (source && source->ScrollTarget() != this)
			source->SetScrollTarget(this);
		// Notify ourselves.
		ScrollSourceChanged(oldSource, fScrollSource);
	}
}
示例#3
0
int Program::main(const std::vector<CL_String> &args)
{
    try
    {
        // Initialize ClanLib base components
        CL_SetupCore setup_core;

        // Initialize the ClanLib display component
        CL_SetupDisplay setup_display;

#ifdef USE_SOFTWARE_RENDERER
        CL_SetupSWRender setup_swrender;
#endif

#ifdef USE_OPENGL_1
        CL_SetupGL1 setup_gl1;
#endif

#ifdef USE_OPENGL_2
        CL_SetupGL setup_gl;
#endif

        // Start the Application
        Scroller app;
        int retval = app.start(args);
        return retval;
    }
    catch(CL_Exception &exception)
    {
        // Create a console window for text-output if not available
        CL_ConsoleWindow console("Console", 80, 160);
        CL_Console::write_line("Exception caught: " + exception.get_message_and_stack_trace());
        console.display_close_message();

        return -1;
    }
}
示例#4
0
文件: UIList.cpp 项目: tapio/Wendy
void List::onValueChanged(Scroller& scroller)
{
  setOffset((uint) scroller.value());
}
示例#5
0
	static int l_attr_inner_widget(lua_State *l) {
		Scroller *s = LuaObject<UI::Scroller>::CheckFromLua(1);
		LuaObject<UI::Widget>::PushToLua(s->GetInnerWidget());
		return 1;
	}
示例#6
0
	static int l_remove_inner_widget(lua_State *l) {
		Scroller *s = LuaObject<UI::Scroller>::CheckFromLua(1);
		s->RemoveInnerWidget();
		return 0;
	}
示例#7
0
文件: test_entry.cpp 项目: gzorin/e17
void test_entry_scolled (void *data, Evas_Object *obj, void *event_info)
{
  Button *bt = NULL;
  Entry *en = NULL;
  Scroller *sc = NULL;

  Window *win = Window::factory ("entry-scrolled", ELM_WIN_BASIC);
  win->setTitle ("Entry Scrolled");
  win->setAutoDel (true);

  Background *bg = Background::factory (*win);
  win->addObjectResize (*bg);
  bg->setWeightHintSize (EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
  bg->show ();

  Box *bx = Box::factory (*win);
  bx->setWeightHintSize (EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
  win->addObjectResize (*bx);
  bx->show ();

  sc = Scroller::factory (*win);
  sc->limitMinContent (false, true);
  sc->setPolicy (ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
  sc->setWeightHintSize (EVAS_HINT_EXPAND, 0.0);
  sc->setAlignHintSize (EVAS_HINT_FILL, EVAS_HINT_FILL);
  bx->packEnd (*sc);

  en = Entry::factory (*win);
  en->setSingleLine (true);
  en->setText ("This is a single line");
  en->setWeightHintSize (EVAS_HINT_EXPAND, 0.0);
  en->setAlignHintSize (EVAS_HINT_FILL, 0.5);
  en->selectAll ();
  sc->setContent (*en);
  en->show ();

  sc->show ();

  sc = Scroller::factory (*win);
  sc->limitMinContent (false, true);
  sc->setPolicy (ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
  sc->setWeightHintSize (EVAS_HINT_EXPAND, 0.0);
  sc->setAlignHintSize (EVAS_HINT_FILL, EVAS_HINT_FILL);
  bx->packEnd (*sc);

  en = Entry::factory (*win);
  en->setPassword (true);
  en->setText ("Password here");
  en->setWeightHintSize (EVAS_HINT_EXPAND, 0.0);
  en->setAlignHintSize (EVAS_HINT_FILL, 0.0);
  en->selectAll ();
  sc->setContent (*en);
  en->show ();

  sc->show ();

  sc = Scroller::factory (*win);
  sc->setWeightHintSize (EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
  sc->setAlignHintSize (EVAS_HINT_FILL, EVAS_HINT_FILL);
  sc->setPolicy (ELM_SCROLLER_POLICY_ON, ELM_SCROLLER_POLICY_ON);
  bx->packEnd (*sc);

  en = Entry::factory (*win);
  en->setText ("This is an entry widget in this window that<br>"
               "uses markup <b>like this</> for styling and<br>"
               "formatting <em>like this</>, as well as<br>"
               "<a href=X><link>links in the text</></a>, so enter text<br>"
               "in here to edit it. By the way, links are<br>"
               "called <a href=anc-02>Anchors</a> so you will need<br>"
               "to refer to them this way. At the end here is a really long line to test line wrapping to see if it works. But just in case this line is not long enough I will add more here to really test it out, as Elementary really needs some good testing to see if entry widgets work as advertised.");

  en->setWeightHintSize (EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
  en->setAlignHintSize (EVAS_HINT_FILL, EVAS_HINT_FILL);
  sc->setContent (*en);
  en->show ();

  sc->show ();

  Box *bx2 = Box::factory (*win);
  bx2->setOrientation (Box::Horizontal);
  bx2->setWeightHintSize (EVAS_HINT_EXPAND, 0.0);
  bx2->setAlignHintSize (EVAS_HINT_FILL, EVAS_HINT_FILL);


  bt = Button::factory (*win);
  bt->setLabel ("Clear");
  bt->getEventSignal ("clicked")->connect (sigc::bind (sigc::ptr_fun (&my_entry_bt_1), en));
  bt->setAlignHintSize (EVAS_HINT_FILL, EVAS_HINT_FILL);
  bt->setWeightHintSize (EVAS_HINT_EXPAND, 0.0);
  bx2->packEnd (*bt);
  bt->show ();

  bt = Button::factory (*win);
  bt->setLabel ("Print");
  bt->getEventSignal ("clicked")->connect (sigc::bind (sigc::ptr_fun (&my_entry_bt_2), en));
  bt->setAlignHintSize (EVAS_HINT_FILL, EVAS_HINT_FILL);
  bt->setWeightHintSize (EVAS_HINT_EXPAND, 0.0);
  bx2->packEnd (*bt);
  bt->show ();

  bt = Button::factory (*win);
  bt->setLabel ("Selection");
  bt->getEventSignal ("clicked")->connect (sigc::bind (sigc::ptr_fun (&my_entry_bt_3), en));
  bt->setAlignHintSize (EVAS_HINT_FILL, EVAS_HINT_FILL);
  bt->setWeightHintSize (EVAS_HINT_EXPAND, 0.0);
  bx2->packEnd (*bt);
  bt->show ();

  bt = Button::factory (*win);
  bt->setLabel ("Insert");
  bt->getEventSignal ("clicked")->connect (sigc::bind (sigc::ptr_fun (&my_entry_bt_4), en));
  bt->setAlignHintSize (EVAS_HINT_FILL, EVAS_HINT_FILL);
  bt->setWeightHintSize (EVAS_HINT_EXPAND, 0.0);
  bx2->packEnd (*bt);
  bt->show ();

  bx->packEnd (*bx2);
  bx2->show ();

  win->resize (size320x320);

  win->setFocus (true);
  win->show ();
}
示例#8
0
 void update(Control* p) {
   Scroller* scroller = dynamic_cast<Scroller*>(p);
   assert(scroller);
   delta = scroller->get_delta();
   notify_parent();
 }
示例#9
0
	int OnEvent(Event* e)
	{
		_scroller.OnEvent(e);
		switch (e->Type)
		{
			case Event::OpenApp:
				{
					Graphics.Clear(0xFFFF);
					const char* name = (const char*)e->Data;

					_file.Init();
					_file.Open(name);
					strcpy(_name,name);
					_height = 320;

					const char* ext = name;
					while (*ext && *ext != '.')
						ext++;

					//	Determine file type
					_type = UNKNOWN;
					if (ext[0] == '.')
					{
						if (ext[1] == 'I' && ext[2] == 'M' && ext[3] == '2')
							_type = IM2;
						else if (ext[1] == 'B' && ext[2] == 'L' && ext[3] == 'B')
							_type = BLB;
						//else if (ext[1] == 'J' && ext[2] == 'P' && ext[3] == 'G')
						//	_type = JPG;
					}

					switch (_type)
					{
						case IM2:
							OpenIM2();
							break;
						default:;
					}

					// Init scroller, do initial draw
					_scroller.Init(_height,OnDraw,this,Scroller::PageScroll);
				}
				break;

			case Event::TouchDown:
				{
					TouchData* t = e->Touch;
					if (t->y >= 320)
						return -1;	// touched black bar quit
				}
				break;

			case Event::TouchMove:
				break;

			case Event::TouchUp:
				break;

			case Event::None:
				break;

			default:;
		}
		return 0;
	}
示例#10
0
文件: main.cpp 项目: Limsik/e17
int main (int argc, char **argv)
{
  Application elmApp (argc, argv);

  Window *elmWin = Window::factory ("window1", ELM_WIN_BASIC);
  elmWin->getEventSignal ("delete,request")->connect (sigc::ptr_fun (&my_win_del));

  Background *bg = Background::factory (*elmWin);

  //Evas *e = evas_object_evas_get(bg->obj ());

/*  Evasxx::Canvas ec (e);

  Evasxx::Image ei (ec);
  ei.setFile (searchPixmapFile ("elementaryxx/plant_01.jpg"));
  ei.setGeometry (Rect (100,100, 100, 100));
  ei.show ();*/

  Button *elmButton = Button::factory (*elmWin);
  Clock *elmClock = Clock::factory (*elmWin);
  //elmWin->addMember (ei);
  //Toggle *elmToggle = Toggle::factory (*elmWin);
  Scroller *elmScroller = Scroller::factory (*elmWin);
  Entry *elmEntry = Entry::factory (*elmWin);
  Slider *elmSlider = Slider::factory (*elmWin);

  bg->setWeightHintSize (1.0, 1.0);
  elmWin->addObjectResize (*bg);

  /* set size hints. a minimum size for the bg. this should propagate back
   * to the window thus limiting its size based off the bg as the bg is one
   * of the window's resize objects. */
  bg->setMinHintSize (Size (160, 160));
  /* and set a maximum size. not needed very often. normally used together
   * with evas_object_size_hint_min_set() at the same size to make a
   * window not resizable */
  bg->setMaxHintSize (Size (640, 640));

  elmWin->resize (Size (500, 500));
  elmButton->resize (Size (100, 50));
  elmClock->setGeometry (Rect (100, 50, 200, 50));
  //elmToggle->setGeometry (Rect (150, 80, 100, 50));
  elmScroller->setGeometry (Rect (250, 120, 200, 200));
  elmEntry->setGeometry (Rect (150, 200, 100, 50));
  elmSlider->setGeometry (Rect (200, 200, 100, 50));

  elmWin->setTitle ("Elementaryxx Simple Example");

  elmButton->setText ("Text");

  elmClock->setEdit (true);

  elmWin->setAutoDel (true);

  //elmToggle->getEventSignal ("sub-object-del")->connect (sigc::ptr_fun (&testFunc));

  elmWin->show ();
  bg->show ();
  elmButton->show ();
  elmClock->show ();
  //elmToggle->show ();
  elmScroller->show ();
  elmEntry->show ();
  elmSlider->show ();

  elmApp.run ();
}