Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-1.1
Commits
f08d346e
Commit
f08d346e
authored
Dec 12, 2005
by
Clément Stenac
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle all types of buttons and fix layouts
parent
a483f98c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
121 additions
and
32 deletions
+121
-32
modules/gui/wxwidgets/dialogs/interaction.cpp
modules/gui/wxwidgets/dialogs/interaction.cpp
+117
-32
modules/gui/wxwidgets/dialogs/interaction.hpp
modules/gui/wxwidgets/dialogs/interaction.hpp
+4
-0
No files found.
modules/gui/wxwidgets/dialogs/interaction.cpp
View file @
f08d346e
...
...
@@ -28,6 +28,8 @@
#include <wx/statline.h>
#define FREE( i ) { if( i ) free( i ); i = NULL; }
/*****************************************************************************
* Event Table.
*****************************************************************************/
...
...
@@ -37,7 +39,9 @@ enum
{
OkYes_Event
,
No_Event
,
Cancel_Event
Cancel_Event
,
Clear_Event
,
NoShow_Event
};
BEGIN_EVENT_TABLE
(
InteractionDialog
,
wxFrame
)
...
...
@@ -45,6 +49,8 @@ BEGIN_EVENT_TABLE( InteractionDialog, wxFrame)
EVT_BUTTON
(
OkYes_Event
,
InteractionDialog
::
OnOkYes
)
EVT_BUTTON
(
Cancel_Event
,
InteractionDialog
::
OnCancel
)
EVT_BUTTON
(
No_Event
,
InteractionDialog
::
OnNo
)
EVT_BUTTON
(
Clear_Event
,
InteractionDialog
::
OnClear
)
EVT_CHECKBOX
(
NoShow_Event
,
InteractionDialog
::
OnNoShow
)
END_EVENT_TABLE
()
/*****************************************************************************
...
...
@@ -69,11 +75,12 @@ InteractionDialog::InteractionDialog( intf_thread_t *_p_intf,
buttons_panel
->
SetSizer
(
buttons_sizer
);
main_sizer
=
new
wxBoxSizer
(
wxVERTICAL
);
main_sizer
->
Add
(
widgets_panel
,
0
,
wxEXPAND
|
wxALL
,
5
);
main_sizer
->
Add
(
widgets_panel
,
1
,
wxEXPAND
|
wxALL
,
5
);
main_sizer
->
Add
(
new
wxStaticLine
(
this
,
-
1
),
0
,
wxEXPAND
);
main_sizer
->
Add
(
buttons_panel
,
0
,
wxEXPAND
|
wxALL
,
5
);
SetSizer
(
main_sizer
);
b_noshow
=
false
;
Render
();
}
...
...
@@ -84,10 +91,15 @@ InteractionDialog::~InteractionDialog()
void
InteractionDialog
::
Update
(
)
{
widgets_panel
->
DestroyChildren
();
/* FIXME: Needed for the spacer */
buttons_sizer
->
Remove
(
1
);
buttons_sizer
->
Remove
(
2
);
buttons_sizer
->
Remove
(
3
);
buttons_panel
->
DestroyChildren
();
input_widgets
.
clear
();
Render
();
if
(
b_noshow
==
false
)
{
Show
();
}
}
/// \todo Dirty - Clean that up
...
...
@@ -96,6 +108,25 @@ void InteractionDialog::Render()
wxStaticText
*
label
;
wxTextCtrl
*
input
;
if
(
p_dialog
->
i_id
==
DIALOG_ERRORS
)
{
wxTextCtrl
*
errors
;
// Special case
label
=
new
wxStaticText
(
widgets_panel
,
-
1
,
wxU
(
_
(
"The following errors happened. More details might be available "
"in the log file."
)
)
);
errors
=
new
wxTextCtrl
(
widgets_panel
,
-
1
,
wxT
(
""
),
wxDefaultPosition
,
wxDefaultSize
,
wxTE_MULTILINE
|
wxTE_READONLY
);
for
(
int
i
=
0
;
i
<
p_dialog
->
i_widgets
;
i
++
)
{
(
*
errors
)
<<
wxL2U
(
p_dialog
->
pp_widgets
[
i
]
->
psz_text
)
<<
wxU
(
"
\n
"
)
;
}
widgets_sizer
->
Add
(
label
);
widgets_sizer
->
Add
(
errors
,
0
,
wxEXPAND
|
wxALL
,
3
);
}
else
{
//-------------- Widgets ------------------
for
(
int
i
=
0
;
i
<
p_dialog
->
i_widgets
;
i
++
)
{
...
...
@@ -112,8 +143,8 @@ void InteractionDialog::Render()
label
=
new
wxStaticText
(
widgets_panel
,
-
1
,
wxU
(
p_widget
->
psz_text
)
);
input
=
new
wxTextCtrl
(
widgets_panel
,
-
1
);
widgets_sizer
->
Add
(
label
);
widgets_sizer
->
Add
(
input
);
widgets_sizer
->
Add
(
label
,
0
,
0
,
0
);
widgets_sizer
->
Add
(
input
,
0
,
wxEXPAND
,
0
);
InputWidget
widget
;
widget
.
control
=
input
;
...
...
@@ -122,10 +153,7 @@ void InteractionDialog::Render()
input_widgets
.
push_back
(
widget
);
}
}
widgets_sizer
->
Layout
();
widgets_panel
->
SetSizerAndFit
(
widgets_sizer
);
main_sizer
->
Layout
();
SetSizerAndFit
(
main_sizer
);
}
//-------------- Buttons ------------------
if
(
p_dialog
->
i_flags
&
DIALOG_OK_CANCEL
)
...
...
@@ -134,10 +162,39 @@ void InteractionDialog::Render()
OkYes_Event
,
wxU
(
_
(
"OK"
)
)
);
wxButton
*
cancel
=
new
wxButton
(
buttons_panel
,
Cancel_Event
,
wxU
(
_
(
"Cancel"
)
)
);
buttons_sizer
->
Add
(
ok
,
0
,
wxEXPAND
|
wxRIGHT
|
wxLEFT
,
5
);
buttons_sizer
->
Add
(
cancel
,
0
,
wxEXPAND
|
wxRIGHT
|
wxLEFT
,
5
);
buttons_sizer
->
Add
(
ok
,
0
,
wxEXPAND
|
wxRIGHT
|
wxLEFT
|
wxALIGN_CENTER
,
5
);
buttons_sizer
->
Add
(
cancel
,
0
,
wxEXPAND
|
wxRIGHT
|
wxLEFT
|
wxALIGN_CENTER
,
5
);
}
else
if
(
p_dialog
->
i_flags
&
DIALOG_YES_NO_CANCEL
)
{
wxButton
*
yes
=
new
wxButton
(
buttons_panel
,
OkYes_Event
,
wxU
(
_
(
"Yes"
)
)
);
wxButton
*
no
=
new
wxButton
(
buttons_panel
,
No_Event
,
wxU
(
_
(
"No"
)
)
);
wxButton
*
cancel
=
new
wxButton
(
buttons_panel
,
Cancel_Event
,
wxU
(
_
(
"Cancel"
)
)
);
buttons_sizer
->
Add
(
yes
,
0
,
wxEXPAND
|
wxRIGHT
|
wxLEFT
|
wxALIGN_CENTER
,
5
);
buttons_sizer
->
Add
(
no
,
0
,
wxEXPAND
|
wxRIGHT
|
wxLEFT
|
wxALIGN_CENTER
,
5
);
buttons_sizer
->
Add
(
cancel
,
0
,
wxEXPAND
|
wxRIGHT
|
wxLEFT
|
wxALIGN_CENTER
,
5
);
}
else
if
(
p_dialog
->
i_flags
&
DIALOG_CLEAR_NOSHOW
)
{
wxCheckBox
*
noshow
=
new
wxCheckBox
(
buttons_panel
,
NoShow_Event
,
wxU
(
_
(
"Don't show"
)
)
);
noshow
->
SetValue
(
b_noshow
);
wxButton
*
clear
=
new
wxButton
(
buttons_panel
,
Clear_Event
,
wxU
(
_
(
"Clear"
)
)
);
buttons_sizer
->
Add
(
noshow
,
0
,
wxEXPAND
|
wxRIGHT
|
wxLEFT
|
wxALIGN_LEFT
,
5
);
buttons_sizer
->
Add
(
0
,
0
,
1
);
buttons_sizer
->
Add
(
clear
,
0
,
wxEXPAND
|
wxRIGHT
|
wxLEFT
|
wxALIGN_RIGHT
,
5
);
}
widgets_sizer
->
Layout
();
widgets_panel
->
SetSizerAndFit
(
widgets_sizer
);
buttons_sizer
->
Layout
();
buttons_panel
->
SetSizerAndFit
(
buttons_sizer
);
main_sizer
->
Layout
();
SetSizerAndFit
(
main_sizer
);
}
/*****************************************************************************
...
...
@@ -163,8 +220,35 @@ void InteractionDialog::OnOkYes( wxCommandEvent& event )
Finish
(
DIALOG_OK_YES
);
}
void
InteractionDialog
::
OnClear
(
wxCommandEvent
&
event
)
{
int
i
;
vlc_mutex_lock
(
&
p_dialog
->
p_interaction
->
object_lock
);
for
(
i
=
p_dialog
->
i_widgets
-
1
;
i
>=
0
;
i
--
)
{
user_widget_t
*
p_widget
=
p_dialog
->
pp_widgets
[
i
];
FREE
(
p_widget
->
psz_text
);
FREE
(
p_widget
->
val
.
psz_string
);
REMOVE_ELEM
(
p_dialog
->
pp_widgets
,
p_dialog
->
i_widgets
,
i
);
free
(
p_widget
);
}
widgets_panel
->
DestroyChildren
();
/* FIXME: Needed for the spacer */
buttons_sizer
->
Remove
(
1
);
buttons_sizer
->
Remove
(
2
);
buttons_sizer
->
Remove
(
3
);
buttons_panel
->
DestroyChildren
();
input_widgets
.
clear
();
vlc_mutex_unlock
(
&
p_dialog
->
p_interaction
->
object_lock
);
Render
();
}
void
InteractionDialog
::
OnNoShow
(
wxCommandEvent
&
event
)
{
b_noshow
=
event
.
IsChecked
();
}
void
InteractionDialog
::
Finish
(
int
i_ret
)
{
vlc_mutex_lock
(
&
p_dialog
->
p_interaction
->
object_lock
);
vector
<
InputWidget
>::
iterator
it
=
input_widgets
.
begin
();
while
(
it
<
input_widgets
.
end
()
)
{
...
...
@@ -173,8 +257,9 @@ void InteractionDialog::Finish( int i_ret )
it
++
;
}
Hide
();
vlc_mutex_lock
(
&
p_dialog
->
p_interaction
->
object_lock
);
p_dialog
->
i_status
=
ANSWERED_DIALOG
;
p_dialog
->
i_return
=
i_ret
;
vlc_mutex_unlock
(
&
p_dialog
->
p_interaction
->
object_lock
);
}
#undef FREE
modules/gui/wxwidgets/dialogs/interaction.hpp
View file @
f08d346e
...
...
@@ -57,6 +57,8 @@ namespace wxvlc
void
OnOkYes
(
wxCommandEvent
&
event
);
void
OnCancel
(
wxCommandEvent
&
event
);
void
OnNo
(
wxCommandEvent
&
event
);
void
OnClear
(
wxCommandEvent
&
event
);
void
OnNoShow
(
wxCommandEvent
&
event
);
void
Render
();
void
Finish
(
int
);
...
...
@@ -75,6 +77,8 @@ namespace wxvlc
intf_thread_t
*
p_intf
;
interaction_dialog_t
*
p_dialog
;
wxWindow
*
p_parent
;
bool
b_noshow
;
};
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment