Skip to content

Commit ee0cb0e

Browse files
committed
More work
1 parent 4d80422 commit ee0cb0e

File tree

2 files changed

+71
-83
lines changed

2 files changed

+71
-83
lines changed

modules/yup_python/bindings/yup_YupGui_bindings.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,20 @@ void registerYupGuiBindings (py::module_& m)
157157
.def ("isInitialising", &YUPApplication::isInitialising)
158158
;
159159

160+
// ============================================================================================ yup::Component
161+
162+
py::class_<Component, PyComponent<>> classComponent (m, "Component");
163+
164+
classComponent
165+
.def (py::init_alias<>())
166+
.def ("getTitle", &Component::getTitle)
167+
.def ("setTitle", &Component::setTitle)
168+
.def ("isVisible", &Component::isVisible)
169+
.def ("setVisible", &Component::setVisible)
170+
.def ("isEnabled", &Component::isEnabled)
171+
.def ("setEnabled", &Component::setEnabled)
172+
;
173+
160174
#if ! YUP_PYTHON_EMBEDDED_INTERPRETER
161175

162176
// =================================================================================================

modules/yup_python/bindings/yup_YupGui_bindings.h

Lines changed: 57 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ struct PyMouseListener : Base
247247
PYBIND11_OVERRIDE (void, Base, mouseDoubleClick, event);
248248
}
249249

250-
void mouseWheelMove (const yup::MouseEvent& event, const yup::MouseWheelData& wheel) override
250+
void mouseWheel (const yup::MouseEvent& event, const yup::MouseWheelData& wheel) override
251251
{
252252
{
253253
pybind11::gil_scoped_acquire gil;
@@ -263,10 +263,10 @@ struct PyMouseListener : Base
263263
// Base::mouseWheelMove (event, wheel);
264264
}
265265

266-
void mouseMagnify (const yup::MouseEvent& event, float scaleFactor) override
267-
{
268-
PYBIND11_OVERRIDE (void, Base, mouseMagnify, event, scaleFactor);
269-
}
266+
//void mouseMagnify (const yup::MouseEvent& event, float scaleFactor) override
267+
//{
268+
// PYBIND11_OVERRIDE (void, Base, mouseMagnify, event, scaleFactor);
269+
//}
270270
};
271271

272272
// =================================================================================================
@@ -276,15 +276,15 @@ struct PyComponent : PyMouseListener<Base>
276276
{
277277
using PyMouseListener<Base>::PyMouseListener;
278278

279-
void setName (const yup::String& newName) override
280-
{
281-
PYBIND11_OVERRIDE (void, Base, setName, newName);
282-
}
279+
//void setTitle (const yup::String& newName) override
280+
//{
281+
// PYBIND11_OVERRIDE (void, Base, setName, newName);
282+
//}
283283

284-
void setVisible (bool shouldBeVisible) override
285-
{
286-
PYBIND11_OVERRIDE (void, Base, setVisible, shouldBeVisible);
287-
}
284+
//void setVisible (bool shouldBeVisible) override
285+
//{
286+
// PYBIND11_OVERRIDE (void, Base, setVisible, shouldBeVisible);
287+
//}
288288

289289
void visibilityChanged() override
290290
{
@@ -296,15 +296,15 @@ struct PyComponent : PyMouseListener<Base>
296296
PYBIND11_OVERRIDE (void, Base, userTriedToCloseWindow);
297297
}
298298

299-
void minimisationStateChanged(bool isNowMinimised) override
300-
{
301-
PYBIND11_OVERRIDE (void, Base, minimisationStateChanged, isNowMinimised);
302-
}
299+
//void minimisationStateChanged(bool isNowMinimised) override
300+
//{
301+
// PYBIND11_OVERRIDE (void, Base, minimisationStateChanged, isNowMinimised);
302+
//}
303303

304-
float getDesktopScaleFactor() const override
305-
{
306-
PYBIND11_OVERRIDE (float, Base, getDesktopScaleFactor);
307-
}
304+
//float getDesktopScaleFactor() const override
305+
//{
306+
// PYBIND11_OVERRIDE (float, Base, getDesktopScaleFactor);
307+
//}
308308

309309
void parentHierarchyChanged() override
310310
{
@@ -316,25 +316,25 @@ struct PyComponent : PyMouseListener<Base>
316316
PYBIND11_OVERRIDE (void, Base, childrenChanged);
317317
}
318318

319-
bool hitTest (int x, int y) override
320-
{
321-
PYBIND11_OVERRIDE (bool, Base, hitTest, x, y);
322-
}
319+
//bool hitTest (int x, int y) override
320+
//{
321+
// PYBIND11_OVERRIDE (bool, Base, hitTest, x, y);
322+
//}
323323

324-
void lookAndFeelChanged() override
325-
{
326-
PYBIND11_OVERRIDE (void, Base, lookAndFeelChanged);
327-
}
324+
//void lookAndFeelChanged() override
325+
//{
326+
// PYBIND11_OVERRIDE (void, Base, lookAndFeelChanged);
327+
//}
328328

329329
void enablementChanged() override
330330
{
331331
PYBIND11_OVERRIDE (void, Base, enablementChanged);
332332
}
333333

334-
void alphaChanged() override
335-
{
336-
PYBIND11_OVERRIDE (void, Base, alphaChanged);
337-
}
334+
//void alphaChanged() override
335+
//{
336+
// PYBIND11_OVERRIDE (void, Base, alphaChanged);
337+
//}
338338

339339
void paint (yup::Graphics& g) override
340340
{
@@ -367,15 +367,15 @@ struct PyComponent : PyMouseListener<Base>
367367
Base::paintOverChildren (g);
368368
}
369369

370-
bool keyPressed (const yup::KeyPress& key) override
371-
{
372-
PYBIND11_OVERRIDE (bool, Base, keyPressed, key);
373-
}
370+
//bool keyPressed (const yup::KeyPress& key) override
371+
//{
372+
// PYBIND11_OVERRIDE (bool, Base, keyPressed, key);
373+
//}
374374

375-
bool keyStateChanged (bool isDown) override
376-
{
377-
PYBIND11_OVERRIDE (bool, Base, keyStateChanged, isDown);
378-
}
375+
//bool keyStateChanged (bool isDown) override
376+
//{
377+
// PYBIND11_OVERRIDE (bool, Base, keyStateChanged, isDown);
378+
//}
379379

380380
//void modifierKeysChanged (const yup::ModifierKeys& modifiers) override
381381
//{
@@ -407,51 +407,25 @@ struct PyComponent : PyMouseListener<Base>
407407
PYBIND11_OVERRIDE (void, Base, moved);
408408
}
409409

410-
void childBoundsChanged (yup::Component* child) override
411-
{
412-
PYBIND11_OVERRIDE (void, Base, childBoundsChanged, child);
413-
}
414-
415-
void parentSizeChanged() override
416-
{
417-
PYBIND11_OVERRIDE (void, Base, parentSizeChanged);
418-
}
419-
420-
void broughtToFront() override
421-
{
422-
PYBIND11_OVERRIDE (void, Base, broughtToFront);
423-
}
424-
425-
void handleCommandMessage (int commandId) override
426-
{
427-
{
428-
pybind11::gil_scoped_acquire gil;
429-
430-
if (pybind11::function override_ = pybind11::get_override (static_cast<Base*> (this), "handleCommandMessage"); override_)
431-
{
432-
override_ (commandId);
433-
return;
434-
}
435-
}
436-
437-
//if constexpr (! std::is_same_v<Base, yup::TextEditor>)
438-
// Base::handleCommandMessage (commandId);
439-
}
410+
//void childBoundsChanged (yup::Component* child) override
411+
//{
412+
// PYBIND11_OVERRIDE (void, Base, childBoundsChanged, child);
413+
//}
440414

441-
bool canModalEventBeSentToComponent (const yup::Component* targetComponent) override
442-
{
443-
PYBIND11_OVERRIDE (bool, Base, canModalEventBeSentToComponent, targetComponent);
444-
}
415+
//void parentSizeChanged() override
416+
//{
417+
// PYBIND11_OVERRIDE (void, Base, parentSizeChanged);
418+
//}
445419

446-
void inputAttemptWhenModal () override
447-
{
448-
PYBIND11_OVERRIDE (void, Base, inputAttemptWhenModal);
449-
}
420+
//void broughtToFront() override
421+
//{
422+
// PYBIND11_OVERRIDE (void, Base, broughtToFront);
423+
//}
450424

451-
void colourChanged () override
452-
{
453-
PYBIND11_OVERRIDE (void, Base, colourChanged);
454-
}
425+
//void colourChanged () override
426+
//{
427+
// PYBIND11_OVERRIDE (void, Base, colourChanged);
428+
//}
455429
};
456430

457431
} // namespace yup::Bindings

0 commit comments

Comments
 (0)